Interface StructuredToolInterface<T, RunOutput>

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

Type Parameters

  • T extends ZodAny = ZodAny

  • RunOutput extends string | Record<string, any> = string

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<RunOutput>

    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