Class OpenAIChatRequestMessageConnector
This middleware converts the incoming IMessage to IMessage<T> where T is Chat
Supported IMessage are
- IMessage<T> where T is Chat
- AggregateMessage<TMessage1, TMessage2> where TMessage1 is Tool
- Inheritance
-
Open
AIChat Request Message Connector
- Implements
- Inherited Members
Constructors
OpenAIChatRequestMessageConnector(bool)
Create a new instance of Open
Parameters
strictMode
boolIf true, Open
AIChat will throw an InvalidRequest Message Connector Operation When the message type is not supported. If false, it will ignore the unsupported message type.Exception
Properties
Name
the name of the middleware
Property Value
Methods
InvokeAsync(MiddlewareContext, IAgent, CancellationToken)
The method to invoke the middleware
public Task<IMessage> InvokeAsync(MiddlewareContext context, IAgent agent, CancellationToken cancellationToken = default)
Parameters
context
MiddlewareContext agent
IAgentcancellationToken
CancellationToken
Returns
InvokeAsync(MiddlewareContext, IStreamingAgent, CancellationToken)
The streaming version of Invoke
public IAsyncEnumerable<IMessage> InvokeAsync(MiddlewareContext context, IStreamingAgent agent, CancellationToken cancellationToken = default)
Parameters
context
MiddlewareContext agent
IStreamingAgent cancellationToken
CancellationToken
Returns
PostProcessMessage(IMessage)
Parameters
message
IMessage
Returns
PostProcessStreamingMessage(IMessage<StreamingChatCompletionsUpdate>, string?)
public IMessage? PostProcessStreamingMessage(IMessage<StreamingChatCompletionsUpdate> update, string? currentToolName)
Parameters
update
IMessage<StreamingChat >Completions Update currentToolName
string
Returns
ProcessIncomingMessages(IAgent, IEnumerable<IMessage>)
Parameters
agent
IAgentmessages
IEnumerable<IMessage>