Skip to content

ToolExecution

Namespace: Vercel.AI.ProviderUtils

public static class ToolExecution

Runs a tool delegate and reports preliminary and final outputs.

Inheritance: object

View source

public static IAsyncEnumerable<ToolExecution.ToolStep<T>> ExecuteAsync<T>(Func<Task<T>> execute)

Yields one final step from a single result.

Type parameters

Name Description
T

Parameters

Name Type Description
execute Func<Task<T>>

Returns: IAsyncEnumerable<ToolExecution.ToolStep<T>>

View source

ExecuteStreamAsync<T>(IAsyncEnumerable<T>)

Section titled “ExecuteStreamAsync<T>(IAsyncEnumerable<T>)”
public static IAsyncEnumerable<ToolExecution.ToolStep<T>> ExecuteStreamAsync<T>(IAsyncEnumerable<T> outputs)

Yields each streamed value as preliminary, then repeats the last value as final.

Type parameters

Name Description
T

Parameters

Name Type Description
outputs IAsyncEnumerable<T>

Returns: IAsyncEnumerable<ToolExecution.ToolStep<T>>

View source

public static bool IsExecutable(Delegate? execute)

True when <code class=“paramref”>execute</code> is present.

Parameters

Name Type Description
execute Delegate

Returns: bool

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product