次の方法で共有


Agent Class

Definition

Represents an agent that can call the model and use tools.

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

Properties

CreatedAt

The Unix timestamp, in seconds, representing when this object was created.

Description

The description of the agent.

Id

The identifier, which can be referenced in API endpoints.

Instructions

The system instructions for the agent to use.

Metadata

A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.

Model

The ID of the model to use.

Name

The name of the agent.

ResponseFormat

The response format of the tool calls used by this agent.

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" }.

Temperature

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

ToolResources

A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs.

Tools

The collection of tools enabled for the agent. Please note ToolDefinition is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. The available derived classes include AzureAISearchToolDefinition, BingGroundingToolDefinition, CodeInterpreterToolDefinition, FileSearchToolDefinition, FunctionToolDefinition, MicrosoftFabricToolDefinition and SharepointToolDefinition.

TopP

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

Methods

JsonModelWriteCore(Utf8JsonWriter, ModelReaderWriterOptions)

Explicit Interface Implementations

IJsonModel<Agent>.Create(Utf8JsonReader, ModelReaderWriterOptions)

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

IJsonModel<Agent>.Write(Utf8JsonWriter, ModelReaderWriterOptions)

Writes the model to the provided Utf8JsonWriter.

IPersistableModel<Agent>.Create(BinaryData, ModelReaderWriterOptions)

Converts the provided BinaryData into a model.

IPersistableModel<Agent>.GetFormatFromOptions(ModelReaderWriterOptions)

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

IPersistableModel<Agent>.Write(ModelReaderWriterOptions)

Writes the model into a BinaryData.

Applies to