import { Readable } from 'stream'; declare class CortexApiClient { private org; private apiUrl; private accessToken; private apiVersion; private readonly maxRequestSize; constructor(org: string, apiUrl: string, accessToken: string, apiVersion?: string); POST(path: string, body?: any): Promise; PUT(path: string, body?: any): Promise; GET(path: string, body?: any): Promise; DELETE(path: string, body?: any): Promise; POSTForm(path: string, form: FormData): Promise; private makeRequest; private static getFormDataSize; } type UrlContentType = "url"; type SitemapContentType = "sitemap-url"; type TextContentType = "text" | "markdown"; type JSONContentType = "json"; type FileContentType = "file"; type ContentType = FileContentType | TextContentType | JSONContentType | UrlContentType | SitemapContentType; type UrlDocument = { url: string; contentType: UrlContentType; }; type SitemapDocument = { sitemapUrl: string; contentType: SitemapContentType; }; type JSONDocument = { documentId: string; content: object; contentType: JSONContentType; url?: string; imageUrl?: string; }; type TextDocument = { documentId: string; content: string; contentType: TextContentType; url?: string; imageUrl?: string; }; type FileDocument = { documentId: string; contentType: FileContentType; filePath: string; url?: string; imageUrl?: string; }; type DocumentBatch = TextDocument[] | JSONDocument[] | FileDocument[] | UrlDocument[] | SitemapDocument[]; type DocumentInput = { documentId: string; content?: string; contentType: ContentType; url?: string; imageUrl?: string; }; declare class Document { readonly catalog: Catalog; private apiClient; readonly documentId: string; readonly content: string; readonly contentType: ContentType; readonly url?: string | undefined; readonly imageUrl?: string | undefined; private constructor(); static get(apiClient: CortexApiClient, catalog: Catalog, documentId: string): Promise; delete(): Promise; } type DocumentListItem = { documentId: string; contentType: ContentType; url?: string; imageUrl?: string; get: () => Promise; delete: () => Promise; }; type JSONIndexerOpts = { batchSize?: number; getId?: (document: any) => string; getUrl?: (document: any) => string | undefined; getImageUrl?: (document: any) => string | undefined; }; declare class JSONIndexer { private catalog; private documents; private readonly batchSize; private readonly getId; private readonly getImageUrl; private readonly getUrl; private batch; constructor(catalog: Catalog, documents: any[], opts?: JSONIndexerOpts); static defaultGetId(document: any): string; static defaultGetUrl(document: any): string | undefined; static defaultGetImageUrl(document: any): string | undefined; private static findFirstMatchingProperty; index(): Promise; private indexItems; } type DirectoryIndexerOpts = { rootDir: string; urlBase?: string; batchSize?: number; getUrl?: (docPathList: string[], sitePathList: string[]) => string; getId?: (docPathList: string[], sitePathList: string[]) => string; getImageUrl?: (docPathList: string[], sitePathList: string[]) => string; includeFile?: (filePath: string) => boolean; includeDirectory?: (path: string) => boolean; }; declare class DirectoryIndexer { catalog: Catalog; private readonly batchSize; private readonly rootDir; private readonly urlBase?; private files; constructor(catalog: Catalog, opts: DirectoryIndexerOpts); index(): Promise; private processDirectory; private processDocument; private getUrl; private getId; private getImageUrl; private includeFile; private includeDirectory; } type TSVIndexerOpts = { batchSize?: number; getId?: (item: any) => string; getUrl?: (item: any) => string; getImageUrl?: (item: any) => string; fieldMapping?: { [key: string]: string; }; }; declare class TSVIndexer { catalog: Catalog; private file; private readonly getId; private readonly getImageUrl; private readonly getUrl; private readonly fieldMapping; private readonly batchSize?; private documents; constructor(catalog: Catalog, file: string, opts?: TSVIndexerOpts); index(): Promise; private indexItems; } type ShopifyIndexerOpts = { shopifyBaseUrl: string; maxItems?: number; batchSize?: number; }; declare class ShopifyIndexer { private catalog; private opts; private readonly batchSize; private documents; private deletes; private idsToDelete; private page; constructor(catalog: Catalog, opts: ShopifyIndexerOpts); private stripHTML; index(): Promise; private indexProducts; private deleteProducts; } type CatalogConfig = { description: string; instructions: string[]; }; type CatalogListResult = { name: string; description: string; documentCount: number; Catalog(): Promise; }; type DocumentListResult = { documents: DocumentListItem[]; nextPage: () => Promise; }; type DocumentPaginationOpts = { page: number; pageSize?: number; }; type CreateCatalogConfig = CatalogConfig & { catalogName: string; }; type UpsertDocumentsResult = { warnings: string[]; }; declare class Catalog { readonly config: CatalogConfig; private apiClient; readonly name: string; private deleted; private constructor(); static get(apiClient: CortexApiClient, name: string): Promise; static configure(apiClient: CortexApiClient, name: string, config: CatalogConfig): Promise; static list(apiClient: CortexApiClient): Promise; documentCount(): Promise; truncate(): Promise; upsertDocuments(batch: DocumentBatch): Promise; delete(): Promise; getDocument(documentId: string): Promise; deleteDocument(documentId: string): Promise; listDocuments(paginationOpts?: DocumentPaginationOpts): Promise; jsonIndexer(documents: any[], opts?: JSONIndexerOpts): JSONIndexer; directoryIndexer(opts: DirectoryIndexerOpts): DirectoryIndexer; tsvIndexer(file: string, opts?: TSVIndexerOpts): TSVIndexer; shopifyIndexer(opts: ShopifyIndexerOpts): ShopifyIndexer; private checkDeleted; } type ContentCommandType = "ai-generate" | "ai-refine" | "ai-regenerate" | "user-edit" | "revert"; declare const ContentStatus: { Draft: "DRAFT"; InReview: "IN_REVIEW"; Approved: "APPROVED"; Published: "PUBLISHED"; }; type ContentStatus = (typeof ContentStatus)[keyof typeof ContentStatus]; type SettableContentStatus = "DRAFT" | "IN_REVIEW" | "APPROVED"; interface CreateContentOptsBase { client: CortexApiClient; cortex: Cortex; title: string; prompt: string; stream?: boolean; statusStream?: Readable; } interface CreateContentOptsStreaming extends CreateContentOptsBase { stream?: true; } interface CreateContentOptsSync extends CreateContentOptsBase { stream?: false; } interface RefineContentOptsBase { prompt: string; stream?: boolean; statusStream?: Readable; } interface RefineContentOptsStreaming extends RefineContentOptsBase { stream?: true; } interface RefineContentOptsSync extends RefineContentOptsBase { stream?: false; } type StreamingContentResult = { readonly contentStream: Readable; readonly content: Promise; }; type ContentCommand = { commandType: ContentCommandType; command?: string; version: number; }; type EditContentOpts = { title?: string; content?: string; }; type ContentListItem = { title: string; latestVersion: number; id: string; userEmail?: string; cortexName: string; createdAt: string; status: ContentStatus; publishedVersion?: number; Content(): Promise; }; type ContentListResult = { nextPage: () => Promise; content: ContentListItem[]; }; type ContentListOptions = { cursor?: string; pageSize?: number; userEmail?: string | null; cortexName?: string; status?: ContentStatus; }; type ContentMetadata = { id: string; title: string; version: number; commands: ContentCommand[]; cortex: string; createdAt: string; userEmail: string; status: ContentStatus; publishedVersion: number | null; }; type ContentPublishTarget = { id: string; name: string; type: "github_repo"; }; type ContentFulfilledPublishTarget = { id: string; name: string; type: "github_repo"; path: string; } | { id: "none"; type: "none"; }; declare class Content { private apiClient; private _id; private _title; private _content; private _commands; private _version; private _createdAt; private _status; private _cortex?; private _userEmail?; private _publishedVersion?; get id(): string; get title(): string; get content(): string; get commands(): ContentCommand[]; get version(): number; get cortex(): string | undefined; get userEmail(): string | undefined; get createdAt(): string; get status(): ContentStatus; get publishedVersion(): number | undefined; private constructor(); static create(opts: CreateContentOptsSync): Promise; static create(opts: CreateContentOptsStreaming): Promise; private static createContentSync; private static createContentStreaming; static get(client: CortexApiClient, id: string, version?: number): Promise; edit(opts: EditContentOpts): Promise; refine(opts: RefineContentOptsSync): Promise; refine(opts: RefineContentOptsStreaming): Promise; private refineContentSync; private refineContentStreaming; revert(version: number): Promise; setStatus(status: SettableContentStatus): Promise; publish(publishTarget?: ContentFulfilledPublishTarget): Promise; unpublish(): Promise; getPublishTargets(): Promise; private updateFromResponseBody; static list(client: CortexApiClient, opts?: ContentListOptions): Promise; } type CortexConfig = { /** * The name that this Cortex should refer to itself as, (e.g. "Acme Assistant", "Acme AI") */ friendlyName: string; /** * The catalogs that should be referenced when generating content and answering questions */ catalogs?: string[]; /** * A complete description of the goal task and a list of steps this cortex should follow when generating content and answering questions. */ instructions: string[]; /** * Whether or not this Cortex should be available on the internet, without authentication. This is common for scenarios like publishing blog content, and customer support. */ public: boolean; /** * fine-tuned control over the verbosity, tone, and rules that are used to generate content. */ customizations?: { /** * A list or "dos and dont's" that the cortex should follow. */ rules?: string[]; personality?: string[]; chatVerbosity?: string; writeVerbosity?: string; }; /** * configuration for the built-in hosted chat UI. */ chatConfig?: { /** * The initial greeting message rendered in chat. */ greeting: string; /** * An introductory message that explains to users the purpose of this Cortex is and what it can help with. */ intro: string; /** * A list of questions that will be rendered and suggested to users when they load the chat window. */ examples: string[]; }; /** * override org-level defaults */ overrides?: { /** * Whether or not global org-level rules should be followed. Defaults to 'true'. */ inheritRules?: boolean; /** * The company name */ companyName?: string; /** * A description of your company, industry, and products and services provided. */ companyInfo?: string; }; }; interface CortexCreateContentOptsBase { title: string; prompt: string; stream?: boolean; statusStream?: Readable; } interface CortexContentOptsStreaming extends CortexCreateContentOptsBase { stream?: true; } interface CortexCreateContentOptsSync extends CortexCreateContentOptsBase { stream?: false; } interface CortexCreateChatOptsBase { message: string; stream?: boolean; statusStream?: Readable; externalUserId?: string; } interface CortexCreateChatOptsStreaming extends CortexCreateChatOptsBase { stream?: true; } interface CortexCreateChatOptsSync extends CortexCreateChatOptsBase { stream?: false; } declare class Cortex { readonly config: CortexConfig; private apiClient; readonly name: string; private deleted; private constructor(); static get(apiClient: CortexApiClient, name: string): Promise; static list(apiClient: CortexApiClient): Promise; static configure(apiClient: CortexApiClient, name: string, config: CortexConfig): Promise; delete(): Promise; chat(opts: CortexCreateChatOptsSync): Promise; chat(opts: CortexCreateChatOptsStreaming): Promise; generateContent(opts: CortexCreateContentOptsSync): Promise; generateContent(opts: CortexContentOptsStreaming): Promise; private checkDeleted; } interface CreateChatOptsBase { client: CortexApiClient; cortex: Cortex; message: string; stream?: boolean; statusStream?: Readable; externalUserId?: string; } interface CreateChatOptsStreaming extends CreateChatOptsBase { stream?: true; } interface CreateChatOptsSync extends CreateChatOptsBase { stream?: false; } type StreamingChatResult = { readonly responseStream: Readable; readonly chat: Promise; }; interface RespondChatOptsBase { message: string; cortex?: Cortex; stream?: boolean; statusStream?: Readable; } interface RespondChatOptsStreaming extends RespondChatOptsBase { stream?: true; } interface RespondChatOptsSync extends RespondChatOptsBase { stream?: false; } interface ChatListItem { title: string; id: string; messageCount: number; userEmail?: string; cortexName: string; createdAt: string; externalUserId?: string; Chat(): Promise; } interface ChatListResult { chats: ChatListItem[]; nextPage: () => Promise; } interface ChatListOpts { cursor?: string; pageSize?: number; userEmail?: string | null; externalUserId?: string; cortexName?: string; } type Message = { role: "user" | "cortex"; message: string; }; declare class Chat { private apiClient; readonly id: string; readonly title: string; readonly messages: Message[]; readonly createdAt: string; readonly userEmail?: string | undefined; readonly externalUserId?: string | undefined; private constructor(); static create(opts: CreateChatOptsSync): Promise; static create(opts: CreateChatOptsStreaming): Promise; private static createContentSync; private static createContentStreaming; static get(client: CortexApiClient, id: string): Promise; static list(client: CortexApiClient, opts?: ChatListOpts): Promise; respond(opts: RespondChatOptsSync): Promise; respond(opts: RespondChatOptsStreaming): Promise; private respondChatSync; private respondChatStreaming; } type OrgConfigOpts = { companyName: string; companyInfo: string; personality?: string[]; rules?: string[]; }; declare class OrgConfig { /** * The default name that all your company should be referred to in all writen content. */ readonly companyName: string; /** * A description of your company, industry, and products and services provided. */ readonly companyInfo: string; /** * Voice and tone descriptors applied to all written content. i.e. ["concise", "professional", "bubbly", ... ] */ readonly personality?: string[]; /** * A list of dos and don'ts that all written content should follow. i.e. ["do not speak disparigingly about X"] */ readonly rules?: string[]; private constructor(); static get(client: CortexApiClient): Promise; static configure(client: CortexApiClient, config: OrgConfigOpts): Promise; } type IndexerExecutionStatus = "success" | "failure" | "inProgress"; type IndexerExecutionResult = { status: IndexerExecutionStatus; startTimeUtc: string; endTimeUtc?: string; errors: string[]; warnings: string[]; }; type IndexerExecutionHistory = { results: IndexerExecutionResult[]; }; type WebScraperDataSourceConfig = { sitemaps?: string[]; urls?: string[]; urlPrefixesToInclude?: string[]; urlPrefixesToExclude?: string[]; }; type GithubDataSourceConfig = { owner: string; repo: string; code?: { branch?: string; pathPatterns?: string[]; }; }; type IndexerDataSource = { type: "webScraper"; config: WebScraperDataSourceConfig; } | { type: "github"; config: GithubDataSourceConfig; }; type IndexerDataTarget = { catalogName: string; }; declare enum IndexerScheduleFrequency { OnDemand = "once",// Note the different from the REST API, which uses "once" Daily = "daily", Weekly = "weekly", Monthly = "monthly" } type IndexerSchedule = { frequency: IndexerScheduleFrequency; }; type IndexerConfig = { name: string; dataSource: IndexerDataSource; dataTarget: IndexerDataTarget; schedule: IndexerSchedule; }; type RunOptions = { waitForCompletion: boolean; }; declare class Indexer { readonly config: IndexerConfig; private readonly apiClient; private constructor(); static get(apiClient: CortexApiClient, name: string): Promise; static create(apiClient: CortexApiClient, name: string, catalogName: string, schedule: IndexerScheduleFrequency, dataSource: IndexerDataSource): Promise; static list(apiClient: CortexApiClient): Promise; update(): Promise; delete(): Promise; run(): Promise; run(options: { waitForCompletion: false; }): Promise; run(options: { waitForCompletion: true; }): Promise; getExecutionHistory(): Promise; } type CortexClientArgs = { org: string; accessToken: string; apiUrl?: string; }; interface ClientCreateContentOptsBase { cortex: Cortex; title: string; prompt: string; stream?: boolean; statusStream?: Readable; } interface ClientCreateContentOptsSync extends ClientCreateContentOptsBase { stream?: false; } interface ClientCreateContentOptsStreaming extends ClientCreateContentOptsBase { stream?: true; } interface ClientCreateChatOptsBase { message: string; cortex: Cortex; stream?: boolean; statusStream?: Readable; } interface ClientCreateChatOptsStreaming extends ClientCreateChatOptsBase { stream?: true; } interface ClientCreateChatOptsSync extends ClientCreateChatOptsBase { stream?: false; } interface ClientListContentOpts { pageSize?: number; cursor?: string; userEmail?: string | null; cortexName?: string; status?: ContentStatus; } interface ClientListChatOpts { pageSize?: number; cursor?: string; userEmail?: string | null; externalUserId?: string; cortexName?: string; } declare class CortexClient { private apiClient; constructor(args: CortexClientArgs); chat(opts: ClientCreateChatOptsSync): Promise; chat(opts: ClientCreateChatOptsStreaming): Promise; getChat(id: string): Promise; generateContent(opts: ClientCreateContentOptsSync): Promise; generateContent(opts: ClientCreateContentOptsStreaming): Promise; getContent(id: string, version?: number): Promise; listContent(options?: ClientListContentOpts): Promise; listChats(options?: ClientListChatOpts): Promise; getCortex(name: string): Promise; listCortexes(): Promise; configureCortex(name: string, opts: CortexConfig): Promise; configureOrg(opts: OrgConfigOpts): Promise; getOrgConfig(): Promise; getCatalog(name: string): Promise; configureCatalog(name: string, opts: CatalogConfig): Promise; listCatalogs(): Promise; createWebScraperIndexer(name: string, catalogName: string, schedule: IndexerScheduleFrequency, config: WebScraperDataSourceConfig): Promise; createGithubIndexer(name: string, catalogName: string, schedule: IndexerScheduleFrequency, config: GithubDataSourceConfig): Promise; getIndexer(name: string): Promise; listIndexers(): Promise; } export { Catalog, type CatalogConfig, type CatalogListResult, Chat, type ChatListItem, type ChatListOpts, type ChatListResult, type ClientCreateChatOptsBase, type ClientCreateChatOptsStreaming, type ClientCreateChatOptsSync, type ClientCreateContentOptsBase, type ClientCreateContentOptsStreaming, type ClientCreateContentOptsSync, type ClientListChatOpts, type ClientListContentOpts, Content, type ContentCommandType, type ContentFulfilledPublishTarget, type ContentListItem, type ContentListOptions, type ContentListResult, type ContentMetadata, type ContentPublishTarget, ContentStatus, type ContentType, Cortex, CortexApiClient, CortexClient, type CortexClientArgs, type CortexConfig, type CortexContentOptsStreaming, type CortexCreateChatOptsBase, type CortexCreateChatOptsStreaming, type CortexCreateChatOptsSync, type CortexCreateContentOptsBase, type CortexCreateContentOptsSync, type CreateCatalogConfig, type CreateChatOptsBase, type CreateChatOptsStreaming, type CreateChatOptsSync, type CreateContentOptsBase, type CreateContentOptsStreaming, type CreateContentOptsSync, DirectoryIndexer, type DirectoryIndexerOpts, Document, type DocumentBatch, type DocumentInput, type DocumentListItem, type DocumentListResult, type DocumentPaginationOpts, type EditContentOpts, type FileContentType, type FileDocument, type GithubDataSourceConfig, Indexer, type IndexerConfig, type IndexerDataSource, type IndexerDataTarget, type IndexerExecutionHistory, type IndexerExecutionResult, type IndexerExecutionStatus, type IndexerSchedule, IndexerScheduleFrequency, type JSONContentType, type JSONDocument, JSONIndexer, type JSONIndexerOpts, type Message, OrgConfig, type OrgConfigOpts, type RefineContentOptsBase, type RefineContentOptsStreaming, type RefineContentOptsSync, type RespondChatOptsBase, type RespondChatOptsStreaming, type RespondChatOptsSync, type RunOptions, type SettableContentStatus, ShopifyIndexer, type ShopifyIndexerOpts, type SitemapContentType, type SitemapDocument, type StreamingChatResult, type StreamingContentResult, TSVIndexer, type TSVIndexerOpts, type TextContentType, type TextDocument, type UpsertDocumentsResult, type UrlContentType, type UrlDocument, type WebScraperDataSourceConfig };