UNPKG

langchain

Version:
68 lines • 2.56 kB
import { AIMessage } from "@langchain/core/messages"; import { ToolCall as ToolCall$1 } from "@langchain/core/messages/tool"; export declare class MultipleToolsBoundError extends Error { constructor(); } /** * Raised when model returns multiple structured output tool calls when only one is expected. */ export declare class MultipleStructuredOutputsError extends Error { readonly toolNames: string[]; constructor(toolNames: string[]); } /** * Raised when structured output tool call arguments fail to parse according to the schema. */ export declare class StructuredOutputParsingError extends Error { readonly toolName: string; readonly errors: string[]; /** * The model response that failed to parse, when available. */ readonly aiMessage?: AIMessage; constructor(toolName: string, errors: string[], aiMessage?: AIMessage); } /** * Raised when a tool call is throwing an error. */ export declare class ToolInvocationError extends Error { readonly "~brand" = "ToolInvocationError"; readonly toolCall: ToolCall$1; readonly toolError: Error; constructor(toolError: unknown, toolCall: ToolCall$1); /** * Check if the error is a ToolInvocationError. * @param error - The error to check * @returns Whether the error is a ToolInvocationError */ static isInstance(error: unknown): error is ToolInvocationError; static [Symbol.hasInstance](obj: unknown): obj is ToolInvocationError; } /** * Error thrown when a middleware fails. * * Use `MiddlewareError.wrap()` to create instances. The constructor is private * to ensure that GraphBubbleUp errors (like GraphInterrupt) are never wrapped. */ export declare class MiddlewareError extends Error { readonly "~brand" = "MiddlewareError"; private constructor(); /** * Wrap an error in a MiddlewareError, unless it's a GraphBubbleUp error * (like GraphInterrupt) or a {@link ModelRefusalError}, which propagate unchanged. * * @param error - The error to wrap * @param middlewareName - The name of the middleware that threw the error * @returns The original error if it's a GraphBubbleUp or a ModelRefusalError, * otherwise a new MiddlewareError */ static wrap(error: unknown, middlewareName: string): Error; /** * Check if the error is a MiddlewareError. * @param error - The error to check * @returns Whether the error is a MiddlewareError */ static isInstance(error: unknown): error is MiddlewareError; static [Symbol.hasInstance](obj: unknown): obj is MiddlewareError; } //# sourceMappingURL=errors.d.cts.map