OpenAIWebClient

OpenAIWebClient class

A built-in IAIWebClient implementation that connects to the OpenAI API.

public class OpenAIWebClient : IAIWebClient, IDisposable

Constructors

NameDescription
OpenAIWebClient(string, string, string)Creates an instance of the OpenAI web client.
OpenAIWebClient(string, string, string, HttpClient)Creates an instance of the OpenAI web client that uses an externally managed HttpClient. The provided HttpClient is not disposed by this instance and remains owned by the caller.

Methods

NameDescription
CallChatAsync(string)Sends a chat instruction to the AI model using an externally managed HttpClient instance and returns response message to the given instruction.
CreateConversation()Creates a conversation instance. Unlike regular AI calls, conversations retain the entire context.
Dispose()Releases resources used by this instance.

See Also