FunctionDefinition Class

Definition

The definition of a caller-specified function that chat completions may invoke in response to matching user input.

public class FunctionDefinition : System.ClientModel.Primitives.IJsonModel<Azure.AI.Inference.FunctionDefinition>, System.ClientModel.Primitives.IPersistableModel<Azure.AI.Inference.FunctionDefinition>
type FunctionDefinition = class
    interface IJsonModel<FunctionDefinition>
    interface IPersistableModel<FunctionDefinition>
Public Class FunctionDefinition
Implements IJsonModel(Of FunctionDefinition), IPersistableModel(Of FunctionDefinition)
Inheritance
FunctionDefinition
Implements

Constructors

FunctionDefinition()

Initializes a new instance of FunctionDefinition.

FunctionDefinition(String)

Initializes a new instance of FunctionDefinition.

Fields

Auto

Specifies that the model may either use any of the tools provided in this chat completions request or instead return a standard chat completions response as if no tools were provided.

None

Specifies that the model should not respond with a tool call and should instead provide a standard chat completions response. Response content may still be influenced by the provided tool definitions.

Required

Specifies that the model should respond with a call to one or more tools.

Properties

Description

A description of what the function does. The model will use this description when selecting the function and interpreting its parameters.

Name

The name of the function to be called.

Parameters

The parameters the function accepts, described as a JSON Schema object.

To assign an object to this property use FromObjectAsJson<T>(T, JsonSerializerOptions).

To assign an already formatted json string to this property use FromString(String).

Examples:

  • BinaryData.FromObjectAsJson("foo"): Creates a payload of "foo".
  • BinaryData.FromString("\"foo\""): Creates a payload of "foo".
  • BinaryData.FromObjectAsJson(new { key = "value" }): Creates a payload of { "key": "value" }.
  • BinaryData.FromString("{\"key\": \"value\"}"): Creates a payload of { "key": "value" }.

Explicit Interface Implementations

IJsonModel<FunctionDefinition>.Create(Utf8JsonReader, ModelReaderWriterOptions)

Reads one JSON value (including objects or arrays) from the provided reader and converts it to a model.

IJsonModel<FunctionDefinition>.Write(Utf8JsonWriter, ModelReaderWriterOptions)

Writes the model to the provided Utf8JsonWriter.

IPersistableModel<FunctionDefinition>.Create(BinaryData, ModelReaderWriterOptions)

Converts the provided BinaryData into a model.

IPersistableModel<FunctionDefinition>.GetFormatFromOptions(ModelReaderWriterOptions)

Gets the data interchange format (JSON, Xml, etc) that the model uses when communicating with the service.

IPersistableModel<FunctionDefinition>.Write(ModelReaderWriterOptions)

Writes the model into a BinaryData.

Applies to