@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 2.41 kB
Source Map (JSON)
{"version":3,"file":"llama_cpp.d.ts","names":["LlamaModel","LlamaEmbeddingContext","Embeddings","EmbeddingsParams","LlamaBaseCppInputs","LlamaCppEmbeddingsParams","LlamaCppEmbeddings","Promise"],"sources":["../../src/embeddings/llama_cpp.d.ts"],"sourcesContent":["import { LlamaModel, LlamaEmbeddingContext } from \"node-llama-cpp\";\nimport { Embeddings, type EmbeddingsParams } from \"@langchain/core/embeddings\";\nimport { LlamaBaseCppInputs } from \"../utils/llama_cpp.js\";\n/**\n * Note that the modelPath is the only required parameter. For testing you\n * can set this in the environment variable `LLAMA_PATH`.\n */\nexport interface LlamaCppEmbeddingsParams extends LlamaBaseCppInputs, EmbeddingsParams {\n}\n/**\n * @example\n * ```typescript\n * // Initialize LlamaCppEmbeddings with the path to the model file\n * const embeddings = await LlamaCppEmbeddings.initialize({\n * modelPath: llamaPath,\n * });\n *\n * // Embed a query string using the Llama embeddings\n * const res = embeddings.embedQuery(\"Hello Llama!\");\n *\n * // Output the resulting embeddings\n * console.log(res);\n *\n * ```\n */\nexport declare class LlamaCppEmbeddings extends Embeddings {\n _model: LlamaModel;\n _embeddingContext: LlamaEmbeddingContext;\n constructor(inputs: LlamaCppEmbeddingsParams);\n /**\n * Initializes the llama_cpp model for usage in the embeddings wrapper.\n * @param inputs - the inputs passed onto the model.\n * @returns A Promise that resolves to the LlamaCppEmbeddings type class.\n */\n static initialize(inputs: LlamaBaseCppInputs): Promise<LlamaCppEmbeddings>;\n /**\n * Generates embeddings for an array of texts.\n * @param texts - An array of strings to generate embeddings for.\n * @returns A Promise that resolves to an array of embeddings.\n */\n embedDocuments(texts: string[]): Promise<number[][]>;\n /**\n * Generates an embedding for a single text.\n * @param text - A string to generate an embedding for.\n * @returns A Promise that resolves to an array of numbers representing the embedding.\n */\n embedQuery(text: string): Promise<number[]>;\n}\n//# sourceMappingURL=llama_cpp.d.ts.map"],"mappings":";;;;;;;;AAOA;AAkBA;AACYA,UAnBKK,wBAAAA,SAAiCD,kBAmBtCJ,EAnB0DG,gBAmB1DH,CAAAA;;;;;;;;AAD8C;;;;;;;;;cAArCM,kBAAAA,SAA2BJ,UAAAA;UACpCF;qBACWC;sBACCI;;;;;;4BAMMD,qBAAqBG,QAAQD;;;;;;mCAMtBC;;;;;;4BAMPA"}