AIAgentWithOpenAIExtensions Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides extension methods for AIAgent to simplify interaction with OpenAI chat messages and return native OpenAI OpenAI.Chat.ChatCompletion responses.
public static class AIAgentWithOpenAIExtensions
type AIAgentWithOpenAIExtensions = class
Public Module AIAgentWithOpenAIExtensions
- Inheritance
-
AIAgentWithOpenAIExtensions
Remarks
These extensions bridge the gap between the Microsoft Extensions AI framework and the OpenAI SDK, allowing developers to work with native OpenAI types while leveraging the AI Agent framework. The methods handle the conversion between OpenAI chat message types and Microsoft Extensions AI types, and return OpenAI OpenAI.Chat.ChatCompletion objects directly from the agent's AgentResponse.
Methods
| Name | Description |
|---|---|
| RunAsync(AIAgent, IEnumerable<ChatMessage>, AgentSession, AgentRunOptions, CancellationToken) |
Runs the AI agent with a collection of OpenAI chat messages and returns the response as a native OpenAI OpenAI.Chat.ChatCompletion. |
| RunAsync(AIAgent, IEnumerable<ResponseItem>, AgentSession, AgentRunOptions, CancellationToken) |
Runs the AI agent with a collection of OpenAI response items and returns the response as a native OpenAI OpenAI.Responses.ResponseResult. |
| RunStreamingAsync(AIAgent, IEnumerable<ChatMessage>, AgentSession, AgentRunOptions, CancellationToken) |
Runs the AI agent with a single OpenAI chat message and returns the response as collection of native OpenAI OpenAI.Chat.StreamingChatCompletionUpdate. |
| RunStreamingAsync(AIAgent, IEnumerable<ResponseItem>, AgentSession, AgentRunOptions, CancellationToken) |
Runs the AI agent in streaming mode with a collection of OpenAI response items and returns the response as a collection of native OpenAI OpenAI.Responses.StreamingResponseUpdate. |