@langchain/core
Version:
Core LangChain.js abstractions and schemas
1 lines • 2.81 kB
Source Map (JSON)
{"version":3,"file":"function_calling.d.ts","names":["StructuredToolInterface","StructuredToolParams","FunctionDefinition","ToolDefinition","RunnableToolLike","isStructuredTool","isStructuredToolParams","isRunnableToolLike","isLangChainTool","convertToOpenAIFunction","convertToOpenAITool","Record"],"sources":["../../src/utils/function_calling.d.ts"],"sourcesContent":["import { StructuredToolInterface, StructuredToolParams } from \"../tools/types.js\";\nimport { FunctionDefinition, ToolDefinition } from \"../language_models/base.js\";\nimport { RunnableToolLike } from \"../runnables/base.js\";\n// These utility functions were moved to a more appropriate location,\n// but we still export them here for backwards compatibility.\nexport { isStructuredTool, isStructuredToolParams, isRunnableToolLike, isLangChainTool, } from \"../tools/types.js\";\n/**\n * Formats a `StructuredTool` or `RunnableToolLike` instance into a format\n * that is compatible with OpenAI function calling. If `StructuredTool` or\n * `RunnableToolLike` has a zod schema, the output will be converted into a\n * JSON schema, which is then used as the parameters for the OpenAI tool.\n *\n * @param {StructuredToolInterface | RunnableToolLike} tool The tool to convert to an OpenAI function.\n * @returns {FunctionDefinition} The inputted tool in OpenAI function format.\n */\nexport declare function convertToOpenAIFunction(tool: StructuredToolInterface | RunnableToolLike | StructuredToolParams, fields?: {\n /**\n * If `true`, model output is guaranteed to exactly match the JSON Schema\n * provided in the function definition.\n */\n strict?: boolean;\n} | number): FunctionDefinition;\n/**\n * Formats a `StructuredTool` or `RunnableToolLike` instance into a\n * format that is compatible with OpenAI tool calling. If `StructuredTool` or\n * `RunnableToolLike` has a zod schema, the output will be converted into a\n * JSON schema, which is then used as the parameters for the OpenAI tool.\n *\n * @param {StructuredToolInterface | Record<string, any> | RunnableToolLike} tool The tool to convert to an OpenAI tool.\n * @returns {ToolDefinition} The inputted tool in OpenAI tool format.\n */\nexport declare function convertToOpenAITool(\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntool: StructuredToolInterface | Record<string, any> | RunnableToolLike, fields?: {\n /**\n * If `true`, model output is guaranteed to exactly match the JSON Schema\n * provided in the function definition.\n */\n strict?: boolean;\n} | number): ToolDefinition;\n"],"mappings":";;;;;;;;;;;AAqB+B;AAU/B;;;AAEgCW,iBAlBRF,uBAAAA,CAkBQE,IAAAA,EAlBsBX,uBAkBtBW,GAlBgDP,gBAkBhDO,GAlBmEV,oBAkBnEU,EAAAA,OAAAA,EAAAA;EAAM;;AAMX;;;aAlBdT;;;;;;;;;;iBAUWQ,mBAAAA;;MAElBV,0BAA0BW,sBAAsBP;;;;;;aAMzCD"}