.NET: Fix bugbash issues (#448)

* Fix bugbash issues

* Update dotnet/samples/GettingStarted/Providers/AIAgent_With_OpenAIResponseClient.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Mark Wallace
2025-08-20 12:22:11 +00:00
committed by GitHub
co-authored by Copilot
parent 4277aa2576
commit 0982aa9d6d
4 changed files with 34 additions and 15 deletions
@@ -0,0 +1,28 @@
// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Shared.Diagnostics;
using OpenAI.Responses;
namespace Microsoft.Extensions.AI.Agents;
/// <summary>
/// Extension methods for <see cref="ChatOptions"/>
/// </summary>
public static class ChatOptionsExtensions
{
/// <summary>
/// Disables the storage of response output in the chat options.
/// </summary>
/// <param name="options">Instance of <see cref="ChatOptions"/></param>
/// <exception cref="ArgumentNullException"></exception>
public static ChatOptions WithResponseStoredOutputDisabled(this ChatOptions options)
{
Throw.IfNull(options);
// We can use the RawRepresentationFactory to provide Response service specific
// options. Here we can indicate that we do not want the service to store the
// conversation in a service managed thread.
options.RawRepresentationFactory = (_) => new ResponseCreationOptions() { StoredOutputEnabled = false };
return options;
}
}