Class OpenAIChatAgent
OpenAI client agent. This agent is a thin wrapper around OpenAI.
Open
- MessageEnvelope<T> where T is OpenAI.
Chat. : chat message.Chat Message
Open
- MessageEnvelope<T> where T is OpenAI.
Chat. : chat response message. MessageEnvelope<T> where T is OpenAI.Chat Completion Chat. : streaming chat completions update.Streaming Chat Completion Update
- Inheritance
-
Open
AIChat Agent
- Implements
- Inherited Members
- Extension Methods
Constructors
OpenAIChatAgent(ChatClient, string, ChatCompletionOptions, string?)
Create a new instance of Open
public OpenAIChatAgent(ChatClient chatClient, string name, ChatCompletionOptions options, string? systemMessage = "You are a helpful AI assistant")
Parameters
chatClient
ChatClient openai chat client
name
stringagent name
options
ChatCompletion Options chat completion option. The option can't contain messages
systemMessage
stringsystem message
OpenAIChatAgent(ChatClient, string, string?, float?, int?, int?, ChatResponseFormat?, IEnumerable<ChatTool>?)
Create a new instance of Open
public OpenAIChatAgent(ChatClient chatClient, string name, string? systemMessage = "You are a helpful AI assistant", float? temperature = null, int? maxTokens = null, int? seed = null, ChatResponseFormat? responseFormat = null, IEnumerable<ChatTool>? functions = null)
Parameters
chatClient
ChatClient openai client
name
stringagent name
systemMessage
stringsystem message
temperature
float?temperature
maxTokens
int?max tokens to generated
seed
int?seed to use, set it to enable deterministic output
responseFormat
ChatResponse Format response format, set it to OpenAI.
Chat. to enable json mode.Chat Response Format functions
IEnumerable<ChatTool >functions
Properties
Name
Property Value
Methods
GenerateReplyAsync(IEnumerable<IMessage>, GenerateReplyOptions?, CancellationToken)
Generate reply
public Task<IMessage> GenerateReplyAsync(IEnumerable<IMessage> messages, GenerateReplyOptions? options = null, CancellationToken cancellationToken = default)
Parameters
messages
IEnumerable<IMessage>conversation history
options
GenerateReply Options completion option. If provided, it should override existing option if there's any
cancellationToken
CancellationToken
Returns
GenerateStreamingReplyAsync(IEnumerable<IMessage>, GenerateReplyOptions?, CancellationToken)
public IAsyncEnumerable<IMessage> GenerateStreamingReplyAsync(IEnumerable<IMessage> messages, GenerateReplyOptions? options = null, CancellationToken cancellationToken = default)
Parameters
messages
IEnumerable<IMessage>options
GenerateReply Options cancellationToken
CancellationToken