import { Document } from "@langchain/core/documents"; import type { EmbeddingsInterface } from "@langchain/core/embeddings"; import { VectorStore } from "@langchain/core/vectorstores"; declare const IdColumnSymbol: unique symbol; declare const ContentColumnSymbol: unique symbol; type ColumnSymbol = typeof IdColumnSymbol | typeof ContentColumnSymbol; declare type Value = unknown; declare type RawValue = Value | Sql; declare class Sql { strings: string[]; constructor(rawStrings: ReadonlyArray, rawValues: ReadonlyArray); } type PrismaNamespace = { ModelName: Record; Sql: typeof Sql; raw: (sql: string) => Sql; join: (values: RawValue[], separator?: string, prefix?: string, suffix?: string) => Sql; sql: (strings: ReadonlyArray, ...values: RawValue[]) => Sql; }; type PrismaClient = { $queryRaw(query: TemplateStringsArray | Sql, ...values: any[]): Promise; $executeRaw(query: TemplateStringsArray | Sql, ...values: any[]): Promise; $transaction

[]>(arg: [...P]): Promise; }; type ObjectIntersect = { [P in keyof A & keyof B]: A[P] | B[P]; }; type ModelColumns> = { [K in keyof TModel]?: true | ColumnSymbol; }; export type PrismaSqlFilter> = { [K in keyof TModel]?: { equals?: TModel[K]; in?: TModel[K][]; notIn?: TModel[K][]; isNull?: TModel[K]; isNotNull?: TModel[K]; like?: TModel[K]; lt?: TModel[K]; lte?: TModel[K]; gt?: TModel[K]; gte?: TModel[K]; not?: TModel[K]; }; }; type SimilarityModel = Record, TColumns extends ModelColumns = ModelColumns> = Pick> & { _distance: number | null; }; type DefaultPrismaVectorStore = PrismaVectorStore, string, ModelColumns>, PrismaSqlFilter>>; /** * A specific implementation of the VectorStore class that is designed to * work with Prisma. It provides methods for adding models, documents, and * vectors, as well as for performing similarity searches. */ export declare class PrismaVectorStore, TModelName extends string, TSelectModel extends ModelColumns, TFilterModel extends PrismaSqlFilter> extends VectorStore { FilterType: TFilterModel; protected tableName: string; protected vectorColumnName: string; protected selectColumns: string[]; filter?: TFilterModel; idColumn: keyof TModel & string; contentColumn: keyof TModel & string; static IdColumn: typeof IdColumnSymbol; static ContentColumn: typeof ContentColumnSymbol; protected db: PrismaClient; protected Prisma: PrismaNamespace; _vectorstoreType(): string; constructor(embeddings: EmbeddingsInterface, config: { db: PrismaClient; prisma: PrismaNamespace; tableName: TModelName; vectorColumnName: string; columns: TSelectModel; filter?: TFilterModel; }); /** * Creates a new PrismaVectorStore with the specified model. * @param db The PrismaClient instance. * @returns An object with create, fromTexts, and fromDocuments methods. */ static withModel>(db: PrismaClient): { create: , TFilters extends PrismaSqlFilter>(embeddings: EmbeddingsInterface, config: { prisma: TPrisma; tableName: keyof TPrisma["ModelName"] & string; vectorColumnName: string; columns: TColumns; filter?: TFilters | undefined; }) => PrismaVectorStore; fromTexts: >(texts: string[], metadatas: TModel[], embeddings: EmbeddingsInterface, dbConfig: { prisma: TPrisma_1; tableName: keyof TPrisma_1["ModelName"] & string; vectorColumnName: string; columns: TColumns_1; }) => Promise; fromDocuments: , TFilters_1 extends PrismaSqlFilter>(docs: Document[], embeddings: EmbeddingsInterface, dbConfig: { prisma: TPrisma_2; tableName: keyof TPrisma_2["ModelName"] & string; vectorColumnName: string; columns: TColumns_2; }) => Promise>; }; /** * Adds the specified models to the store. * @param models The models to add. * @returns A promise that resolves when the models have been added. */ addModels(models: TModel[]): Promise; /** * Adds the specified documents to the store. * @param documents The documents to add. * @returns A promise that resolves when the documents have been added. */ addDocuments(documents: Document[]): Promise; /** * Adds the specified vectors to the store. * @param vectors The vectors to add. * @param documents The documents associated with the vectors. * @returns A promise that resolves when the vectors have been added. */ addVectors(vectors: number[][], documents: Document[]): Promise; /** * Performs a similarity search with the specified query. * @param query The query to use for the similarity search. * @param k The number of results to return. * @param _filter The filter to apply to the results. * @param _callbacks The callbacks to use during the search. * @returns A promise that resolves with the search results. */ similaritySearch(query: string, k?: number, filter?: this["FilterType"] | undefined): Promise>[]>; /** * Performs a similarity search with the specified query and returns the * results along with their scores. * @param query The query to use for the similarity search. * @param k The number of results to return. * @param filter The filter to apply to the results. * @param _callbacks The callbacks to use during the search. * @returns A promise that resolves with the search results and their scores. */ similaritySearchWithScore(query: string, k?: number, filter?: this["FilterType"]): Promise<[import("@langchain/core/documents").DocumentInterface>, number][]>; /** * Performs a similarity search with the specified vector and returns the * results along with their scores. * @param query The vector to use for the similarity search. * @param k The number of results to return. * @param filter The filter to apply to the results. * @returns A promise that resolves with the search results and their scores. */ similaritySearchVectorWithScore(query: number[], k: number, filter?: this["FilterType"]): Promise<[Document>, number][]>; buildSqlFilterStr(filter?: this["FilterType"]): Sql | null; /** * Creates a new PrismaVectorStore from the specified texts. * @param texts The texts to use to create the store. * @param metadatas The metadata for the texts. * @param embeddings The embeddings to use. * @param dbConfig The database configuration. * @returns A promise that resolves with the new PrismaVectorStore. */ static fromTexts(texts: string[], metadatas: object[], embeddings: EmbeddingsInterface, dbConfig: { db: PrismaClient; prisma: PrismaNamespace; tableName: string; vectorColumnName: string; columns: ModelColumns>; }): Promise; /** * Creates a new PrismaVectorStore from the specified documents. * @param docs The documents to use to create the store. * @param embeddings The embeddings to use. * @param dbConfig The database configuration. * @returns A promise that resolves with the new PrismaVectorStore. */ static fromDocuments(docs: Document[], embeddings: EmbeddingsInterface, dbConfig: { db: PrismaClient; prisma: PrismaNamespace; tableName: string; vectorColumnName: string; columns: ModelColumns>; }): Promise; } export {};