@convo-lang/convo-lang-pinecone
Version:
The language of AI
43 lines (42 loc) • 1.67 kB
TypeScript
import { ConvoDocumentReference, ConvoRagSearch, ConvoRagSearchResult, ConvoRagService } from "@convo-lang/convo-lang";
import { Scope } from "@iyio/common";
export interface ConvoPineconeIndexMount {
path: string;
index: string;
}
export interface ConvoPineconeRagServiceOptions {
apiKey: string;
index?: string;
/**
* Array of additional indexes that are allowed to be used. If defined the array should include
* the default index defined by the index property
*/
allowedReadIndexes?: string[];
allowedWriteIndexes?: string[];
indexKey?: string;
cloud?: string;
region?: string;
model?: string;
autoCreateIndex?: boolean;
/**
* Maps filepaths to index
*/
indexMounts?: ConvoPineconeIndexMount[];
}
export declare class ConvoPineconeRagService implements ConvoRagService {
static fromScope(scope: Scope): ConvoPineconeRagService;
private readonly options;
constructor({ apiKey, index, indexKey, cloud, region, model, autoCreateIndex, allowedReadIndexes, allowedWriteIndexes, indexMounts, }: ConvoPineconeRagServiceOptions);
private _clientPromise;
private getClientAsync;
private createClient;
private readonly indexPromises;
private getIndexAsync;
private createIndexAsync;
isReadIndexAllowed(index: string): boolean;
isWriteIndexAllowed(index: string): boolean;
private getMountedIndex;
searchAsync(search: ConvoRagSearch): Promise<ConvoRagSearchResult>;
searchIndexAsync(search: ConvoRagSearch, index: string, paths?: string[]): Promise<ConvoRagSearchResult>;
upsertAsync(documents: ConvoDocumentReference[]): Promise<void>;
}