UNPKG

@langchain/core

Version:
1 lines 2.66 kB
{"version":3,"file":"function_calling.d.cts","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\";\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(tool: 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//# sourceMappingURL=function_calling.d.ts.map"],"mappings":";;;;;;;AAaA;;;;;AAM+B;AAU/B;;AAA4EW,iBAhBpDF,uBAAAA,CAgBoDE,IAAAA,EAhBtBX,uBAgBsBW,GAhBIP,gBAgBJO,GAhBuBV,oBAgBvBU,EAAAA,OAAAA,EAAAA;EAAsBP;;AAMvE;;;aAhBdF;;;;;;;;;;iBAUWQ,mBAAAA,OAA0BV,0BAA0BW,sBAAsBP;;;;;;aAMrFD"}