UNPKG

@langchain/core

Version:
1 lines 1.5 kB
{"version":3,"file":"utils.cjs","names":[],"sources":["../../src/tools/utils.ts"],"sourcesContent":["import { ToolCall } from \"../messages/tool.js\";\n\nexport function _isToolCall(toolCall?: unknown): toolCall is ToolCall {\n return !!(\n toolCall &&\n typeof toolCall === \"object\" &&\n \"type\" in toolCall &&\n toolCall.type === \"tool_call\"\n );\n}\n\nexport function _configHasToolCallId(\n config?: unknown\n): config is { toolCall: { id?: string } } {\n return !!(\n config &&\n typeof config === \"object\" &&\n \"toolCall\" in config &&\n config.toolCall != null &&\n typeof config.toolCall === \"object\" &&\n \"id\" in config.toolCall &&\n typeof config.toolCall.id === \"string\"\n );\n}\n/**\n * Custom error class used to handle exceptions related to tool input parsing.\n * It extends the built-in `Error` class and adds an optional `output`\n * property that can hold the output that caused the exception.\n */\nexport class ToolInputParsingException extends Error {\n output?: string;\n\n constructor(message: string, output?: string) {\n super(message);\n this.output = output;\n }\n}\n"],"mappings":";;AAEA,SAAgB,YAAY,UAA0C;AACpE,QAAO,CAAC,EACN,YACA,OAAO,aAAa,YACpB,UAAU,YACV,SAAS,SAAS;;AAItB,SAAgB,qBACd,QACyC;AACzC,QAAO,CAAC,EACN,UACA,OAAO,WAAW,YAClB,cAAc,UACd,OAAO,YAAY,QACnB,OAAO,OAAO,aAAa,YAC3B,QAAQ,OAAO,YACf,OAAO,OAAO,SAAS,OAAO;;;;;;;AAQlC,IAAa,4BAAb,cAA+C,MAAM;CACnD;CAEA,YAAY,SAAiB,QAAiB;AAC5C,QAAM,QAAQ;AACd,OAAK,SAAS"}