UNPKG

@langchain/community

Version:
1 lines • 3.28 kB
{"version":3,"file":"deepinfra.d.ts","names":["Embeddings","EmbeddingsParams","DeepInfraEmbeddingsRequest","DeepInfraEmbeddingsParams","DeepInfraEmbeddingsResponse","DeepInfraEmbeddings","Partial","Promise"],"sources":["../../src/embeddings/deepinfra.d.ts"],"sourcesContent":["import { Embeddings, EmbeddingsParams } from \"@langchain/core/embeddings\";\nexport interface DeepInfraEmbeddingsRequest {\n inputs: string[];\n normalize?: boolean;\n image?: string;\n webhook?: string;\n}\n/**\n * Input parameters for the DeepInfra embeddings\n */\nexport interface DeepInfraEmbeddingsParams extends EmbeddingsParams {\n /**\n * The API token to use for authentication.\n * If not provided, it will be read from the `DEEPINFRA_API_TOKEN` environment variable.\n */\n apiToken?: string;\n /**\n * The model ID to use for generating completions.\n * Default: `sentence-transformers/clip-ViT-B-32`\n */\n modelName?: string;\n /**\n * The maximum number of texts to embed in a single request. This is\n * limited by the DeepInfra API to a maximum of 1024.\n */\n batchSize?: number;\n}\n/**\n * Response from the DeepInfra embeddings API.\n */\nexport interface DeepInfraEmbeddingsResponse {\n /**\n * The embeddings generated for the input texts.\n */\n embeddings: number[][];\n /**\n * The number of tokens in the input texts.\n */\n input_tokens: number;\n /**\n * The status of the inference.\n */\n request_id?: string;\n}\n/**\n * A class for generating embeddings using the DeepInfra API.\n * @example\n * ```typescript\n * // Embed a query using the DeepInfraEmbeddings class\n * const model = new DeepInfraEmbeddings();\n * const res = await model.embedQuery(\n * \"What would be a good company name for a company that makes colorful socks?\",\n * );\n * console.log({ res });\n * ```\n */\nexport declare class DeepInfraEmbeddings extends Embeddings implements DeepInfraEmbeddingsParams {\n apiToken: string;\n batchSize: number;\n modelName: string;\n /**\n * Constructor for the DeepInfraEmbeddings class.\n * @param fields - An optional object with properties to configure the instance.\n */\n constructor(fields?: Partial<DeepInfraEmbeddingsParams> & {\n verbose?: boolean;\n });\n /**\n * Generates embeddings for an array of texts.\n * @param inputs - An array of strings to generate embeddings for.\n * @returns A Promise that resolves to an array of embeddings.\n */\n embedDocuments(inputs: 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 private embeddingWithRetry;\n}\n//# sourceMappingURL=deepinfra.d.ts.map"],"mappings":";;;UACiBE,0BAAAA;;EAAAA,SAAAA,CAAAA,EAAAA,OAAAA;EASAC,KAAAA,CAAAA,EAAAA,MAAAA;EAoBAC,OAAAA,CAAAA,EAAAA,MAAAA;AA0BjB;;;;AAsB8BG,UApEbJ,yBAAAA,SAAkCF,gBAoErBM,CAAAA;EAtBmBP;;AAA+C;;;;;;;;;;;;;;;;;UA1B/EI,2BAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;cA0BIC,mBAAAA,SAA4BL,UAAAA,YAAsBG;;;;;;;;uBAQ9CG,QAAQH;;;;;;;;oCAQKI;;;;;;4BAMRA"}