Class OpenAIClient

OpenAIClient class

Provides methods to interact with the OpenAI API for managing vector store file batches.

Provides methods to interact with the OpenAI API for managing vector store files.

Provides methods to interact with the OpenAI API for managing vector stores.

Represents a client for interacting with the OpenAI API, extending basic AI client functionalities.

Provides methods to interact with the OpenAI API for managing run steps within threads.

Provides methods to interact with the OpenAI API for managing files.

Provides methods to interact with the OpenAI API for managing thread messages.

Provides methods to interact with the OpenAI API for managing threads.

Provides methods to interact with the OpenAI API for managing assistants.

Provides a method to interact with the OpenAI API for creating completions.

Provides methods to interact with the OpenAI API for managing runs within threads.

public class OpenAIClient : AIClientBase, IChatClient<OpenAIChatCopilotOptions>, 
    IImageDescriptionClient<OpenAIImageDescriptionCopilotOptions>, 
    IOcrClient<OpenAIOcrCopilotOptions>, IOpenAIClient, ISummaryClient<OpenAISummaryCopilotOptions>

Properties

NameDescription
BackoffDelaySeconds { get; set; }Gets or sets the backoff delay in seconds.
HttpRequestMaxRetries { get; set; }Gets or sets the maximum number of HTTP request retries.
PollingIntervalSeconds { get; set; }Gets or sets the polling interval in seconds.
PollingTimeoutSeconds { get; set; }Gets or sets the polling timeout in seconds.

Methods

