AI-Studio/app/MindWork AI Studio/Provider/OpenAI/ChatCompletionAPIRequest.cs
Peer Schütt 0b2ce886c5 Key fixes include:
Prevented OS credentials from reaching public hosts or cross-origin redirects.
Preserved Responses API reasoning items across tool rounds.
Fixed nullable tool-call handling and omitted unsupported null request properties.
Propagated cancellation correctly.
Removed tool argument values from logs and tool results from persisted traces.
Added settings validation, clearable optional enums, managed-confidence validation, and safe fallback behavior.
Added tool-definition schema and duplicate validation.
Fixed documentation JSON, changelog regressions, typos, trailing whitespace, and unused Anthropic code.
2026-07-15 11:31:11 +02:00

31 lines
1011 B
C#

using System.Text.Json.Serialization;
namespace AIStudio.Provider.OpenAI;
/// <summary>
/// The OpenAI's legacy chat completion request model.
/// </summary>
/// <param name="Model">Which model to use for chat completion.</param>
/// <param name="Messages">The chat messages.</param>
/// <param name="Stream">Whether to stream the chat completion.</param>
public record ChatCompletionAPIRequest(
string Model,
IList<IMessageBase> Messages,
bool Stream
)
{
public ChatCompletionAPIRequest() : this(string.Empty, [], true)
{
}
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IList<object>? Tools { get; init; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? ParallelToolCalls { get; init; }
// Attention: The "required" modifier is not supported for [JsonExtensionData].
[JsonExtensionData]
public IDictionary<string, object> AdditionalApiParameters { get; init; } = new Dictionary<string, object>();
}