ToolContexts
Namespace: Vercel.AI.GenerateText
public static class ToolContextsValidates tool context. Maps to validateToolContext.
Inheritance: object
Methods
Section titled “Methods”ValidateToolContext<T>(string, T, Func<T, bool>?)
Section titled “ValidateToolContext<T>(string, T, Func<T, bool>?)”public static T ValidateToolContext<T>(string toolName, T context, Func<T, bool>? contextSchema)Returns <code class=“paramref”>context</code> when <code class=“paramref”>contextSchema</code> is null. Otherwise returns it when the schema accepts it, and throws TypeValidationException when it does not.
Type parameters
| Name | Description |
|---|---|
T |
Parameters
| Name | Type | Description |
|---|---|---|
toolName |
string | |
context |
T |
|
contextSchema |
Func<T, bool> |
Returns: T
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product