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

Should not change on patch releases.

interface ToolInterface {
    description: string;
    name: string;
    returnDirect: boolean;
    schema: ZodAny | ZodEffects<ZodAny, any, {}>;
    batch(inputs: (string | {})[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions & {
        returnExceptions?: false;
    }): Promise<string[]>;
    batch(inputs: (string | {})[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions & {
        returnExceptions: true;
    }): Promise<(string | Error)[]>;
    batch(inputs: (string | {})[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions): Promise<(string | Error)[]>;
    call(arg: undefined | string | {}, callbacks?: Callbacks | RunnableConfig): Promise<string>;
    getName(suffix?: string): string;
    invoke(input: string | {}, options?: Partial<RunnableConfig>): Promise<string>;
    stream(input: string | {}, options?: Partial<RunnableConfig>): Promise<IterableReadableStreamInterface<string>>;
    transform(generator: AsyncGenerator<string | {}, any, unknown>, options: Partial<RunnableConfig>): AsyncGenerator<string, any, unknown>;
}

Hierarchy (view full)

Properties

description: string
name: string
returnDirect: boolean
schema: ZodAny | ZodEffects<ZodAny, any, {}>

Methods

  • Parameters

    • arg: undefined | string | {}

      The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.

    • Optionalcallbacks: Callbacks | RunnableConfig

      Optional callbacks for the tool.

    Returns Promise<string>

    A Promise that resolves with a string.

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

    Calls the tool with the provided argument and callbacks. It handles string inputs specifically.