NameDescription
CancelRunAsync(string, string, CancellationToken?)Cancels an existing run within a thread asynchronously.
CancelVectorStoreFileBatchAsync(string, string, CancellationToken?)Cancels a specific vector store file batch asynchronously.
CreateAssistantAsync(AssistantCreateRequest, CancellationToken?)Creates a new assistant asynchronously.
CreateCompletionAsync(CompletionCreateRequest, CancellationToken?)Creates a new completion asynchronously.
CreateRunAsync(string, RunCreateRequest, CancellationToken?)Creates a run within a specified thread asynchronously.
CreateThreadAndRunAsync(RunThreadCreateRequest, CancellationToken?)Creates a thread and a run within it asynchronously.
CreateThreadAsync(ThreadCreateRequest, CancellationToken?)Creates a new thread asynchronously.
CreateThreadMessageAsync(string, ThreadMessageCreateRequest, CancellationToken?)Creates a new message within a thread asynchronously.
CreateVectorStoreAndWaitToCompleteAsync(VectorStoreCreateRequest, CancellationToken?)Creates a new vector store and waits for it to complete asynchronously.
CreateVectorStoreAsync(VectorStoreCreateRequest, CancellationToken?)Creates a new vector store asynchronously.
CreateVectorStoreFileAsync(string, VectorStoreFileCreateRequest, CancellationToken?)Creates a new vector store file asynchronously.
CreateVectorStoreFileBatchAsync(string, VectorStoreFileBatchCreateRequest, CancellationToken?)Creates a new vector store file batch asynchronously.
DeleteAssistantAsync(string, CancellationToken?)Deletes an existing assistant asynchronously.
DeleteFileAsync(string, CancellationToken?)Deletes a specific file asynchronously.
DeleteThreadAsync(string, CancellationToken?)Deletes an existing thread asynchronously.
DeleteThreadMessageAsync(string, string, CancellationToken?)Deletes a message within a thread asynchronously.
DeleteVectorStoreAsync(string, CancellationToken?)Deletes a vector store asynchronously.
DeleteVectorStoreFileAsync(string, string, CancellationToken?)Deletes a file within a vector store asynchronously.
Dispose()Disposes of the resources used by the AIClientBase.
GetAssistantAsync(string, CancellationToken?)Retrieves details of a specific assistant asynchronously.
GetAssistantsAsync(AssistantListQueryParameters, CancellationToken?)Retrieves a list of assistants asynchronously.
GetChatCopilot(IChatCopilotOptions<OpenAIChatCopilotOptions>)Gets an instance of IChatCopilot with the specified options.
GetFileAsync(string, CancellationToken?)Retrieves details of a specific file asynchronously.
GetFilesAsync(string, CancellationToken?)Retrieves a list of files asynchronously based on the specified purpose.
GetImageDescriptionCopilot(IImageDescriptionCopilotOptions<OpenAIImageDescriptionCopilotOptions>)Gets an instance of IImageDescriptionCopilot with the specified options.
GetOcrCopilot(IOcrCopilotOptions<OpenAIOcrCopilotOptions>)Gets an instance of IOcrCopilot with the specified options.
GetRunAsync(string, string, CancellationToken?)Retrieves details of a specific run within a thread asynchronously.
GetRunsAsync(string, RunListQueryParameters, CancellationToken?)Retrieves a list of runs for a specified thread asynchronously.
GetRunStepAsync(string, string, string, CancellationToken?)Retrieves details of a specific step within a run asynchronously.
GetRunStepsAsync(string, string, RunStepListQueryParameters, CancellationToken?)Retrieves a list of steps for a specific run within a thread asynchronously.
GetSummaryCopilot(ISummaryCopilotOptions<OpenAISummaryCopilotOptions>)Gets an instance of ISummaryCopilot with the specified options.
GetThreadAsync(string, CancellationToken?)Retrieves details of a specific thread asynchronously.
GetThreadMessageAsync(string, string, CancellationToken?)Retrieves details of a specific message within a thread asynchronously.
GetThreadMessagesAsync(string, ThreadMessageListQueryParameters, CancellationToken?)Retrieves a list of messages for a specific thread asynchronously.
GetVectorStoreAsync(string, CancellationToken?)Retrieves details of a specific vector store asynchronously.
GetVectorStoreFileAsync(string, string, CancellationToken?)Retrieves details of a specific file within a vector store asynchronously.
GetVectorStoreFileBatchAsync(string, string, CancellationToken?)Retrieves details of a specific vector store file batch asynchronously.
GetVectorStoreFileBatchFilesAsync(string, string, VectorStoreFileBatchFileListQueryParameters, CancellationToken?)Retrieves a list of files within a specific vector store file batch asynchronously.
GetVectorStoreFilesAsync(string, VectorStoreFileListQueryParameters, CancellationToken?)Retrieves a list of files within a specific vector store asynchronously.
GetVectorStoresAsync(VectorStoreListQueryParameters, CancellationToken?)Retrieves a list of vector stores asynchronously.
ModifyAssistantAsync(string, AssistantModifyRequest, CancellationToken?)Modifies an existing assistant asynchronously.
ModifyRunAsync(string, string, RunModifyRequest, CancellationToken?)Modifies an existing run within a thread asynchronously.
ModifyThreadAsync(string, ThreadModifyRequest, CancellationToken?)Modifies an existing thread asynchronously.
ModifyThreadMessageAsync(string, string, ThreadMessageModifyRequest, CancellationToken?)Modifies an existing message within a thread asynchronously.
ModifyVectorStoreAsync(string, VectorStoreModifyRequest, CancellationToken?)Modifies an existing vector store asynchronously.
RunAndGetAssistantResponseAsync(string, RunCreateRequest, CancellationToken?)Runs the assistant with the specified threadId and runCreateRequest, and asynchronously gets the assistant response.
UploadFileAsync(string, string, byte[], CancellationToken?)Uploads a file asynchronously to the OpenAI server.
WaitForAssistantMessageAsync(string, ThreadMessageListQueryParameters, CancellationToken?)Waits for the first message from the assistant within a thread asynchronously.
WaitForRunToCompleteAsync(string, string, CancellationToken?)Waits for a run to complete within a thread asynchronously.
WaitForThreadMessageToCompleteAsync(string, string, CancellationToken?)Waits for a specific thread message to complete asynchronously.
WaitForVectorStoreFileToCompleteAsync(string, string, CancellationToken?)Waits for a specific vector store file to complete asynchronously.
WaitForVectorStoreToCompleteAsync(string, CancellationToken?)Waits for a specific vector store to complete asynchronously.
static CreateWithApiKey(string)Creates a new instance of Builder with the provided API key.

Other Members

NameDescription
class BuilderBuilder class for creating an instance of OpenAIClient.

See Also