{"version":3,"file":"fireworks.d.ts","names":["BaseChatModelParams","LangSmithParams","OpenAIClient","ChatOpenAICallOptions","OpenAIChatInput","OpenAICoreRequestOptions","ChatOpenAICompletions","FireworksUnsupportedArgs","FireworksUnsupportedCallOptions","ChatFireworksCallOptions","Omit","Partial","ChatFireworks","_langchain_core_load_serializable0","Serialized","Chat","ChatCompletionCreateParamsStreaming","Completions","ChatCompletionChunk","AsyncIterable","Promise","ChatCompletionCreateParamsNonStreaming","ChatCompletion"],"sources":["../../src/chat_models/fireworks.d.ts"],"sourcesContent":["import type { BaseChatModelParams, LangSmithParams } from \"@langchain/core/language_models/chat_models\";\nimport { type OpenAIClient, type ChatOpenAICallOptions, type OpenAIChatInput, type OpenAICoreRequestOptions, ChatOpenAICompletions } from \"@langchain/openai\";\ntype FireworksUnsupportedArgs = \"frequencyPenalty\" | \"presencePenalty\" | \"logitBias\" | \"functions\";\ntype FireworksUnsupportedCallOptions = \"functions\" | \"function_call\";\nexport type ChatFireworksCallOptions = Partial<Omit<ChatOpenAICallOptions, FireworksUnsupportedCallOptions>>;\n/**\n * Wrapper around Fireworks API for large language models fine-tuned for chat\n *\n * Fireworks API is compatible to the OpenAI API with some limitations described in\n * https://readme.fireworks.ai/docs/openai-compatibility.\n *\n * To use, you should have the `FIREWORKS_API_KEY` environment variable set.\n *\n * Setup:\n * Install `@langchain/community` and set a environment variable called `FIREWORKS_API_KEY`.\n *\n * ```bash\n * npm install @langchain/community\n * export FIREWORKS_API_KEY=\"your-api-key\"\n * ```\n *\n * ## [Constructor args](https://api.js.langchain.com/classes/langchain_community_chat_models_fireworks.ChatFireworks.html#constructor)\n *\n * ## [Runtime args](https://api.js.langchain.com/interfaces/langchain_openai.ChatOpenAICallOptions.html)\n *\n * Because the Fireworks API extends OpenAI's, the call option type is the same.\n *\n * Runtime args can be passed as the second argument to any of the base runnable methods `.invoke`. `.stream`, `.batch`, etc.\n * They can also be passed via `.withConfig`, or the second arg in `.bindTools`, like shown in the examples below:\n *\n * ```typescript\n * // When calling `.withConfig`, call options should be passed via the first argument\n * const llmWithArgsBound = llm.withConfig({\n *   stop: [\"\\n\"],\n *   tools: [...],\n * });\n *\n * // When calling `.bindTools`, call options should be passed via the second argument\n * const llmWithTools = llm.bindTools(\n *   [...],\n *   {\n *     stop: [\"\\n\"],\n *   }\n * );\n * ```\n *\n * ## Examples\n *\n * <details open>\n * <summary><strong>Instantiate</strong></summary>\n *\n * ```typescript\n * import { ChatFireworks } from '@langchain/community/chat_models/fireworks';\n *\n * const llm = new ChatFireworks({\n *   model: \"command-r-plus\",\n *   temperature: 0,\n *   // other params...\n * });\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Invoking</strong></summary>\n *\n * ```typescript\n * const input = `Translate \"I love programming\" into French.`;\n *\n * // Models also accept a list of chat messages or a formatted prompt\n * const result = await llm.invoke(input);\n * console.log(result);\n * ```\n *\n * ```txt\n * AIMessage {\n *   \"id\": \"dbc233df-532e-4aaa-8995-9d6ea65fea15\",\n *   \"content\": \"The translation of \\\"I love programming\\\" into French is:\\n\\n\\\"J'adore la programmation.\\\"\\n\\nHere's a breakdown of the translation:\\n\\n* \\\"I\\\" is translated to \\\"Je\\\" (but in informal writing, it's common to use \\\"J'\\\" instead of \\\"Je\\\" when it's followed by a vowel)\\n* \\\"love\\\" is translated to \\\"adore\\\"\\n* \\\"programming\\\" is translated to \\\"la programmation\\\"\\n\\nSo, the complete translation is \\\"J'adore la programmation.\\\"\",\n *   \"additional_kwargs\": {},\n *   \"response_metadata\": {\n *     \"tokenUsage\": {\n *       \"completionTokens\": 105,\n *       \"promptTokens\": 19,\n *       \"totalTokens\": 124\n *     },\n *     \"finish_reason\": \"stop\"\n *   },\n *   \"tool_calls\": [],\n *   \"invalid_tool_calls\": [],\n *   \"usage_metadata\": {\n *     \"input_tokens\": 19,\n *     \"output_tokens\": 105,\n *     \"total_tokens\": 124\n *   }\n * }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Streaming Chunks</strong></summary>\n *\n * ```typescript\n * for await (const chunk of await llm.stream(input)) {\n *   console.log(chunk);\n * }\n * ```\n *\n * ```txt\n * AIMessageChunk {\n *   \"id\": \"ed5fc403-b7ed-4447-819f-f9645ea0277c\",\n *   \"content\": \"\",\n *   \"additional_kwargs\": {},\n *   \"response_metadata\": {\n *     \"prompt\": 0,\n *     \"completion\": 0,\n *     \"finish_reason\": null\n *   },\n *   \"tool_calls\": [],\n *   \"tool_call_chunks\": [],\n *   \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n *   \"id\": \"ed5fc403-b7ed-4447-819f-f9645ea0277c\",\n *   \"content\": \"The translation\",\n *   \"additional_kwargs\": {},\n *   \"response_metadata\": {\n *     \"prompt\": 0,\n *     \"completion\": 0,\n *     \"finish_reason\": null\n *   },\n *   \"tool_calls\": [],\n *   \"tool_call_chunks\": [],\n *   \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n *   \"id\": \"ed5fc403-b7ed-4447-819f-f9645ea0277c\",\n *   \"content\": \" of \\\"\",\n *   \"additional_kwargs\": {},\n *   \"response_metadata\": {\n *     \"prompt\": 0,\n *     \"completion\": 0,\n *     \"finish_reason\": null\n *   },\n *   \"tool_calls\": [],\n *   \"tool_call_chunks\": [],\n *   \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n *   \"id\": \"ed5fc403-b7ed-4447-819f-f9645ea0277c\",\n *   \"content\": \"I love\",\n *   \"additional_kwargs\": {},\n *   \"response_metadata\": {\n *     \"prompt\": 0,\n *     \"completion\": 0,\n *     \"finish_reason\": null\n *   },\n *   \"tool_calls\": [],\n *   \"tool_call_chunks\": [],\n *   \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n *   \"id\": \"ed5fc403-b7ed-4447-819f-f9645ea0277c\",\n *   \"content\": \" programming\\\"\",\n *   \"additional_kwargs\": {},\n *   \"response_metadata\": {\n *     \"prompt\": 0,\n *     \"completion\": 0,\n *     \"finish_reason\": null\n *   },\n *   \"tool_calls\": [],\n *   \"tool_call_chunks\": [],\n *   \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n *   \"id\": \"ed5fc403-b7ed-4447-819f-f9645ea0277c\",\n *   \"content\": \" into French\",\n *   \"additional_kwargs\": {},\n *   \"response_metadata\": {\n *     \"prompt\": 0,\n *     \"completion\": 0,\n *     \"finish_reason\": null\n *   },\n *   \"tool_calls\": [],\n *   \"tool_call_chunks\": [],\n *   \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n *   \"id\": \"ed5fc403-b7ed-4447-819f-f9645ea0277c\",\n *   \"content\": \" is:\\n\\n\",\n *   \"additional_kwargs\": {},\n *   \"response_metadata\": {\n *     \"prompt\": 0,\n *     \"completion\": 0,\n *     \"finish_reason\": null\n *   },\n *   \"tool_calls\": [],\n *   \"tool_call_chunks\": [],\n *   \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n *   \"id\": \"ed5fc403-b7ed-4447-819f-f9645ea0277c\",\n *   \"content\": \"\\\"J\",\n *   \"additional_kwargs\": {},\n *   \"response_metadata\": {\n *     \"prompt\": 0,\n *     \"completion\": 0,\n *     \"finish_reason\": null\n *   },\n *   \"tool_calls\": [],\n *   \"tool_call_chunks\": [],\n *   \"invalid_tool_calls\": []\n * }\n * ...\n * AIMessageChunk {\n *   \"id\": \"ed5fc403-b7ed-4447-819f-f9645ea0277c\",\n *   \"content\": \"ation.\\\"\",\n *   \"additional_kwargs\": {},\n *   \"response_metadata\": {\n *     \"prompt\": 0,\n *     \"completion\": 0,\n *     \"finish_reason\": null\n *   },\n *   \"tool_calls\": [],\n *   \"tool_call_chunks\": [],\n *   \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n *   \"id\": \"ed5fc403-b7ed-4447-819f-f9645ea0277c\",\n *   \"content\": \"\",\n *   \"additional_kwargs\": {},\n *   \"response_metadata\": {\n *     \"prompt\": 0,\n *     \"completion\": 0,\n *     \"finish_reason\": \"stop\"\n *   },\n *   \"tool_calls\": [],\n *   \"tool_call_chunks\": [],\n *   \"invalid_tool_calls\": []\n * }\n * AIMessageChunk {\n *   \"content\": \"\",\n *   \"additional_kwargs\": {},\n *   \"response_metadata\": {},\n *   \"tool_calls\": [],\n *   \"tool_call_chunks\": [],\n *   \"invalid_tool_calls\": [],\n *   \"usage_metadata\": {\n *     \"input_tokens\": 19,\n *     \"output_tokens\": 105,\n *     \"total_tokens\": 124\n *   }\n * }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Aggregate Streamed Chunks</strong></summary>\n *\n * ```typescript\n * import { AIMessageChunk } from '@langchain/core/messages';\n * import { concat } from '@langchain/core/utils/stream';\n *\n * const stream = await llm.stream(input);\n * let full: AIMessageChunk | undefined;\n * for await (const chunk of stream) {\n *   full = !full ? chunk : concat(full, chunk);\n * }\n * console.log(full);\n * ```\n *\n * ```txt\n * AIMessageChunk {\n *   \"id\": \"9b80e5af-0f50-4fb7-b700-6d431a819556\",\n *   \"content\": \"The translation of \\\"I love programming\\\" into French is:\\n\\n\\\"J'adore la programmation.\\\"\\n\\nHere's a breakdown of the translation:\\n\\n* \\\"I\\\" is translated to \\\"Je\\\" (but in informal writing, it's common to use \\\"J'\\\" instead of \\\"Je\\\" when it's followed by a vowel)\\n* \\\"love\\\" is translated to \\\"adore\\\"\\n* \\\"programming\\\" is translated to \\\"la programmation\\\"\\n\\nSo, the complete translation is \\\"J'adore la programmation.\\\"\",\n *   \"additional_kwargs\": {},\n *   \"response_metadata\": {\n *     \"prompt\": 0,\n *     \"completion\": 0,\n *     \"finish_reason\": \"stop\"\n *   },\n *   \"tool_calls\": [],\n *   \"tool_call_chunks\": [],\n *   \"invalid_tool_calls\": [],\n *   \"usage_metadata\": {\n *     \"input_tokens\": 19,\n *     \"output_tokens\": 105,\n *     \"total_tokens\": 124\n *   }\n * }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Bind tools</strong></summary>\n *\n * ```typescript\n * import { z } from 'zod';\n *\n * const llmForToolCalling = new ChatFireworks({\n *   // Use a model with tool calling capability\n *   model: \"accounts/fireworks/models/firefunction-v2\",\n *   temperature: 0,\n *   // other params...\n * });\n * const GetWeather = {\n *   name: \"GetWeather\",\n *   description: \"Get the current weather in a given location\",\n *   schema: z.object({\n *     location: z.string().describe(\"The city and state, e.g. San Francisco, CA\")\n *   }),\n * }\n *\n * const GetPopulation = {\n *   name: \"GetPopulation\",\n *   description: \"Get the current population in a given location\",\n *   schema: z.object({\n *     location: z.string().describe(\"The city and state, e.g. San Francisco, CA\")\n *   }),\n * }\n *\n * const llmWithTools = llmForToolCalling.bindTools([GetWeather, GetPopulation]);\n * const aiMsg = await llmWithTools.invoke(\n *   \"Which city is hotter today and which is bigger: LA or NY?\"\n * );\n * console.log(aiMsg.tool_calls);\n * ```\n *\n * ```txt\n * [\n *   {\n *     name: 'GetWeather',\n *     args: { location: 'Los Angeles, CA' },\n *     type: 'tool_call',\n *     id: 'call_9DE0WnhgKDbxu6HyHOkDQFub'\n *   },\n *   {\n *     name: 'GetWeather',\n *     args: { location: 'New York, NY' },\n *     type: 'tool_call',\n *     id: 'call_58lcAPTqQyiqepxynwARhGs8'\n *   },\n *   {\n *     name: 'GetPopulation',\n *     args: { location: 'Los Angeles, CA' },\n *     type: 'tool_call',\n *     id: 'call_r0m6AFoqaMvPp4Zt5aEAc0oE'\n *   },\n *   {\n *     name: 'GetPopulation',\n *     args: { location: 'New York, NY' },\n *     type: 'tool_call',\n *     id: 'call_mENaPG1ryOF44BmaW4VkBaSi'\n *   }\n * ]\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Structured Output</strong></summary>\n *\n * ```typescript\n * import { z } from 'zod';\n *\n * const Joke = z.object({\n *   setup: z.string().describe(\"The setup of the joke\"),\n *   punchline: z.string().describe(\"The punchline to the joke\"),\n *   rating: z.number().optional().describe(\"How funny the joke is, from 1 to 10\")\n * }).describe('Joke to tell user.');\n *\n * const structuredLlm = llmForToolCalling.withStructuredOutput(Joke, { name: \"Joke\" });\n * const jokeResult = await structuredLlm.invoke(\"Tell me a joke about cats\");\n * console.log(jokeResult);\n * ```\n *\n * ```txt\n * {\n *   setup: 'Why did the cat join a band?',\n *   punchline: 'Because it wanted to be the purr-cussionist!',\n *   rating: 8\n * }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n *\n * <summary><strong>Usage Metadata</strong></summary>\n *\n * ```typescript\n * const aiMsgForMetadata = await llm.invoke(input);\n * console.log(aiMsgForMetadata.usage_metadata);\n * ```\n *\n * ```txt\n * { input_tokens: 277, output_tokens: 8, total_tokens: 285 }\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Response Metadata</strong></summary>\n *\n * ```typescript\n * const aiMsgForResponseMetadata = await llm.invoke(input);\n * console.log(aiMsgForResponseMetadata.response_metadata);\n * ```\n *\n * ```txt\n * {\n *   tokenUsage: { completionTokens: 8, promptTokens: 277, totalTokens: 285 },\n *   finish_reason: 'stop'\n * }\n * ```\n * </details>\n *\n * <br />\n */\nexport declare class ChatFireworks extends ChatOpenAICompletions<ChatFireworksCallOptions> {\n    static lc_name(): string;\n    _llmType(): string;\n    get lc_secrets(): {\n        [key: string]: string;\n    } | undefined;\n    lc_serializable: boolean;\n    fireworksApiKey?: string;\n    apiKey?: string;\n    constructor(fields?: Partial<Omit<OpenAIChatInput, \"openAIApiKey\" | FireworksUnsupportedArgs>> & BaseChatModelParams & {\n        /**\n         * Prefer `apiKey`\n         */\n        fireworksApiKey?: string;\n        /**\n         * The Fireworks API key to use.\n         */\n        apiKey?: string;\n    });\n    getLsParams(options: this[\"ParsedCallOptions\"]): LangSmithParams;\n    toJSON(): import(\"@langchain/core/load/serializable\").Serialized;\n    completionWithRetry(request: OpenAIClient.Chat.ChatCompletionCreateParamsStreaming, options?: OpenAICoreRequestOptions): Promise<AsyncIterable<OpenAIClient.Chat.Completions.ChatCompletionChunk>>;\n    completionWithRetry(request: OpenAIClient.Chat.ChatCompletionCreateParamsNonStreaming, options?: OpenAICoreRequestOptions): Promise<OpenAIClient.Chat.Completions.ChatCompletion>;\n}\nexport {};\n//# sourceMappingURL=fireworks.d.ts.map"],"mappings":";;;;;KAEKO,wBAAAA;KACAC,+BAAAA;KACOC,wBAAAA,GAA2BE,QAAQD,KAAKP,uBAAuBK;AAHmF;AACjI;AAE7B;;;;;AAA8C;AAwa9C;;;;;;;;;;;;;;;;;;;AAAgE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA3CI,aAAAA,SAAsBN,sBAAsBG;;;;;;;;;uBASxCE,QAAQD,KAAKN,kCAAkCG,6BAA6BP;;;;;;;;;;mDAUhDC;YAAeY,kCAAAA,CACVC;+BACzBZ,YAAAA,CAAaa,IAAAA,CAAKC,+CAA+CX,2BAA2Be,QAAQD,cAAcjB,YAAAA,CAAaa,IAAAA,CAAKE,WAAAA,CAAYC;+BAChJhB,YAAAA,CAAaa,IAAAA,CAAKM,kDAAkDhB,2BAA2Be,QAAQlB,YAAAA,CAAaa,IAAAA,CAAKE,WAAAA,CAAYK"}