ToolExecution
Namespace: Vercel.AI.ProviderUtils
public static class ToolExecutionRuns a tool delegate and reports preliminary and final outputs.
Inheritance: object
Methods
Section titled “Methods”ExecuteAsync<T>(Func<Task<T>>)
Section titled “ExecuteAsync<T>(Func<Task<T>>)”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>>
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>>
IsExecutable(Delegate?)
Section titled “IsExecutable(Delegate?)”public static bool IsExecutable(Delegate? execute)True when <code class=“paramref”>execute</code> is present.
Parameters
| Name | Type | Description |
|---|---|---|
execute |
Delegate |
Returns: bool
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product