-
Notifications
You must be signed in to change notification settings - Fork 589
Fix ToJsonObject serialization failure with anonymous types and add support for custom JsonSerializerOptions #1113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
982138e
6a070b3
57b4a93
bcf2e24
7041a89
867d044
bd598ea
32f2549
cb95813
a3cb705
111616b
c1212c6
f46474b
8c94a23
46425b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,7 +139,7 @@ public static class AIContentExtensions | |
|
|
||
| /// <summary>Converts the specified dictionary to a <see cref="JsonObject"/>.</summary> | ||
| internal static JsonObject? ToJsonObject(this IReadOnlyDictionary<string, object?> properties) => | ||
| JsonSerializer.SerializeToNode(properties, McpJsonUtilities.JsonContext.Default.IReadOnlyDictionaryStringObject) as JsonObject; | ||
| JsonSerializer.SerializeToNode(properties, McpJsonUtilities.DefaultOptions.GetTypeInfo(typeof(IReadOnlyDictionary<string, object?>))) as JsonObject; | ||
|
|
||
| internal static AdditionalPropertiesDictionary ToAdditionalProperties(this JsonObject obj) | ||
| { | ||
|
|
@@ -271,7 +271,7 @@ public static IList<PromptMessage> ToPromptMessages(this ChatMessage chatMessage | |
| EmbeddedResourceBlock resourceContent => resourceContent.Resource.ToAIContent(), | ||
|
|
||
| ToolUseContentBlock toolUse => FunctionCallContent.CreateFromParsedArguments(toolUse.Input, toolUse.Id, toolUse.Name, | ||
| static json => JsonSerializer.Deserialize(json, McpJsonUtilities.JsonContext.Default.IDictionaryStringObject)), | ||
| static json => JsonSerializer.Deserialize(json, McpJsonUtilities.DefaultOptions.GetTypeInfo<IDictionary<string, object?>>())), | ||
|
||
|
|
||
| ToolResultContentBlock toolResult => new FunctionResultContent( | ||
| toolResult.ToolUseId, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.