import { type Agent } from "./_shims/index.js"; import * as Core from "./core.js"; import * as Errors from "./error.js"; import * as Pagination from "./pagination.js"; import { type ContentsPageParams, ContentsPageResponse, type DatastoresPageParams, DatastoresPageResponse, type DocumentsPageParams, DocumentsPageResponse, type PageParams, PageResponse, type UsersPageParams, UsersPageResponse } from "./pagination.js"; import * as Uploads from "./uploads.js"; import * as API from "./resources/index.js"; import { Generate, GenerateCreateParams, GenerateCreateResponse } from "./resources/generate.js"; import { LMUnit, LMUnitCreateParams, LMUnitCreateResponse } from "./resources/lmunit.js"; import { Parse, ParseCreateParams, ParseCreateResponse, ParseJobResultsParams, ParseJobResultsResponse, ParseJobStatusResponse, ParseJobsParams, ParseJobsResponse } from "./resources/parse.js"; import { Rerank, RerankCreateParams, RerankCreateResponse } from "./resources/rerank.js"; import { InviteUsersResponse, ListUsersResponse, ListUsersResponseUsersUsersPage, NewUser, UserDeactivateParams, UserDeactivateResponse, UserInviteParams, UserListParams, UserUpdateParams, UserUpdateResponse, Users } from "./resources/users.js"; import { ACLConfig, Agent as AgentsAPIAgent, AgentConfigs, AgentCreateParams, AgentDeleteResponse, AgentListParams, AgentMetadata, AgentMetadataResponse, AgentResetResponse, AgentSaveTemplateParams, AgentSaveTemplateResponse, AgentUpdateParams, AgentUpdateResponse, Agents, AgentsPage, CreateAgentOutput, FilterAndRerankConfig, GenerateResponseConfig, GlobalConfig, ListAgentsResponse, ReformulationConfig, RetrievalConfig, TranslationConfig } from "./resources/agents/agents.js"; import { ChunkingConfiguration, CreateDatastoreResponse, Datastore, DatastoreCreateParams, DatastoreDeleteResponse, DatastoreListParams, DatastoreMetadata, DatastoreParseConfiguration, DatastoreResetResponse, DatastoreUpdateParams, DatastoreUpdateResponse, Datastores, DatastoresDatastoresPage, HTMLConfiguration, ListDatastoresResponse, UnstructuredDatastoreConfigModel } from "./resources/datastores/datastores.js"; export interface ClientOptions { /** * API key to access Contextual AI platform */ apiKey?: string | undefined; /** * Override the default base URL for the API, e.g., "https://api.example.com/v2/" * * Defaults to process.env['CONTEXTUAL_AI_BASE_URL']. */ baseURL?: string | null | undefined; /** * The maximum amount of time (in milliseconds) that the client should wait for a response * from the server before timing out a single request. * * Note that request timeouts are retried by default, so in a worst-case scenario you may wait * much longer than this timeout before the promise succeeds or fails. * * @unit milliseconds */ timeout?: number | undefined; /** * An HTTP agent used to manage HTTP(S) connections. * * If not provided, an agent will be constructed by default in the Node.js environment, * otherwise no agent is used. */ httpAgent?: Agent | undefined; /** * Specify a custom `fetch` function implementation. * * If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is * defined globally. */ fetch?: Core.Fetch | undefined; /** * The maximum number of times that the client will retry a request in case of a * temporary failure, like a network error or a 5XX error from the server. * * @default 2 */ maxRetries?: number | undefined; /** * Default headers to include with every request to the API. * * These can be removed in individual requests by explicitly setting the * header to `undefined` or `null` in request options. */ defaultHeaders?: Core.Headers | undefined; /** * Default query parameters to include with every request to the API. * * These can be removed in individual requests by explicitly setting the * param to `undefined` in request options. */ defaultQuery?: Core.DefaultQuery | undefined; } /** * API Client for interfacing with the Contextual AI API. */ export declare class ContextualAI extends Core.APIClient { #private; apiKey: string; private _options; /** * API Client for interfacing with the Contextual AI API. * * @param {string | undefined} [opts.apiKey=process.env['CONTEXTUAL_API_KEY'] ?? undefined] * @param {string} [opts.baseURL=process.env['CONTEXTUAL_AI_BASE_URL'] ?? https://api.contextual.ai/v1] - Override the default base URL for the API. * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections. * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API. * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API. */ constructor({ baseURL, apiKey, ...opts }?: ClientOptions); datastores: API.Datastores; agents: API.Agents; users: API.Users; lmUnit: API.LMUnit; rerank: API.Rerank; generate: API.Generate; parse: API.Parse; protected defaultQuery(): Core.DefaultQuery | undefined; protected defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers; protected authHeaders(opts: Core.FinalRequestOptions): Core.Headers; protected stringifyQuery(query: Record): string; static ContextualAI: typeof ContextualAI; static DEFAULT_TIMEOUT: number; static ContextualAIError: typeof Errors.ContextualAIError; static APIError: typeof Errors.APIError; static APIConnectionError: typeof Errors.APIConnectionError; static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError; static APIUserAbortError: typeof Errors.APIUserAbortError; static NotFoundError: typeof Errors.NotFoundError; static ConflictError: typeof Errors.ConflictError; static RateLimitError: typeof Errors.RateLimitError; static BadRequestError: typeof Errors.BadRequestError; static AuthenticationError: typeof Errors.AuthenticationError; static InternalServerError: typeof Errors.InternalServerError; static PermissionDeniedError: typeof Errors.PermissionDeniedError; static UnprocessableEntityError: typeof Errors.UnprocessableEntityError; static toFile: typeof Uploads.toFile; static fileFromPath: typeof Uploads.fileFromPath; } export declare namespace ContextualAI { export type RequestOptions = Core.RequestOptions; export import DatastoresPage = Pagination.DatastoresPage; export { type DatastoresPageParams as DatastoresPageParams, type DatastoresPageResponse as DatastoresPageResponse, }; export import DocumentsPage = Pagination.DocumentsPage; export { type DocumentsPageParams as DocumentsPageParams, type DocumentsPageResponse as DocumentsPageResponse, }; export import UsersPage = Pagination.UsersPage; export { type UsersPageParams as UsersPageParams, type UsersPageResponse as UsersPageResponse }; export import Page = Pagination.Page; export { type PageParams as PageParams, type PageResponse as PageResponse }; export import ContentsPage = Pagination.ContentsPage; export { type ContentsPageParams as ContentsPageParams, type ContentsPageResponse as ContentsPageResponse }; export { Datastores as Datastores, type ChunkingConfiguration as ChunkingConfiguration, type CreateDatastoreResponse as CreateDatastoreResponse, type Datastore as Datastore, type DatastoreMetadata as DatastoreMetadata, type DatastoreParseConfiguration as DatastoreParseConfiguration, type HTMLConfiguration as HTMLConfiguration, type ListDatastoresResponse as ListDatastoresResponse, type UnstructuredDatastoreConfigModel as UnstructuredDatastoreConfigModel, type DatastoreUpdateResponse as DatastoreUpdateResponse, type DatastoreDeleteResponse as DatastoreDeleteResponse, type DatastoreResetResponse as DatastoreResetResponse, DatastoresDatastoresPage as DatastoresDatastoresPage, type DatastoreCreateParams as DatastoreCreateParams, type DatastoreUpdateParams as DatastoreUpdateParams, type DatastoreListParams as DatastoreListParams, }; export { Agents as Agents, type ACLConfig as ACLConfig, type AgentsAPIAgent as Agent, type AgentConfigs as AgentConfigs, type AgentMetadata as AgentMetadata, type CreateAgentOutput as CreateAgentOutput, type FilterAndRerankConfig as FilterAndRerankConfig, type GenerateResponseConfig as GenerateResponseConfig, type GlobalConfig as GlobalConfig, type ListAgentsResponse as ListAgentsResponse, type ReformulationConfig as ReformulationConfig, type RetrievalConfig as RetrievalConfig, type TranslationConfig as TranslationConfig, type AgentUpdateResponse as AgentUpdateResponse, type AgentDeleteResponse as AgentDeleteResponse, type AgentMetadataResponse as AgentMetadataResponse, type AgentResetResponse as AgentResetResponse, type AgentSaveTemplateResponse as AgentSaveTemplateResponse, AgentsPage as AgentsPage, type AgentCreateParams as AgentCreateParams, type AgentUpdateParams as AgentUpdateParams, type AgentListParams as AgentListParams, type AgentSaveTemplateParams as AgentSaveTemplateParams, }; export { Users as Users, type InviteUsersResponse as InviteUsersResponse, type ListUsersResponse as ListUsersResponse, type NewUser as NewUser, type UserUpdateResponse as UserUpdateResponse, type UserDeactivateResponse as UserDeactivateResponse, ListUsersResponseUsersUsersPage as ListUsersResponseUsersUsersPage, type UserUpdateParams as UserUpdateParams, type UserListParams as UserListParams, type UserDeactivateParams as UserDeactivateParams, type UserInviteParams as UserInviteParams, }; export { LMUnit as LMUnit, type LMUnitCreateResponse as LMUnitCreateResponse, type LMUnitCreateParams as LMUnitCreateParams, }; export { Rerank as Rerank, type RerankCreateResponse as RerankCreateResponse, type RerankCreateParams as RerankCreateParams, }; export { Generate as Generate, type GenerateCreateResponse as GenerateCreateResponse, type GenerateCreateParams as GenerateCreateParams, }; export { Parse as Parse, type ParseCreateResponse as ParseCreateResponse, type ParseJobResultsResponse as ParseJobResultsResponse, type ParseJobStatusResponse as ParseJobStatusResponse, type ParseJobsResponse as ParseJobsResponse, type ParseCreateParams as ParseCreateParams, type ParseJobResultsParams as ParseJobResultsParams, type ParseJobsParams as ParseJobsParams, }; export type ParsedBlock = API.ParsedBlock; } export { toFile, fileFromPath } from "./uploads.js"; export { ContextualAIError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.js"; export default ContextualAI; //# sourceMappingURL=index.d.ts.map