@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 2.96 kB
Source Map (JSON)
{"version":3,"file":"replicate.d.ts","names":["LLM","BaseLLMParams","CallbackManagerForLLMRun","GenerationChunk","ReplicateInstance","ReplicateInput","Replicate","Promise","AsyncGenerator"],"sources":["../../src/llms/replicate.d.ts"],"sourcesContent":["import { LLM, type BaseLLMParams } from \"@langchain/core/language_models/llms\";\nimport { CallbackManagerForLLMRun } from \"@langchain/core/callbacks/manager\";\nimport { GenerationChunk } from \"@langchain/core/outputs\";\nimport type ReplicateInstance from \"replicate\";\n/**\n * Interface defining the structure of the input data for the Replicate\n * class. It includes details about the model to be used, any additional\n * input parameters, and the API key for the Replicate service.\n */\nexport interface ReplicateInput {\n model: `${string}/${string}:${string}`;\n input?: {\n [key: string]: string | number | boolean;\n };\n apiKey?: string;\n /** The key used to pass prompts to the model. */\n promptKey?: string;\n}\n/**\n * Class responsible for managing the interaction with the Replicate API.\n * It handles the API key and model details, makes the actual API calls,\n * and converts the API response into a format usable by the rest of the\n * LangChain framework.\n * @example\n * ```typescript\n * const model = new Replicate({\n * model: \"replicate/flan-t5-xl:3ae0799123a1fe11f8c89fd99632f843fc5f7a761630160521c4253149754523\",\n * });\n *\n * const res = await model.invoke(\n * \"Question: What would be a good company name for a company that makes colorful socks?\\nAnswer:\"\n * );\n * console.log({ res });\n * ```\n */\nexport declare class Replicate extends LLM implements ReplicateInput {\n static lc_name(): string;\n get lc_secrets(): {\n [key: string]: string;\n } | undefined;\n lc_serializable: boolean;\n model: ReplicateInput[\"model\"];\n input: ReplicateInput[\"input\"];\n apiKey: string;\n promptKey?: string;\n constructor(fields: ReplicateInput & BaseLLMParams);\n _llmType(): string;\n /** @ignore */\n _call(prompt: string, options: this[\"ParsedCallOptions\"]): Promise<string>;\n _streamResponseChunks(prompt: string, options: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): AsyncGenerator<GenerationChunk>;\n /** @ignore */\n static imports(): Promise<{\n Replicate: typeof ReplicateInstance;\n }>;\n private _prepareReplicate;\n private _getReplicateInput;\n}\n//# sourceMappingURL=replicate.d.ts.map"],"mappings":";;;;;;;;;AASA;AA0BA;;AAOWK,UAjCMA,cAAAA,CAiCNA;EAGaA,KAAAA,EAAAA,GAAAA,MAAAA,IAAAA,MAAAA,IAAAA,MAAAA,EAAAA;EAAiBJ,KAAAA,CAAAA,EAAAA;IAGsBM,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EAAAA,MAAAA,GAAAA,MAAAA,GAAAA,OAAAA;EAC4BL,CAAAA;EAA0CC,MAAAA,CAAAA,EAAAA,MAAAA;EAAfK;EAG5FJ,SAAAA,CAAAA,EAAAA,MAAAA;;;;AAjB0C;;;;;;;;;;;;;;;cAA/CE,SAAAA,SAAkBN,GAAAA,YAAeK;;;;;;SAM3CA;SACAA;;;sBAGaA,iBAAiBJ;;;6DAGsBM;yFAC4BL,2BAA2BM,eAAeL;;oBAE/GI;sBACIH"}