AgentsClient.CreateAgentAsync 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.
Overloads
CreateAgentAsync(RequestContent, RequestContext) |
[Protocol Method] Creates a new agent.
|
CreateAgentAsync(String, String, String, String, IEnumerable<ToolDefinition>, ToolResources, Nullable<Single>, Nullable<Single>, BinaryData, IReadOnlyDictionary<String,String>, CancellationToken) |
Creates a new agent. |
CreateAgentAsync(RequestContent, RequestContext)
- Source:
- AgentsClient.cs
[Protocol Method] Creates a new agent.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler CreateAgentAsync(String, String, String, String, IEnumerable<ToolDefinition>, ToolResources, Nullable<Single>, Nullable<Single>, BinaryData, IReadOnlyDictionary<String,String>, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> CreateAgentAsync (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateAgentAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.CreateAgentAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function CreateAgentAsync (content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)
Parameters
- content
- RequestContent
The content to send as the body of the request.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
content
is null.
Service returned a non-success status code.
Applies to
CreateAgentAsync(String, String, String, String, IEnumerable<ToolDefinition>, ToolResources, Nullable<Single>, Nullable<Single>, BinaryData, IReadOnlyDictionary<String,String>, CancellationToken)
- Source:
- AgentsClient.cs
Creates a new agent.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.Projects.Agent>> CreateAgentAsync (string model, string name = default, string description = default, string instructions = default, System.Collections.Generic.IEnumerable<Azure.AI.Projects.ToolDefinition> tools = default, Azure.AI.Projects.ToolResources toolResources = default, float? temperature = default, float? topP = default, BinaryData responseFormat = default, System.Collections.Generic.IReadOnlyDictionary<string,string> metadata = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateAgentAsync : string * string * string * string * seq<Azure.AI.Projects.ToolDefinition> * Azure.AI.Projects.ToolResources * Nullable<single> * Nullable<single> * BinaryData * System.Collections.Generic.IReadOnlyDictionary<string, string> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Projects.Agent>>
override this.CreateAgentAsync : string * string * string * string * seq<Azure.AI.Projects.ToolDefinition> * Azure.AI.Projects.ToolResources * Nullable<single> * Nullable<single> * BinaryData * System.Collections.Generic.IReadOnlyDictionary<string, string> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Projects.Agent>>
Public Overridable Function CreateAgentAsync (model As String, Optional name As String = Nothing, Optional description As String = Nothing, Optional instructions As String = Nothing, Optional tools As IEnumerable(Of ToolDefinition) = Nothing, Optional toolResources As ToolResources = Nothing, Optional temperature As Nullable(Of Single) = Nothing, Optional topP As Nullable(Of Single) = Nothing, Optional responseFormat As BinaryData = Nothing, Optional metadata As IReadOnlyDictionary(Of String, String) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of Agent))
Parameters
- model
- String
The ID of the model to use.
- name
- String
The name of the new agent.
- description
- String
The description of the new agent.
- instructions
- String
The system instructions for the new agent to use.
- tools
- IEnumerable<ToolDefinition>
The collection of tools to enable for the new agent.
- toolResources
- 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.
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.
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.
- responseFormat
- BinaryData
The response format of the tool calls used by this agent.
- metadata
- IReadOnlyDictionary<String,String>
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.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
model
is null.
Applies to
Azure SDK for .NET