Jaa


AIFunctionDeclaration.JsonSchema Property

Definition

Gets a JSON Schema describing the function and its input parameters.

public:
 virtual property System::Text::Json::JsonElement JsonSchema { System::Text::Json::JsonElement get(); };
public virtual System.Text.Json.JsonElement JsonSchema { get; }
member this.JsonSchema : System.Text.Json.JsonElement
Public Overridable ReadOnly Property JsonSchema As JsonElement

Property Value

Remarks

When specified, declares a self-contained JSON schema document that describes the function and its input parameters. A simple example of a JSON schema for a function that adds two numbers together is shown below:

{
  "type": "object",
  "properties": {
    "a" : { "type": "number" },
    "b" : { "type": ["number","null"], "default": 1 }
  },
  "required" : ["a"]
}

The metadata present in the schema document plays an important role in guiding AI function invocation.

When an AIFunction is created via AIFunctionFactory, this schema is automatically derived from the method's parameters using the configured JsonSerializerOptions and AIJsonSchemaCreateOptions.

When no schema is specified, consuming chat clients should assume the "{}" or "true" schema, indicating that any JSON input is admissible.

Applies to