36 references to AIJsonUtilities
Microsoft.Extensions.AI (13)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (4)
50CompleteAsync<T>(chatClient, chatMessages, AIJsonUtilities.DefaultOptions, options, useNativeJsonSchema, cancellationToken); 125var schemaElement = AIJsonUtilities.CreateJsonSchema( 136schema = JsonSerializer.Serialize(schemaElement, AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(JsonElement))); 150}, AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(JsonObject)));
ChatCompletion\DistributedCachingChatClient.cs (1)
27private JsonSerializerOptions _jsonSerializerOptions = AIJsonUtilities.DefaultOptions;
ChatCompletion\LoggingChatClient.cs (1)
35_jsonSerializerOptions = AIJsonUtilities.DefaultOptions;
ChatCompletion\OpenTelemetryChatClient.cs (1)
80_jsonSerializerOptions = AIJsonUtilities.DefaultOptions;
Embeddings\DistributedCachingEmbeddingGenerator.cs (1)
38_jsonSerializerOptions = AIJsonUtilities.DefaultOptions;
Embeddings\LoggingEmbeddingGenerator.cs (1)
38_jsonSerializerOptions = AIJsonUtilities.DefaultOptions;
Functions\AIFunctionFactory.cs (2)
276Schema = AIJsonUtilities.CreateJsonSchema(returnType, serializerOptions: options.SerializerOptions, inferenceOptions: options.SchemaCreateOptions), 422Schema = AIJsonUtilities.CreateParameterJsonSchema(
Functions\AIFunctionFactoryCreateOptions.cs (1)
18private JsonSerializerOptions _options = AIJsonUtilities.DefaultOptions;
LoggingHelpers.cs (1)
19AIJsonUtilities.DefaultOptions.TryGetTypeInfo(typeof(T), out typeInfo))
Microsoft.Extensions.AI.Abstractions (2)
Utilities\AIJsonSchemaCreateContext.cs (1)
19/// callback by the <see cref="AIJsonUtilities.CreateJsonSchema"/> method and cannot be instantiated directly.
Utilities\AIJsonSchemaCreateOptions.cs (1)
10/// Provides options for configuring the behavior of <see cref="AIJsonUtilities"/> JSON schema creation functionality.
Microsoft.Extensions.AI.Abstractions.Tests (9)
Utilities\AIJsonUtilitiesTests.cs (9)
21var options = AIJsonUtilities.DefaultOptions; 25Assert.Same(options, AIJsonUtilities.DefaultOptions); 77JsonElement actual = AIJsonUtilities.CreateJsonSchema(typeof(MyPoco), serializerOptions: JsonSerializerOptions.Default); 116JsonElement actual = AIJsonUtilities.CreateJsonSchema( 167JsonElement actual = AIJsonUtilities.CreateJsonSchema(typeof(MyPoco), serializerOptions: JsonSerializerOptions.Default, inferenceOptions: inferenceOptions); 195JsonElement actual = AIJsonUtilities.CreateJsonSchema(typeof(PocoWithTypesWithOpenAIUnsupportedKeywords), serializerOptions: JsonSerializerOptions.Default); 223resolvedSchema = AIJsonUtilities.ResolveParameterJsonSchema(param, metadata, options); 260JsonElement schema = AIJsonUtilities.CreateJsonSchema(typeof(object)); 279JsonElement schema = AIJsonUtilities.CreateJsonSchema(testData.Type, serializerOptions: options, inferenceOptions: createOptions);
Microsoft.Extensions.AI.AzureAIInference (4)
AzureAIInferenceChatClient.cs (3)
32private JsonSerializerOptions _toolCallJsonSerializerOptions = AIJsonUtilities.DefaultOptions; 315result.AdditionalProperties["top_k"] = new BinaryData(JsonSerializer.SerializeToUtf8Bytes(topK, AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(int)))); 502(JsonTypeInfo<IDictionary<string, object>>)AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(IDictionary<string, object>)))!);
AzureAIInferenceEmbeddingGenerator.cs (1)
176byte[] data = JsonSerializer.SerializeToUtf8Bytes(prop.Value, AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(object)));
Microsoft.Extensions.AI.AzureAIInference.Tests (1)
AzureAIInferenceChatClientTests.cs (1)
38Assert.Same(client.ToolCallJsonSerializerOptions, AIJsonUtilities.DefaultOptions);
Microsoft.Extensions.AI.Ollama (1)
OllamaChatClient.cs (1)
34private JsonSerializerOptions _toolCallJsonSerializerOptions = AIJsonUtilities.DefaultOptions;
Microsoft.Extensions.AI.Ollama.Tests (1)
OllamaChatClientTests.cs (1)
35Assert.Same(client.ToolCallJsonSerializerOptions, AIJsonUtilities.DefaultOptions);
Microsoft.Extensions.AI.OpenAI (4)
OpenAIChatClient.cs (3)
41private JsonSerializerOptions _toolCallJsonSerializerOptions = AIJsonUtilities.DefaultOptions; 678(JsonTypeInfo<IDictionary<string, object>>)AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(IDictionary<string, object>)))!); 683(JsonTypeInfo<IDictionary<string, object>>)AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(IDictionary<string, object>)))!);
OpenAIRealtimeExtensions.cs (1)
117var jsonOptions = jsonSerializerOptions ?? AIJsonUtilities.DefaultOptions;
Microsoft.Extensions.AI.OpenAI.Tests (1)
OpenAIChatClientTests.cs (1)
43Assert.Same(client.ToolCallJsonSerializerOptions, AIJsonUtilities.DefaultOptions);