Table of Contents

Class ThreadUtility

Namespace
AntRunnerLib
Assembly
AntRunnerLib.dll

Utility class for managing threads and runs within the assistant orchestrator.

public class ThreadUtility
Inheritance
System.Object
ThreadUtility
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

assistantId System.String

The assistant ID.

message System.String

The message content.

azureOpenAIConfig AzureOpenAIConfig

The 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

threadId System.String

The thread ID.

azureOpenAIConfig AzureOpenAIConfig

The 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

threadId System.String

The thread ID.

threadRunId System.String

The thread run ID.

azureOpenAIConfig AzureOpenAIConfig

The 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

threadId System.String

The thread ID.

azureOpenAIConfig AzureOpenAIConfig

The 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

assistantName System.String

The assistant name.

currentRun RunResponse

The current run response.

azureOpenAIConfig AzureOpenAIConfig

The Azure OpenAI configuration.

oAuthUserAccessToken System.String

Optional: 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

threadId System.String

The thread ID.

assistantId System.String

The assistant ID.

message System.String

The message content.

azureOpenAIConfig AzureOpenAIConfig

The Azure OpenAI configuration.

Returns

Task<ThreadRun>

A task representing the asynchronous operation, with a result of the updated thread run.