Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d66058c
Add dynamicModel decorator
ShivangiReja Sep 26, 2025
c0db273
Fix custom code
ShivangiReja Oct 1, 2025
6fcfedb
Merge branch 'main' of https://github.com/openai/openai-dotnet into s…
ShivangiReja Oct 1, 2025
95f6e01
Update generated code
ShivangiReja Oct 1, 2025
a632294
Merge branch 'main' of https://github.com/openai/openai-dotnet into s…
ShivangiReja Oct 1, 2025
1e8cd92
Add a sample
ShivangiReja Oct 1, 2025
08c4123
Add samples
ShivangiReja Oct 2, 2025
a1132b6
Add more samples
ShivangiReja Oct 2, 2025
2b83621
Merge branch 'main' of https://github.com/openai/openai-dotnet into s…
ShivangiReja Oct 2, 2025
e992611
Update generated code
ShivangiReja Oct 2, 2025
0af181b
Add missed recordings
ShivangiReja Oct 3, 2025
a6a4dfe
Merge branch 'main' of https://github.com/openai/openai-dotnet into s…
jorgerangel-msft Oct 3, 2025
1deb7ab
fix: update visitors to account for jsonpatch changes
jorgerangel-msft Oct 3, 2025
f1fdd73
Add missed recordings
ShivangiReja Oct 3, 2025
4d10d21
Feedback
ShivangiReja Oct 4, 2025
8518ee1
Revert [Test]
ShivangiReja Oct 4, 2025
1a565f5
Add tests
ShivangiReja Oct 6, 2025
164ac0b
add test infra & visitor tests
jorgerangel-msft Oct 7, 2025
833212a
revert main.yaml. Move to codegen pipeline
jorgerangel-msft Oct 7, 2025
1dd0134
cleanup
jorgerangel-msft Oct 7, 2025
b08cc8b
Add a sample
ShivangiReja Oct 7, 2025
982086b
Merge branch 'main' of https://github.com/openai/openai-dotnet into s…
ShivangiReja Oct 7, 2025
489ce5f
fb
ShivangiReja Oct 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions examples/Responses/Example09_ModelOverridePerRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using NUnit.Framework;
using OpenAI.Responses;
using System;

namespace OpenAI.Examples;

// This example uses experimental APIs which are subject to change. To use experimental APIs,
// please acknowledge their experimental status by suppressing the corresponding warning.
#pragma warning disable OPENAI001
#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.

public partial class ResponseExamples
{
[Test]
public void Example09_ModelOverridePerRequest()
{
OpenAIResponseClient client = new(model: "gpt-4o", apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY"));

// Add extra request fields using Patch.
// Patch lets you set fields like `model` that aren't exposed on ResponseCreationOptions.
// See the API docs https://platform.openai.com/docs/api-reference/responses/create for supported additional fields.
ResponseCreationOptions options = new();
options.Patch.Set("$.model"u8, "gpt-5");

OpenAIResponse response = client.CreateResponse("Say 'this is a test.", options);

Console.WriteLine($"[ASSISTANT]: {response.GetOutputText()}, [Mode]: {response.Model}");
}
}

#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
#pragma warning restore OPENAI001
33 changes: 33 additions & 0 deletions examples/Responses/Example09_ModelOverridePerRequestAsync.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using NUnit.Framework;
using OpenAI.Responses;
using System;
using System.Threading.Tasks;

namespace OpenAI.Examples;

// This example uses experimental APIs which are subject to change. To use experimental APIs,
// please acknowledge their experimental status by suppressing the corresponding warning.
#pragma warning disable OPENAI001
#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.

public partial class ResponseExamples
{
[Test]
public async Task Example09_ModelOverridePerRequestAsync()
{
OpenAIResponseClient client = new(model: "gpt-4o", apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY"));

// Add extra request fields using Patch.
// Patch lets you set fields like `model` that aren't exposed on ResponseCreationOptions.
// See the API docs https://platform.openai.com/docs/api-reference/responses/create for supported additional fields.
ResponseCreationOptions options = new();
options.Patch.Set("$.model"u8, "gpt-5");

OpenAIResponse response = await client.CreateResponseAsync("Say 'this is a test.", options);

Console.WriteLine($"[ASSISTANT]: {response.GetOutputText()}, [Mode]: {response.Model}");
}
}

#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
#pragma warning restore OPENAI001
Loading