AIFunctionFactory.CreateDeclaration Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates an AIFunctionDeclaration using the specified parameters as the implementation of its corresponding properties.
public static Microsoft.Extensions.AI.AIFunctionDeclaration CreateDeclaration(string name, string? description, System.Text.Json.JsonElement jsonSchema, System.Text.Json.JsonElement? returnJsonSchema = default);
static member CreateDeclaration : string * string * System.Text.Json.JsonElement * Nullable<System.Text.Json.JsonElement> -> Microsoft.Extensions.AI.AIFunctionDeclaration
Public Shared Function CreateDeclaration (name As String, description As String, jsonSchema As JsonElement, Optional returnJsonSchema As Nullable(Of JsonElement) = Nothing) As AIFunctionDeclaration
Parameters
- name
- String
The name of the function.
- description
- String
A description of the function, suitable for use in describing the purpose to a model.
- jsonSchema
- JsonElement
A JSON schema describing the function and its input parameters.
- returnJsonSchema
- Nullable<JsonElement>
A JSON schema describing the function's return value.
Returns
The created AIFunctionDeclaration that describes a function.
Exceptions
name is null.
Remarks
CreateDeclaration(String, String, JsonElement, Nullable<JsonElement>) creates an AIFunctionDeclaration that can be used to describe a function but not invoke it. To create an invocable AIFunction, use Create. A non-invocable AIFunctionDeclaration can also be created from an invocable AIFunction using that function's AsDeclarationOnly() method.