20 references to TryGetValue
Microsoft.Extensions.AI.Abstractions.Tests (3)
AdditionalPropertiesDictionaryTests.cs (3)
78Assert.True(d.TryGetValue("key", out T2? value)); 81Assert.False(d.TryGetValue("key2", out value)); 89Assert.False(d.TryGetValue("key", out T2? value));
Microsoft.Extensions.AI.Ollama (3)
OllamaChatClient.cs (1)
360if (options.AdditionalProperties?.TryGetValue(propertyName, out T? t) is true)
OllamaEmbeddingGenerator.cs (2)
95if (requestProps.TryGetValue("keep_alive", out long keepAlive)) 100if (requestProps.TryGetValue("truncate", out bool truncate))
Microsoft.Extensions.AI.OpenAI (14)
OpenAIEmbeddingGenerator.cs (1)
149if (additionalProperties.TryGetValue(nameof(openAIOptions.EndUserId), out string? endUserId))
OpenAIModelMapper.ChatCompletion.cs (12)
260if (additionalProperties.TryGetValue(nameof(result.EndUserId), out string? endUserId)) 265if (additionalProperties.TryGetValue(nameof(result.IncludeLogProbabilities), out bool includeLogProbabilities)) 270if (additionalProperties.TryGetValue(nameof(result.LogitBiases), out IDictionary<int, int>? logitBiases)) 278if (additionalProperties.TryGetValue(nameof(result.AllowParallelToolCalls), out bool allowParallelToolCalls)) 283if (additionalProperties.TryGetValue(nameof(result.TopLogProbabilityCount), out int topLogProbabilityCountInt)) 288if (additionalProperties.TryGetValue(nameof(result.Metadata), out IDictionary<string, string>? metadata)) 296if (additionalProperties.TryGetValue(nameof(result.StoredOutputEnabled), out bool storeOutputEnabled)) 460int? inputAudioTokenCount = additionalCounts.TryGetValue( 464int? inputCachedTokenCount = additionalCounts.TryGetValue( 468int? outputAudioTokenCount = additionalCounts.TryGetValue( 472int? outputReasoningTokenCount = additionalCounts.TryGetValue( 585dict?.TryGetValue(key, out T? value) is true ? value : default;
OpenAIModelMapper.ChatMessage.cs (1)
176if (input.AdditionalProperties?.TryGetValue(nameof(message.Refusal), out string? refusal) is true)