Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save christianarg/0d78dcfae6b9c0f9ce652ce913d6a483 to your computer and use it in GitHub Desktop.

Select an option

Save christianarg/0d78dcfae6b9c0f9ce652ce913d6a483 to your computer and use it in GitHub Desktop.
How to pass reasoning and verbosity parameters to OpenAi Models with Responses api using Microsoft Agent Framework net sdk
var agent = new AzureOpenAIClient(
new Uri(""), // endpoint
new DefaultAzureCredential())
.GetOpenAIResponseClient("gpt-5")
// configure reasoning https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step02_Reasoning/Program.cs
// verbosity param https://github.com/openai/openai-dotnet/issues/593
.AsIChatClient().AsBuilder()
.ConfigureOptions(o =>
{
o.RawRepresentationFactory = _ => ((IJsonModel<ResponseCreationOptions>)new ResponseCreationOptions())
.Create(BinaryData.FromObjectAsJson(new
{
reasoning = new { effort = "low" },
text = new { verbosity = "low" },
}), ModelReaderWriterOptions.Json);
}).Build()
.CreateAIAgent(instructions: "You're a helpful assistant.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment