Skip to content

Commit

Permalink
.Net: Update M.E.AI to 9.1.0-preview.1.25064.3 (#10199)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentoub authored Jan 21, 2025
1 parent a44e802 commit b8224ed
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions dotnet/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
<PackageVersion Include="Microsoft.DeepDev.TokenizerLib" Version="1.3.3" />
<PackageVersion Include="SharpToken" Version="2.0.3" />
<!-- Microsoft.Extensions.* -->
<PackageVersion Include="Microsoft.Extensions.AI" Version="9.0.1-preview.1.24570.5" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="9.0.1-preview.1.24570.5" />
<PackageVersion Include="Microsoft.Extensions.AI.AzureAIInference" Version="9.0.1-preview.1.24570.5" />
<PackageVersion Include="Microsoft.Extensions.AI" Version="9.1.0-preview.1.25064.3" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="9.1.0-preview.1.25064.3" />
<PackageVersion Include="Microsoft.Extensions.AI.AzureAIInference" Version="9.1.0-preview.1.25064.3" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public async IAsyncEnumerable<StreamingChatMessageContent> GetStreamingChatMessa
{
"text" => ChatResponseFormat.Text,
"json_object" => ChatResponseFormat.Json,
JsonElement e => ChatResponseFormat.ForJsonSchema(e.ToString()),
JsonElement e => ChatResponseFormat.ForJsonSchema(e),
_ => null,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ public void Dispose()
}
else if (options.ResponseFormat is ChatResponseFormatJson json)
{
settings.ExtensionData["response_format"] = json.Schema is not null ?
JsonSerializer.Deserialize(json.Schema, AbstractionsJsonContext.Default.JsonElement) :
settings.ExtensionData["response_format"] = json.Schema is JsonElement schema ?
JsonSerializer.Deserialize(schema, AbstractionsJsonContext.Default.JsonElement) :
"json_object";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ public async Task AsChatClientNonStreamingResponseFormatHandled()
oaiSettings = JsonSerializer.Deserialize<OpenAIPromptExecutionSettings>(JsonSerializer.Serialize(actualSettings));
Assert.Equal("json_object", oaiSettings?.ResponseFormat?.ToString());

await client.CompleteAsync(messages, new() { ResponseFormat = ChatResponseFormat.ForJsonSchema("""
await client.CompleteAsync(messages, new() { ResponseFormat = ChatResponseFormat.ForJsonSchema(JsonSerializer.Deserialize<JsonElement>("""
{"type": "string"}
""") });
""")) });
oaiSettings = JsonSerializer.Deserialize<OpenAIPromptExecutionSettings>(JsonSerializer.Serialize(actualSettings));
Assert.Equal(JsonValueKind.Object, Assert.IsType<JsonElement>(oaiSettings?.ResponseFormat).ValueKind);
}
Expand Down

0 comments on commit b8224ed

Please sign in to comment.