diff --git a/dotnet/Directory.Packages.props b/dotnet/Directory.Packages.props
index 1b1e0daa08..f438ad9f0c 100644
--- a/dotnet/Directory.Packages.props
+++ b/dotnet/Directory.Packages.props
@@ -35,7 +35,7 @@
-
+
@@ -109,7 +109,7 @@
-
+
diff --git a/dotnet/samples/02-agents/AgentProviders/Agent_With_OpenAIResponses/Program.cs b/dotnet/samples/02-agents/AgentProviders/Agent_With_OpenAIResponses/Program.cs
index 611f3f9a9a..0f87691d9e 100644
--- a/dotnet/samples/02-agents/AgentProviders/Agent_With_OpenAIResponses/Program.cs
+++ b/dotnet/samples/02-agents/AgentProviders/Agent_With_OpenAIResponses/Program.cs
@@ -3,6 +3,7 @@
// This sample shows how to create and use a simple AI agent with OpenAI Responses as the backend.
using Microsoft.Agents.AI;
+using Microsoft.Extensions.AI;
using OpenAI;
using OpenAI.Responses;
@@ -11,8 +12,17 @@
AIAgent agent = new OpenAIClient(
apiKey)
- .GetResponsesClient(model)
- .AsAIAgent(instructions: "You are good at telling jokes.", name: "Joker");
+ .GetResponsesClient()
+ .AsAIAgent(
+ new ChatClientAgentOptions()
+ {
+ Name = "Joker",
+ ChatOptions = new ChatOptions()
+ {
+ ModelId = model,
+ Instructions = "You are good at telling jokes."
+ }
+ });
// Invoke the agent and output the text result.
Console.WriteLine(await agent.RunAsync("Tell me a joke about a pirate."));
diff --git a/dotnet/samples/02-agents/AgentWithOpenAI/Agent_OpenAI_Step02_Reasoning/Program.cs b/dotnet/samples/02-agents/AgentWithOpenAI/Agent_OpenAI_Step02_Reasoning/Program.cs
index d13d0d5346..8f8da6b9ce 100644
--- a/dotnet/samples/02-agents/AgentWithOpenAI/Agent_OpenAI_Step02_Reasoning/Program.cs
+++ b/dotnet/samples/02-agents/AgentWithOpenAI/Agent_OpenAI_Step02_Reasoning/Program.cs
@@ -10,10 +10,11 @@
var model = Environment.GetEnvironmentVariable("OPENAI_CHAT_MODEL_NAME") ?? "gpt-5";
var client = new OpenAIClient(apiKey)
- .GetResponsesClient(model)
+ .GetResponsesClient()
.AsIChatClient().AsBuilder()
.ConfigureOptions(o =>
{
+ o.ModelId = model;
o.Reasoning = new()
{
Effort = ReasoningEffort.Medium,
diff --git a/dotnet/samples/02-agents/AgentWithOpenAI/Agent_OpenAI_Step04_CreateFromOpenAIResponseClient/Program.cs b/dotnet/samples/02-agents/AgentWithOpenAI/Agent_OpenAI_Step04_CreateFromOpenAIResponseClient/Program.cs
index 8004770c21..3033ebbf56 100644
--- a/dotnet/samples/02-agents/AgentWithOpenAI/Agent_OpenAI_Step04_CreateFromOpenAIResponseClient/Program.cs
+++ b/dotnet/samples/02-agents/AgentWithOpenAI/Agent_OpenAI_Step04_CreateFromOpenAIResponseClient/Program.cs
@@ -2,6 +2,8 @@
// This sample demonstrates how to create OpenAIResponseClientAgent directly from an ResponsesClient instance.
+using Microsoft.Agents.AI;
+using Microsoft.Extensions.AI;
using OpenAI;
using OpenAI.Responses;
using OpenAIResponseClientSample;
@@ -10,10 +12,18 @@
var model = Environment.GetEnvironmentVariable("OPENAI_CHAT_MODEL_NAME") ?? "gpt-4o-mini";
// Create a ResponsesClient directly from OpenAIClient
-ResponsesClient responseClient = new OpenAIClient(apiKey).GetResponsesClient(model);
+ResponsesClient responseClient = new OpenAIClient(apiKey).GetResponsesClient();
// Create an agent directly from the ResponsesClient using OpenAIResponseClientAgent
-OpenAIResponseClientAgent agent = new(responseClient, instructions: "You are good at telling jokes.", name: "Joker");
+OpenAIResponseClientAgent agent = new(responseClient, new ChatClientAgentOptions()
+{
+ Name = "Joker",
+ ChatOptions = new ChatOptions()
+ {
+ ModelId = model,
+ Instructions = "You are good at telling jokes."
+ }
+});
ResponseItem userMessage = ResponseItem.CreateUserMessageItem("Tell me a joke about a pirate.");
diff --git a/dotnet/samples/02-agents/AgentWithOpenAI/Agent_OpenAI_Step05_Conversation/Program.cs b/dotnet/samples/02-agents/AgentWithOpenAI/Agent_OpenAI_Step05_Conversation/Program.cs
index 921acbad0d..8458a9fefd 100644
--- a/dotnet/samples/02-agents/AgentWithOpenAI/Agent_OpenAI_Step05_Conversation/Program.cs
+++ b/dotnet/samples/02-agents/AgentWithOpenAI/Agent_OpenAI_Step05_Conversation/Program.cs
@@ -22,7 +22,16 @@
ConversationClient conversationClient = openAIClient.GetConversationClient();
// Create an agent directly from the ResponsesClient using OpenAIResponseClientAgent
-ChatClientAgent agent = new(openAIClient.GetResponsesClient(model).AsIChatClient(), instructions: "You are a helpful assistant.", name: "ConversationAgent");
+ChatClientAgent agent = new(openAIClient.GetResponsesClient().AsIChatClient(),
+ new ChatClientAgentOptions()
+ {
+ Name = "ConversationAgent",
+ ChatOptions = new ChatOptions()
+ {
+ ModelId = model,
+ Instructions = "You are a helpful assistant."
+ }
+ });
ClientResult createConversationResult = await conversationClient.CreateConversationAsync(BinaryContent.Create(BinaryData.FromString("{}")));
diff --git a/dotnet/samples/05-end-to-end/AgentWebChat/AgentWebChat.Web/OpenAIResponsesAgentClient.cs b/dotnet/samples/05-end-to-end/AgentWebChat/AgentWebChat.Web/OpenAIResponsesAgentClient.cs
index 0d2470762e..cd72dbcd05 100644
--- a/dotnet/samples/05-end-to-end/AgentWebChat/AgentWebChat.Web/OpenAIResponsesAgentClient.cs
+++ b/dotnet/samples/05-end-to-end/AgentWebChat/AgentWebChat.Web/OpenAIResponsesAgentClient.cs
@@ -27,9 +27,10 @@ public override async IAsyncEnumerable RunStreamingAsync(
Transport = new HttpClientPipelineTransport(httpClient)
};
- var openAiClient = new ResponsesClient(model: agentName, credential: new ApiKeyCredential("dummy-key"), options: options).AsIChatClient();
+ var openAiClient = new ResponsesClient(credential: new ApiKeyCredential("dummy-key"), options: options).AsIChatClient();
var chatOptions = new ChatOptions()
{
+ ModelId = agentName,
ConversationId = sessionId
};
diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIResponsesIntegrationTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIResponsesIntegrationTests.cs
index 0b9441d633..4c3896ec1d 100644
--- a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIResponsesIntegrationTests.cs
+++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIResponsesIntegrationTests.cs
@@ -52,7 +52,7 @@ public async Task CreateResponseStreaming_WithSimpleMessage_ReturnsStreamingUpda
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Count to 3");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Count to 3");
// Assert
List updates = [];
@@ -93,7 +93,7 @@ public async Task CreateResponse_WithSimpleMessage_ReturnsCompleteResponseAsync(
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- ResponseResult response = await responseClient.CreateResponseAsync("Hello");
+ ResponseResult response = await responseClient.CreateResponseAsync("test-model", "Hello");
// Assert
Assert.NotNull(response);
@@ -120,7 +120,7 @@ public async Task CreateResponseStreaming_WithMultipleChunks_StreamsAllContentAs
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
// Assert
List updates = [];
@@ -166,8 +166,8 @@ public async Task CreateResponse_WithMultipleAgents_EachAgentRespondsCorrectlyAs
ResponsesClient responseClient2 = this.CreateResponseClient(Agent2Name);
// Act
- ResponseResult response1 = await responseClient1.CreateResponseAsync("Hello");
- ResponseResult response2 = await responseClient2.CreateResponseAsync("Hello");
+ ResponseResult response1 = await responseClient1.CreateResponseAsync("test-model", "Hello");
+ ResponseResult response2 = await responseClient2.CreateResponseAsync("test-model", "Hello");
// Assert
string content1 = response1.GetOutputText();
@@ -193,10 +193,10 @@ public async Task CreateResponse_SameAgentStreamingAndNonStreaming_BothWorkCorre
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act - Non-streaming
- ResponseResult nonStreamingResponse = await responseClient.CreateResponseAsync("Test");
+ ResponseResult nonStreamingResponse = await responseClient.CreateResponseAsync("test-model", "Test");
// Act - Streaming
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
StringBuilder streamingContent = new();
await foreach (StreamingResponseUpdate update in streamingResult)
{
@@ -227,7 +227,7 @@ public async Task CreateResponse_CompletedResponse_HasCorrectStatusAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- ResponseResult response = await responseClient.CreateResponseAsync("Test");
+ ResponseResult response = await responseClient.CreateResponseAsync("test-model", "Test");
// Assert
Assert.Equal(ResponseStatus.Completed, response.Status);
@@ -250,7 +250,7 @@ public async Task CreateResponseStreaming_VerifyEventSequence_ContainsExpectedEv
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
// Assert
List updates = [];
@@ -289,7 +289,7 @@ public async Task CreateResponseStreaming_EmptyResponse_HandlesGracefullyAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
// Assert
List updates = [];
@@ -319,7 +319,7 @@ public async Task CreateResponse_IncludesMetadata_HasRequiredFieldsAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- ResponseResult response = await responseClient.CreateResponseAsync("Test");
+ ResponseResult response = await responseClient.CreateResponseAsync("test-model", "Test");
// Assert
Assert.NotNull(response.Id);
@@ -343,7 +343,7 @@ public async Task CreateResponseStreaming_LongText_StreamsAllContentAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Generate long text");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Generate long text");
// Assert
StringBuilder contentBuilder = new();
@@ -374,7 +374,7 @@ public async Task CreateResponseStreaming_OutputIndices_AreConsistentAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
// Assert
List outputIndices = [];
@@ -410,7 +410,7 @@ public async Task CreateResponseStreaming_SingleWord_StreamsCorrectlyAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
// Assert
StringBuilder contentBuilder = new();
@@ -440,7 +440,7 @@ public async Task CreateResponseStreaming_SpecialCharacters_PreservesFormattingA
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
// Assert
StringBuilder contentBuilder = new();
@@ -470,7 +470,7 @@ public async Task CreateResponse_SpecialCharacters_PreservesContentAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- ResponseResult response = await responseClient.CreateResponseAsync("Test");
+ ResponseResult response = await responseClient.CreateResponseAsync("test-model", "Test");
// Assert
string content = response.GetOutputText();
@@ -492,7 +492,7 @@ public async Task CreateResponseStreaming_ItemIds_AreConsistentAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
// Assert
List itemIds = [];
@@ -530,7 +530,7 @@ public async Task CreateResponse_MultipleSequentialRequests_AllSucceedAsync()
// Act & Assert - Make 5 sequential requests
for (int i = 0; i < 5; i++)
{
- ResponseResult response = await responseClient.CreateResponseAsync($"Request {i}");
+ ResponseResult response = await responseClient.CreateResponseAsync("test-model", $"Request {i}");
Assert.NotNull(response);
Assert.Equal(ResponseStatus.Completed, response.Status);
Assert.Equal(ExpectedResponse, response.GetOutputText());
@@ -554,7 +554,7 @@ public async Task CreateResponseStreaming_MultipleSequentialRequests_AllStreamCo
// Act & Assert - Make 3 sequential streaming requests
for (int i = 0; i < 3; i++)
{
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync($"Request {i}");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", $"Request {i}");
StringBuilder contentBuilder = new();
await foreach (StreamingResponseUpdate update in streamingResult)
@@ -587,7 +587,7 @@ public async Task CreateResponse_MultipleRequests_GenerateUniqueIdsAsync()
List responseIds = [];
for (int i = 0; i < 10; i++)
{
- ResponseResult response = await responseClient.CreateResponseAsync($"Request {i}");
+ ResponseResult response = await responseClient.CreateResponseAsync("test-model", $"Request {i}");
responseIds.Add(response.Id);
}
@@ -611,7 +611,7 @@ public async Task CreateResponseStreaming_SequenceNumbers_AreMonotonicallyIncrea
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
// Assert
List sequenceNumbers = [];
@@ -644,7 +644,7 @@ public async Task CreateResponse_ModelInformation_IsCorrectAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- ResponseResult response = await responseClient.CreateResponseAsync("Test");
+ ResponseResult response = await responseClient.CreateResponseAsync("test-model", "Test");
// Assert
Assert.NotNull(response.Model);
@@ -666,7 +666,7 @@ public async Task CreateResponseStreaming_Punctuation_PreservesContentAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
// Assert
StringBuilder contentBuilder = new();
@@ -696,7 +696,7 @@ public async Task CreateResponse_ShortInput_ReturnsValidResponseAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- ResponseResult response = await responseClient.CreateResponseAsync("Hi");
+ ResponseResult response = await responseClient.CreateResponseAsync("test-model", "Hi");
// Assert
Assert.NotNull(response);
@@ -719,7 +719,7 @@ public async Task CreateResponseStreaming_ContentIndices_AreConsistentAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
// Assert
List contentIndices = [];
@@ -751,7 +751,7 @@ public async Task CreateResponse_Newlines_PreservesFormattingAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- ResponseResult response = await responseClient.CreateResponseAsync("Test");
+ ResponseResult response = await responseClient.CreateResponseAsync("test-model", "Test");
// Assert
string content = response.GetOutputText();
@@ -774,7 +774,7 @@ public async Task CreateResponseStreaming_Newlines_PreservesFormattingAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
// Assert
StringBuilder contentBuilder = new();
@@ -810,7 +810,7 @@ public async Task CreateResponse_ImageContent_ReturnsCorrectlyAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- ResponseResult response = await responseClient.CreateResponseAsync("Show me an image");
+ ResponseResult response = await responseClient.CreateResponseAsync("test-model", "Show me an image");
// Assert
Assert.NotNull(response);
@@ -837,7 +837,7 @@ public async Task CreateResponseStreaming_ImageContent_StreamsCorrectlyAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Show me an image");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Show me an image");
// Assert
List updates = [];
@@ -871,7 +871,7 @@ public async Task CreateResponse_AudioContent_ReturnsCorrectlyAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- ResponseResult response = await responseClient.CreateResponseAsync("Generate audio");
+ ResponseResult response = await responseClient.CreateResponseAsync("test-model", "Generate audio");
// Assert
Assert.NotNull(response);
@@ -899,7 +899,7 @@ public async Task CreateResponseStreaming_AudioContent_StreamsCorrectlyAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Generate audio");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Generate audio");
// Assert
List updates = [];
@@ -933,7 +933,7 @@ public async Task CreateResponse_FunctionCall_ReturnsCorrectlyAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- ResponseResult response = await responseClient.CreateResponseAsync("What's the weather?");
+ ResponseResult response = await responseClient.CreateResponseAsync("test-model", "What's the weather?");
// Assert
Assert.NotNull(response);
@@ -960,7 +960,7 @@ public async Task CreateResponseStreaming_FunctionCall_StreamsCorrectlyAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Calculate 2+2");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Calculate 2+2");
// Assert
List updates = [];
@@ -991,7 +991,7 @@ public async Task CreateResponse_MixedContent_ReturnsCorrectlyAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- ResponseResult response = await responseClient.CreateResponseAsync("Show me various content");
+ ResponseResult response = await responseClient.CreateResponseAsync("test-model", "Show me various content");
// Assert
Assert.NotNull(response);
@@ -1017,7 +1017,7 @@ public async Task CreateResponseStreaming_MixedContent_StreamsCorrectlyAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Show me various content");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Show me various content");
// Assert
List updates = [];
@@ -1050,7 +1050,7 @@ public async Task CreateResponseStreaming_TextDone_IncludesDoneEventAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
// Assert
List updates = [];
@@ -1078,7 +1078,7 @@ public async Task CreateResponseStreaming_ContentPartAdded_IncludesEventAsync()
ResponsesClient responseClient = this.CreateResponseClient(AgentName);
// Act
- AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("Test");
+ AsyncCollectionResult streamingResult = responseClient.CreateResponseStreamingAsync("test-model", "Test");
// Assert
List updates = [];
@@ -1273,7 +1273,6 @@ private async Task SendRawResponseAsync(
private ResponsesClient CreateResponseClient(string agentName)
{
return new ResponsesClient(
- model: "test-model",
credential: new ApiKeyCredential("test-api-key"),
options: new OpenAIClientOptions
{
diff --git a/dotnet/tests/OpenAIResponse.IntegrationTests/OpenAIResponseFixture.cs b/dotnet/tests/OpenAIResponse.IntegrationTests/OpenAIResponseFixture.cs
index 515703c21c..162848ac7d 100644
--- a/dotnet/tests/OpenAIResponse.IntegrationTests/OpenAIResponseFixture.cs
+++ b/dotnet/tests/OpenAIResponse.IntegrationTests/OpenAIResponseFixture.cs
@@ -16,6 +16,7 @@ namespace ResponseResult.IntegrationTests;
public class OpenAIResponseFixture(bool store) : IChatClientAgentFixture
{
+ private string _modelName = null!;
private ResponsesClient _openAIResponseClient = null!;
private ChatClientAgent _agent = null!;
@@ -80,6 +81,7 @@ public async Task CreateChatClientAgentAsync(
Name = name,
ChatOptions = new ChatOptions
{
+ ModelId = this._modelName,
Instructions = instructions,
Tools = aiTools,
RawRepresentationFactory = new Func(_ => new CreateResponseOptions() { StoredOutputEnabled = store })
@@ -96,8 +98,9 @@ public Task DeleteSessionAsync(AgentSession session) =>
public async Task InitializeAsync()
{
+ this._modelName = TestConfiguration.GetRequiredValue(TestSettings.OpenAIChatModelName);
this._openAIResponseClient = new OpenAIClient(TestConfiguration.GetRequiredValue(TestSettings.OpenAIApiKey))
- .GetResponsesClient(TestConfiguration.GetRequiredValue(TestSettings.OpenAIChatModelName));
+ .GetResponsesClient();
this._agent = await this.CreateChatClientAgentAsync();
}