UNPKG

@prexo/ai-chat-sdk

Version:

AI Chat Component with Persistent History

31 lines (28 loc) 1.18 kB
import { ResetOptions, VectorPayload, AddContextPayload, SaveOperationResult } from '../../lib/types.js'; import { Index } from '@upstash/vector'; import 'ai'; declare class VectorDB { private index; constructor(index: Index); reset(options?: ResetOptions): Promise<void>; delete({ ids, namespace }: { ids: string[]; namespace?: string; }): Promise<void>; /** * A method that allows you to query the vector database with plain text. * It takes care of the text-to-embedding conversion by itself. * Additionally, it lets consumers pass various options to tweak the output. */ retrieve<TMetadata>({ question, similarityThreshold, topK, namespace, contextFilter, queryMode, }: VectorPayload): Promise<{ data: string; id: string; metadata: TMetadata; }[]>; /** * A method that allows you to add various data types into a vector database. * It supports plain text, embeddings, PDF, HTML, Text file and CSV. Additionally, it handles text-splitting for CSV, PDF and Text file. */ save(input: AddContextPayload): Promise<SaveOperationResult>; } export { VectorDB };