Base interface implemented by all runnables. Used for cross-compatibility between different versions of LangChain core.

Should not change on patch releases.

interface StructuredToolInterface<T> {
    description: string;
    name: string;
    returnDirect: boolean;
    schema: T | ZodEffects<T, output<T>, input<T>>;
    batch(inputs, options?, batchOptions?): Promise<string[]>;
    batch(inputs, options?, batchOptions?): Promise<(string | Error)[]>;
    batch(inputs, options?, batchOptions?): Promise<(string | Error)[]>;
    call(arg, configArg?, tags?): Promise<string>;
    getName(suffix?): string;
    invoke(input, options?): Promise<string>;
    stream(input, options?): Promise<IterableReadableStreamInterface<string>>;
    transform(generator, options): AsyncGenerator<string, any, unknown>;
}

Type Parameters

  • T extends z.ZodObject<any, any, any, any> = z.ZodObject<any, any, any, any>

Hierarchy (view full)

Properties

description: string
name: string
returnDirect: boolean
schema: T | ZodEffects<T, output<T>, input<T>>

Methods

  • Calls the tool with the provided argument, configuration, and tags. It parses the input according to the schema, handles any errors, and manages callbacks.

    Parameters

    • arg: input<T> | (output<T> extends string
          ? string
          : never)

      The input argument for the tool.

    • Optional configArg: CallbackManager | (BaseCallbackHandlerMethodsClass | BaseCallbackHandler)[] | RunnableConfig

      Optional configuration or callbacks for the tool.

    • Optional tags: string[]

      Optional tags for the tool.

    Returns Promise<string>

    A Promise that resolves with a string.

Generated using TypeDoc