10 writes to AdditionalProperties
Microsoft.Extensions.AI.Abstractions (2)
ChatCompletion\StreamingChatCompletionUpdateExtensions.cs (2)
118message.AdditionalProperties = new(update.AdditionalProperties); 151completion.Choices[0].AdditionalProperties = null;
Microsoft.Extensions.AI.Abstractions.Tests (7)
ChatCompletion\ChatCompletionTests.cs (2)
246AdditionalProperties = new() { ["choice1Key"] = "choice1Value" }, 255AdditionalProperties = new() { ["choice2Key"] = "choice2Value" },
ChatCompletion\ChatMessageTests.cs (5)
245message.AdditionalProperties = props; 248message.AdditionalProperties = props; 251message.AdditionalProperties = null; 254message.AdditionalProperties = props; 297AdditionalProperties = new() { ["message-metadata-key-1"] = "message-metadata-value-1" },
Microsoft.Extensions.AI.OpenAI (1)
OpenAIModelMapper.ChatMessage.cs (1)
107message.AdditionalProperties ??= [];
34 references to AdditionalProperties
Microsoft.Extensions.AI.Abstractions (4)
ChatCompletion\ChatCompletion.cs (1)
138AdditionalProperties = choice.AdditionalProperties,
ChatCompletion\StreamingChatCompletionUpdateExtensions.cs (3)
116if (message.AdditionalProperties is null) 125_ = message.AdditionalProperties.TryAdd(entry.Key, entry.Value); 149completion.Choices[0].AdditionalProperties is { } messageProps)
Microsoft.Extensions.AI.Abstractions.Tests (20)
ChatCompletion\ChatMessageTests.cs (10)
26Assert.Null(message.AdditionalProperties); 53Assert.Null(message.AdditionalProperties); 100Assert.Null(message.AdditionalProperties); 246Assert.Same(props, message.AdditionalProperties); 249Assert.Same(props, message.AdditionalProperties); 252Assert.Null(message.AdditionalProperties); 255Assert.Same(props, message.AdditionalProperties); 305Assert.NotNull(deserializedMessage.AdditionalProperties); 306Assert.Single(deserializedMessage.AdditionalProperties); 307Assert.Equal("message-metadata-value-1", deserializedMessage.AdditionalProperties["message-metadata-key-1"]?.ToString());
ChatCompletion\StreamingChatCompletionUpdateExtensionsTests.cs (10)
74Assert.NotNull(message.AdditionalProperties); 75Assert.Equal(2, message.AdditionalProperties.Count); 76Assert.Equal("b", message.AdditionalProperties["a"]); 77Assert.Equal("d", message.AdditionalProperties["c"]); 82Assert.NotNull(message.AdditionalProperties); 83Assert.Equal(3, message.AdditionalProperties.Count); 84Assert.Equal("h", message.AdditionalProperties["g"]); 85Assert.Equal("f", message.AdditionalProperties["e"]); 86Assert.Equal(42, message.AdditionalProperties["i"]); 91Assert.Null(message.AdditionalProperties);
Microsoft.Extensions.AI.OpenAI (2)
OpenAIModelMapper.ChatMessage.cs (2)
108message.AdditionalProperties.Add(nameof(assistantMessage.Refusal), assistantMessage.Refusal); 176if (input.AdditionalProperties?.TryGetValue(nameof(message.Refusal), out string? refusal) is true)
Microsoft.Extensions.AI.OpenAI.Tests (8)
OpenAISerializationTests.cs (8)
155Assert.Null(msg.AdditionalProperties); 167Assert.Null(msg.AdditionalProperties); 179Assert.Null(msg.AdditionalProperties); 191Assert.Null(msg.AdditionalProperties); 249Assert.Null(msg.AdditionalProperties); 273Assert.Null(msg.AdditionalProperties); 409Assert.Null(msg.AdditionalProperties); 421Assert.Null(msg.AdditionalProperties);