UNPKG

@langchain/core

Version:
58 lines (56 loc) 2.38 kB
import { Embeddings, EmbeddingsParams } from "../../embeddings.js"; //#region src/utils/testing/embeddings.d.ts /** * An interface that defines additional parameters specific to the * SyntheticEmbeddings class. */ interface SyntheticEmbeddingsParams extends EmbeddingsParams { vectorSize: number; } /** * A class that provides synthetic embeddings by overriding the * embedDocuments and embedQuery methods to generate embeddings based on * the input documents. The embeddings are generated by converting each * document into chunks, calculating a numerical value for each chunk, and * returning an array of these values as the embedding. */ declare class SyntheticEmbeddings extends Embeddings implements SyntheticEmbeddingsParams { vectorSize: number; constructor(params?: SyntheticEmbeddingsParams); /** * Generates synthetic embeddings for a list of documents. * @param documents List of documents to generate embeddings for. * @returns A promise that resolves with a list of synthetic embeddings for each document. */ embedDocuments(documents: string[]): Promise<number[][]>; /** * Generates a synthetic embedding for a document. The document is * converted into chunks, a numerical value is calculated for each chunk, * and an array of these values is returned as the embedding. * @param document The document to generate an embedding for. * @returns A promise that resolves with a synthetic embedding for the document. */ embedQuery(document: string): Promise<number[]>; } /** * A class that provides fake embeddings by overriding the embedDocuments * and embedQuery methods to return fixed values. */ declare class FakeEmbeddings extends Embeddings { constructor(params?: EmbeddingsParams); /** * Generates fixed embeddings for a list of documents. * @param documents List of documents to generate embeddings for. * @returns A promise that resolves with a list of fixed embeddings for each document. */ embedDocuments(documents: string[]): Promise<number[][]>; /** * Generates a fixed embedding for a query. * @param _ The query to generate an embedding for. * @returns A promise that resolves with a fixed embedding for the query. */ embedQuery(_: string): Promise<number[]>; } //#endregion export { FakeEmbeddings, SyntheticEmbeddings }; //# sourceMappingURL=embeddings.d.ts.map