UNPKG

genkitx-chromadb

Version:

Genkit AI framework plugin for Chroma vector database.

101 lines (98 loc) 4.59 kB
import * as _genkit_ai_ai_retriever from '@genkit-ai/ai/retriever'; import { Where, WhereDocument, CollectionMetadata, Collection, ChromaClientParams as ChromaClientParams$1 } from 'chromadb'; export { IncludeEnum } from 'chromadb'; import { z, Genkit, EmbedderArgument } from 'genkit'; import { GenkitPlugin } from 'genkit/plugin'; declare const ChromaIndexerOptionsSchema: z.ZodOptional<z.ZodNull>; type ChromaClientParams = ChromaClientParams$1 | (() => Promise<ChromaClientParams$1>); type ChromaPluginParams<EmbedderCustomOptions extends z.ZodTypeAny = z.ZodTypeAny> = { clientParams?: ChromaClientParams; collectionName: string; createCollectionIfMissing?: boolean; embedder: EmbedderArgument<EmbedderCustomOptions>; embedderOptions?: z.infer<EmbedderCustomOptions>; }[]; /** * Chroma plugin that provides the Chroma retriever and indexer */ declare function chroma<EmbedderCustomOptions extends z.ZodTypeAny>(params: ChromaPluginParams<EmbedderCustomOptions>): GenkitPlugin; declare const chromaRetrieverRef: (params: { collectionName: string; displayName?: string; }) => _genkit_ai_ai_retriever.RetrieverReference<z.ZodOptional<z.ZodObject<z.objectUtil.extendShape<{ k: z.ZodOptional<z.ZodNumber>; }, { include: z.ZodOptional<z.ZodArray<z.ZodEnum<["documents", "embeddings", "metadatas", "distances"]>, "many">>; where: z.ZodOptional<z.ZodType<Where, z.ZodTypeDef, Where>>; whereDocument: z.ZodOptional<z.ZodType<WhereDocument, z.ZodTypeDef, WhereDocument>>; }>, "strip", z.ZodTypeAny, { include?: ("documents" | "embeddings" | "metadatas" | "distances")[] | undefined; where?: Where | undefined; whereDocument?: WhereDocument | undefined; k?: number | undefined; }, { include?: ("documents" | "embeddings" | "metadatas" | "distances")[] | undefined; where?: Where | undefined; whereDocument?: WhereDocument | undefined; k?: number | undefined; }>>>; declare const chromaIndexerRef: (params: { collectionName: string; displayName?: string; }) => _genkit_ai_ai_retriever.IndexerReference<z.ZodOptional<z.ZodOptional<z.ZodNull>>>; /** * Configures a Chroma vector store retriever. */ declare function chromaRetriever<EmbedderCustomOptions extends z.ZodTypeAny>(ai: Genkit, params: { clientParams?: ChromaClientParams; collectionName: string; createCollectionIfMissing?: boolean; embedder: EmbedderArgument<EmbedderCustomOptions>; embedderOptions?: z.infer<EmbedderCustomOptions>; }): _genkit_ai_ai_retriever.RetrieverAction<z.ZodOptional<z.ZodObject<z.objectUtil.extendShape<{ k: z.ZodOptional<z.ZodNumber>; }, { include: z.ZodOptional<z.ZodArray<z.ZodEnum<["documents", "embeddings", "metadatas", "distances"]>, "many">>; where: z.ZodOptional<z.ZodType<Where, z.ZodTypeDef, Where>>; whereDocument: z.ZodOptional<z.ZodType<WhereDocument, z.ZodTypeDef, WhereDocument>>; }>, "strip", z.ZodTypeAny, { include?: ("documents" | "embeddings" | "metadatas" | "distances")[] | undefined; where?: Where | undefined; whereDocument?: WhereDocument | undefined; k?: number | undefined; }, { include?: ("documents" | "embeddings" | "metadatas" | "distances")[] | undefined; where?: Where | undefined; whereDocument?: WhereDocument | undefined; k?: number | undefined; }>>>; /** * Configures a Chroma indexer. */ declare function chromaIndexer<EmbedderCustomOptions extends z.ZodTypeAny>(ai: Genkit, params: { clientParams?: ChromaClientParams; collectionName: string; createCollectionIfMissing?: boolean; embedder: EmbedderArgument<EmbedderCustomOptions>; embedderOptions?: z.infer<EmbedderCustomOptions>; }): _genkit_ai_ai_retriever.IndexerAction<z.ZodOptional<z.ZodNull>>; /** * Helper function for creating Chroma collections. * Currently only available for text * https://docs.trychroma.com/docs/embeddings/multimodal */ declare function createChromaCollection<EmbedderCustomOptions extends z.ZodTypeAny>(ai: Genkit, params: { name: string; clientParams?: ChromaClientParams; metadata?: CollectionMetadata; embedder?: EmbedderArgument<EmbedderCustomOptions>; embedderOptions?: z.infer<EmbedderCustomOptions>; }): Promise<Collection>; /** * Helper function for deleting Chroma collections. */ declare function deleteChromaCollection(params: { name: string; clientParams?: ChromaClientParams; }): Promise<void>; export { ChromaIndexerOptionsSchema, chroma, chromaIndexer, chromaIndexerRef, chromaRetriever, chromaRetrieverRef, createChromaCollection, deleteChromaCollection };