UNPKG

@squidcloud/client

Version:

A typescript implementation of the Squid client

203 lines (202 loc) 6.04 kB
import { AiEmbeddingsModelWithOptionalFields, AiKnowledgeBase, AiKnowledgeBaseChatOptions, AiKnowledgeBaseContext, AiKnowledgeBaseContextRequest, AiKnowledgeBaseSearchResultChunk } from '../public-types/ai-knowledge-base.public-types'; import { AiContextId, AiKnowledgeBaseId, AppId } from '../public-types/communication.public-types'; /** * Request structure for getting an AiKnowledgeBase * @category AI */ export interface GetAiKnowledgeBaseRequest { /** The id of the app */ appId: AppId; /** The id of the AiKnowledgeBase */ knowledgeBaseId: AiKnowledgeBaseId; } /** * Request structure for getting all AiKnowledgeBases * @category AI */ export interface GetAiKnowledgeBasesRequest { /** The id of the app */ appId: AppId; } /** * Response structure for getting an AiKnowledgeBase * @category AI */ export interface GetAiKnowledgeBaseResponse { /** The resulting AiKnowledgeBase, if it is found */ knowledgeBase: AiKnowledgeBase | undefined; } /** * Request structure for deleting an AiKnowledgeBase * @category AI */ export interface DeleteAiKnowledgeBaseRequest { /** The id of the AiKnowledgeBase */ id: string; } /** * Request structure for upserting an AiKnowledgeBase * @category AI */ export interface UpsertAiKnowledgeBaseRequest { /** The AiKnowledgeBase to upsert */ knowledgeBase: Omit<AiEmbeddingsModelWithOptionalFields, 'appId' | 'updatedAt'>; } /** * Response structure for listing AiKnowledgeBases * @category AI */ export interface ListAiKnowledgeBasesResponse { /** The list of AiKnowledgeBases */ knowledgeBases: Array<AiKnowledgeBase>; } /** * Request structure for listing AiKnowledgeBaseContexts * @category AI */ export interface ListAiKnowledgeBaseContextsRequest { /** The id of the AiKnowledgeBase */ id: string; /** The number of characters after which text is truncated. Optional */ truncateTextAfter?: number; } /** * Response structure to list AiKnowledgeBaseContexts * @category AI */ export interface ListAiKnowledgeBaseContextsResponse { /** The list of AiKnowledgeBaseContexts */ contexts: Array<AiKnowledgeBaseContext>; } /** * Response structure to list contextids for an AiKnowledgeBase * @category AI */ export interface ListAiKnowledgeBaseContextIdsResponse { /** The list of AiContextIds */ contextIds: Array<AiContextId>; } /** * Request structure for deleting AiKnowledgeBaseContexts * @category AI */ export interface DeleteAiKnowledgeBaseContextsRequest { /** The id of the AiKnowledgeBase */ knowledgeBaseId: string; /** An array of AiKnowledgeBaseContext ids */ contextIds: Array<string>; } /** * Request structure for getting an AiKnowledgeBaseContext * @category AI */ export interface GetAiKnowledgeBaseContextRequest { /** The id of the AiKnowledgeBase */ knowledgeBaseId: string; /** The id of the AiKnowledgeBaseContext */ contextId: string; } /** * Request structure for getting all AiKnowledgeBaseContexts * for a given knowledge base * @category AI */ export interface GetAiKnowledgeBaseContextsRequest { /** The id of the app */ appId: AppId; /** The id of the AiKnowledgeBase */ knowledgeBaseId: AiKnowledgeBaseId; /** The number of characters after which text is truncated. Optional */ truncateTextAfter?: number; } /** * Response structure for getting an AiKnowledgeBaseContext * @category AI */ export interface GetAiKnowledgeBaseContextResponse { /** The resulting AiKnowledgeBaseContext, if it is found */ context: AiKnowledgeBaseContext | undefined; } /** * Request structure for upserting context for an AiKnowledgeBase * @category AI */ export interface UpsertAiKnowledgeBaseContextsRequest { /** The id of the AiKnowledgeBase */ knowledgeBaseId: string; /** The AiKnowledgeBaseContext data, which could be a file or text */ contextRequests: Array<AiKnowledgeBaseContextRequest>; /** The job ID to use for the async upsert job */ jobId: string; } /** * Response structure for searching an AiKnowledgeBase * @category AI */ export interface AiKnowledgeBaseSearchResponse { /** Array of result chunks from the search */ chunks: Array<AiKnowledgeBaseSearchResultChunk>; } /** * Request structure for getting the size of context * for an AiKnowledgeBase * @category AI */ export interface AiKnowledgeBaseContextSizeRequest { /** The ID of the App */ appId: AppId; /** The ID of the AIKnowledgeBase */ knowledgeBaseId: AiKnowledgeBaseId; } /** * Request structure for identifying a knowledge base to reimport the context files (when possible). */ export interface AiKnowledgeBaseReimportAllFilesRequest { /** The ID of the AIKnowledgeBase */ knowledgeBaseId: AiKnowledgeBaseId; } /** * Request structure for identifying a knowledge base to reimport the context files (when possible). */ export interface AiKnowledgeBaseReimportFilesRequest { /** The ID of the AIKnowledgeBase */ knowledgeBaseId: AiKnowledgeBaseId; /** The ids of the AiKnowledgeBaseContexts to reimport */ contextIds: Array<string>; } /** * Response structure for getting size of context * @category AI */ export interface AiKnowledgeBaseContextSizeResponse { /** Size of context bytes, as a number */ sizeBytes: number; } /** * Request structure for getting the values vector of * a specific context * * @category AI */ export interface AiKnowledgeBaseValueVectorRequest { /** The ID of the App */ appId: AppId; /** The ID of the AIKnowledgeBase */ knowledgeBaseId: AiKnowledgeBaseId; /** The ID of the context */ contextId: AiContextId; } /** * Response structure for getting values vector of a * specific context * @category AI */ export interface AiKnowledgeBaseValueVectorResponse { /** The vector */ vector: number[]; } export interface AiKnowledgeBaseChatRequest { knowledgeBaseId: AiKnowledgeBaseId; prompt?: string; options?: AiKnowledgeBaseChatOptions; }