AgentsClient.CreateThread 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
CreateThread(IEnumerable<ThreadMessageOptions>, ToolResources, IReadOnlyDictionary<String,String>, CancellationToken) |
Creates a new thread. Threads contain messages and can be run by agents. |
CreateThread(RequestContent, RequestContext) |
[Protocol Method] Creates a new thread. Threads contain messages and can be run by agents.
|
CreateThread(IEnumerable<ThreadMessageOptions>, ToolResources, IReadOnlyDictionary<String,String>, CancellationToken)
- Source:
- AgentsClient.cs
Creates a new thread. Threads contain messages and can be run by agents.
public virtual Azure.Response<Azure.AI.Projects.AgentThread> CreateThread (System.Collections.Generic.IEnumerable<Azure.AI.Projects.ThreadMessageOptions> messages = default, Azure.AI.Projects.ToolResources toolResources = default, System.Collections.Generic.IReadOnlyDictionary<string,string> metadata = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateThread : seq<Azure.AI.Projects.ThreadMessageOptions> * Azure.AI.Projects.ToolResources * System.Collections.Generic.IReadOnlyDictionary<string, string> * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Projects.AgentThread>
override this.CreateThread : seq<Azure.AI.Projects.ThreadMessageOptions> * Azure.AI.Projects.ToolResources * System.Collections.Generic.IReadOnlyDictionary<string, string> * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Projects.AgentThread>
Public Overridable Function CreateThread (Optional messages As IEnumerable(Of ThreadMessageOptions) = Nothing, Optional toolResources As ToolResources = Nothing, Optional metadata As IReadOnlyDictionary(Of String, String) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response(Of AgentThread)
Parameters
- messages
- IEnumerable<ThreadMessageOptions>
The initial messages to associate with the new thread.
- toolResources
- ToolResources
A set of resources that are made available to the agent's tools in this thread. 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.
- 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
Applies to
CreateThread(RequestContent, RequestContext)
- Source:
- AgentsClient.cs
[Protocol Method] Creates a new thread. Threads contain messages and can be run by agents.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler CreateThread(IEnumerable<ThreadMessageOptions>, ToolResources, IReadOnlyDictionary<String,String>, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response CreateThread (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateThread : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.CreateThread : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function CreateThread (content As RequestContent, Optional context As RequestContext = Nothing) As 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
Azure SDK for .NET