Class ThreadUtility
- Namespace
- AntRunnerLib
- Assembly
- AntRunnerLib.dll
Utility class for managing threads and runs within the assistant orchestrator.
public class ThreadUtility
- Inheritance
-
System.ObjectThreadUtility
- Inherited Members
-
System.Object.Equals(System.Object)System.Object.Equals(System.Object, System.Object)System.Object.GetHashCode()System.Object.GetType()System.Object.MemberwiseClone()System.Object.ReferenceEquals(System.Object, System.Object)System.Object.ToString()
Methods
CreateThreadAndRun(String, String, AzureOpenAIConfig)
Creates a thread and runs with the specified assistant ID and message.
public static async Task<ThreadRun> CreateThreadAndRun(string assistantId, string message, AzureOpenAIConfig azureOpenAIConfig)
Parameters
assistantIdSystem.StringThe assistant ID.
messageSystem.StringThe message content.
azureOpenAIConfigAzureOpenAIConfigThe Azure OpenAI configuration.
Returns
- Task<ThreadRun>
A task representing the asynchronous operation, with a result of the created thread run.
DeleteThread(String, AzureOpenAIConfig)
Deletes the specified thread.
public static async Task DeleteThread(string threadId, AzureOpenAIConfig azureOpenAIConfig)
Parameters
threadIdSystem.StringThe thread ID.
azureOpenAIConfigAzureOpenAIConfigThe Azure OpenAI configuration.
Returns
- Task
A task representing the asynchronous operation.
GetRun(String, String, AzureOpenAIConfig)
Retrieves the specified run of a thread.
public static async Task<RunResponse> GetRun(string threadId, string threadRunId, AzureOpenAIConfig azureOpenAIConfig)
Parameters
threadIdSystem.StringThe thread ID.
threadRunIdSystem.StringThe thread run ID.
azureOpenAIConfigAzureOpenAIConfigThe Azure OpenAI configuration.
Returns
- Task<RunResponse>
A task representing the asynchronous operation, with a result of the run response.
GetThreadOutput(String, AzureOpenAIConfig)
Retrieves the final output of the thread by aggregating runs and messages.
public static async Task<ThreadRunOutput> GetThreadOutput(string threadId, AzureOpenAIConfig azureOpenAIConfig)
Parameters
threadIdSystem.StringThe thread ID.
azureOpenAIConfigAzureOpenAIConfigThe Azure OpenAI configuration.
Returns
- Task<ThreadRunOutput>
A task representing the asynchronous operation, with a result of the thread run output.
PerformRunRequiredActions(String, RunResponse, AzureOpenAIConfig, String)
Performs the required actions for the given run.
public static async Task PerformRunRequiredActions(string assistantName, RunResponse currentRun, AzureOpenAIConfig azureOpenAIConfig, string oAuthUserAccessToken = null)
Parameters
assistantNameSystem.StringThe assistant name.
currentRunRunResponseThe current run response.
azureOpenAIConfigAzureOpenAIConfigThe Azure OpenAI configuration.
oAuthUserAccessTokenSystem.StringOptional: The OAuth user access token.
Returns
- Task
UpdateThreadAndRun(String, String, String, AzureOpenAIConfig)
Updates a thread and runs it with the specified assistant ID and message.
public static async Task<ThreadRun> UpdateThreadAndRun(string threadId, string assistantId, string message, AzureOpenAIConfig azureOpenAIConfig)
Parameters
threadIdSystem.StringThe thread ID.
assistantIdSystem.StringThe assistant ID.
messageSystem.StringThe message content.
azureOpenAIConfigAzureOpenAIConfigThe Azure OpenAI configuration.
Returns
- Task<ThreadRun>
A task representing the asynchronous operation, with a result of the updated thread run.