diff --git a/OpenAI.SDK/Betalgo.Ranul.OpenAI.csproj b/OpenAI.SDK/Betalgo.Ranul.OpenAI.csproj
index e9d8706..40f85ca 100644
--- a/OpenAI.SDK/Betalgo.Ranul.OpenAI.csproj
+++ b/OpenAI.SDK/Betalgo.Ranul.OpenAI.csproj
@@ -70,7 +70,7 @@
-
+
\ No newline at end of file
diff --git a/OpenAI.SDK/Managers/OpenAIChatClient.cs b/OpenAI.SDK/Managers/OpenAIChatClient.cs
index cd2d0f6..0f3cb0c 100644
--- a/OpenAI.SDK/Managers/OpenAIChatClient.cs
+++ b/OpenAI.SDK/Managers/OpenAIChatClient.cs
@@ -179,7 +179,7 @@ private ChatCompletionCreateRequest CreateRequest(IList chatMessage
JsonSchema = new()
{
Name = json.SchemaName ?? "JsonSchema",
- Schema = JsonSerializer.Deserialize(json.Schema),
+ Schema = json.Schema.Value.Deserialize(),
Description = json.SchemaDescription
}
};
@@ -353,33 +353,27 @@ private static UsageDetails GetUsageDetails(UsageResponse usage)
if (usage.PromptTokensDetails is { } promptDetails)
{
- Dictionary d = new(StringComparer.OrdinalIgnoreCase);
- (details.AdditionalProperties ??= [])[nameof(usage.PromptTokensDetails)] = d;
-
if (promptDetails.CachedTokens is int cachedTokens)
{
- d[nameof(promptDetails.CachedTokens)] = cachedTokens;
+ (details.AdditionalCounts ??= [])[$"{nameof(usage.PromptTokensDetails)}.{nameof(promptDetails.CachedTokens)}"] = cachedTokens;
}
if (promptDetails.AudioTokens is int audioTokens)
{
- d[nameof(promptDetails.AudioTokens)] = audioTokens;
+ (details.AdditionalCounts ??= [])[$"{nameof(usage.PromptTokensDetails)}.{nameof(promptDetails.AudioTokens)}"] = audioTokens;
}
}
if (usage.CompletionTokensDetails is { } completionDetails)
{
- Dictionary d = new(StringComparer.OrdinalIgnoreCase);
- (details.AdditionalProperties ??= [])[nameof(usage.CompletionTokensDetails)] = d;
-
if (completionDetails.ReasoningTokens is int reasoningTokens)
{
- d[nameof(completionDetails.ReasoningTokens)] = reasoningTokens;
+ (details.AdditionalCounts ??= [])[$"{nameof(usage.CompletionTokensDetails)}.{nameof(completionDetails.ReasoningTokens)}"] = reasoningTokens;
}
if (completionDetails.AudioTokens is int audioTokens)
{
- d[nameof(promptDetails.AudioTokens)] = audioTokens;
+ (details.AdditionalCounts ??= [])[$"{nameof(usage.CompletionTokensDetails)}.{nameof(completionDetails.AudioTokens)}"] = audioTokens;
}
}