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 ZodAny = ZodAny

Hierarchy (view full)

Properties

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

Methods

  • 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.

    ⚠️ Deprecated ⚠️

    Use .invoke() instead. Will be removed in 0.3.0.

    This feature is deprecated and will be removed in the future.

    It is not recommended for use.

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

Generated using TypeDoc