Some provider send additional metadata with their answers. These are often needed for their provider-specific implementation of the chat-completions API. Therefore we do not remove them, but send them with the request

This commit is contained in:
Peer Schütt 2026-07-27 10:29:59 +02:00
parent f0e1df12f4
commit ca90595b8c
2 changed files with 7 additions and 0 deletions

View File

@ -1249,6 +1249,7 @@ public abstract class BaseProvider : IProvider, ISecretId
{
Id = toolCallId,
Type = string.IsNullOrWhiteSpace(returnedToolCall?.Type) ? "function" : returnedToolCall.Type,
AdditionalMetadata = returnedToolCall?.AdditionalMetadata ?? new Dictionary<string, JsonElement>(),
Function = new ChatCompletionToolFunction
{
Name = string.IsNullOrWhiteSpace(returnedFunctionName) ? "invalid_tool_call" : returnedFunctionName,

View File

@ -1,3 +1,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace AIStudio.Provider.OpenAI;
public sealed record ChatCompletionToolCall
@ -7,4 +10,7 @@ public sealed record ChatCompletionToolCall
public string? Type { get; init; } = "function";
public ChatCompletionToolFunction? Function { get; init; }
[JsonExtensionData]
public IDictionary<string, JsonElement> AdditionalMetadata { get; init; } = new Dictionary<string, JsonElement>();
}