UNPKG

@langchain/community

Version:
1 lines • 2.59 kB
{"version":3,"file":"hf.d.cts","names":["InferenceClient","InferenceProviderOrPolicy","Embeddings","EmbeddingsParams","HuggingFaceInferenceEmbeddingsParams","HuggingFaceInferenceEmbeddings","Promise"],"sources":["../../src/embeddings/hf.d.ts"],"sourcesContent":["import { InferenceClient, InferenceProviderOrPolicy } from \"@huggingface/inference\";\nimport { Embeddings, type EmbeddingsParams } from \"@langchain/core/embeddings\";\n/**\n * Interface that extends EmbeddingsParams and defines additional\n * parameters specific to the HuggingFaceInferenceEmbeddings class.\n */\nexport interface HuggingFaceInferenceEmbeddingsParams extends EmbeddingsParams {\n apiKey?: string;\n model?: string;\n endpointUrl?: string;\n provider?: InferenceProviderOrPolicy;\n}\n/**\n * Class that extends the Embeddings class and provides methods for\n * generating embeddings using Hugging Face models through the\n * HuggingFaceInference API.\n */\nexport declare class HuggingFaceInferenceEmbeddings extends Embeddings implements HuggingFaceInferenceEmbeddingsParams {\n apiKey?: string;\n model: string;\n endpointUrl?: string;\n provider?: InferenceProviderOrPolicy;\n client: InferenceClient;\n constructor(fields?: HuggingFaceInferenceEmbeddingsParams);\n _embed(texts: string[]): Promise<number[][]>;\n /**\n * Method that takes a document as input and returns a promise that\n * resolves to an embedding for the document. It calls the _embed method\n * with the document as the input and returns the first embedding in the\n * resulting array.\n * @param document Document to generate an embedding for.\n * @returns Promise that resolves to an embedding for the document.\n */\n embedQuery(document: string): Promise<number[]>;\n /**\n * Method that takes an array of documents as input and returns a promise\n * that resolves to a 2D array of embeddings for each document. It calls\n * the _embed method with the documents as the input.\n * @param documents Array of documents to generate embeddings for.\n * @returns Promise that resolves to a 2D array of embeddings for each document.\n */\n embedDocuments(documents: string[]): Promise<number[][]>;\n}\n//# sourceMappingURL=hf.d.ts.map"],"mappings":";;;;;;;AAMA;AAWA;AAIeC,UAfEG,oCAAAA,SAA6CD,gBAe/CF,CAAAA;EACHD,MAAAA,CAAAA,EAAAA,MAAAA;EACaI,KAAAA,CAAAA,EAAAA,MAAAA;EACIE,WAAAA,CAAAA,EAAAA,MAAAA;EASKA,QAAAA,CAAAA,EAvBnBL,yBAuBmBK;;;;AAhBoF;;;cAAjGD,8BAAAA,SAAuCH,UAAAA,YAAsBE;;;;aAInEH;UACHD;uBACaI;2BACIE;;;;;;;;;gCASKA;;;;;;;;uCAQOA"}