ai-utils.js
Version:
Build AI applications, chatbots, and agents with JavaScript and TypeScript.
21 lines (20 loc) • 1.31 kB
TypeScript
import { FunctionOptions } from "../model-function/FunctionOptions.js";
import { TextEmbeddingModel, TextEmbeddingModelSettings } from "../model-function/embed-text/TextEmbeddingModel.js";
import { TextChunk } from "../text-chunk/TextChunk.js";
import { TextChunkRetriever, TextChunkRetrieverSettings } from "../text-chunk/retrieve-text-chunks/TextChunkRetriever.js";
import { VectorIndex } from "./VectorIndex.js";
export interface VectorIndexTextChunkRetrieverSettings {
maxResults?: number;
similarityThreshold?: number;
}
export declare class VectorIndexSimilarTextChunkRetriever<CHUNK extends TextChunk, INDEX, SETTINGS extends TextEmbeddingModelSettings> implements TextChunkRetriever<CHUNK, string, VectorIndexTextChunkRetrieverSettings> {
private readonly vectorIndex;
private readonly embeddingModel;
private readonly settings;
constructor({ vectorIndex, embeddingModel, maxResults, similarityThreshold, }: {
vectorIndex: VectorIndex<CHUNK, INDEX>;
embeddingModel: TextEmbeddingModel<unknown, SETTINGS>;
} & VectorIndexTextChunkRetrieverSettings);
retrieveTextChunks(query: string, options?: FunctionOptions<TextChunkRetrieverSettings>): Promise<CHUNK[]>;
withSettings(additionalSettings: Partial<VectorIndexTextChunkRetrieverSettings>): this;
}