15 writes to InputTokenCount
Microsoft.Extensions.AI.Abstractions (1)
UsageDetails.cs (1)
35InputTokenCount = NullableSum(InputTokenCount, usage.InputTokenCount);
Microsoft.Extensions.AI.Abstractions.Tests (2)
ChatCompletion\StreamingChatCompletionUpdateExtensionsTests.cs (2)
50new() { ChoiceIndex = 0, Contents = new[] { new UsageContent(new() { InputTokenCount = 1, OutputTokenCount = 2 }) } }, 51new() { ChoiceIndex = 3, Contents = new[] { new UsageContent(new() { InputTokenCount = 4, OutputTokenCount = 5 }) } },
Microsoft.Extensions.AI.AzureAIInference (3)
AzureAIInferenceChatClient.cs (2)
128InputTokenCount = completionsUsage.PromptTokens, 220InputTokenCount = usage.PromptTokens,
AzureAIInferenceEmbeddingGenerator.cs (1)
103InputTokenCount = embeddings.Usage.PromptTokens,
Microsoft.Extensions.AI.Ollama (2)
OllamaChatClient.cs (1)
211InputTokenCount = response.PromptEvalCount,
OllamaEmbeddingGenerator.cs (1)
138InputTokenCount = response.PromptEvalCount,
Microsoft.Extensions.AI.OpenAI (2)
OpenAIEmbeddingGenerator.cs (1)
127InputTokenCount = embeddings.Usage.InputTokenCount,
OpenAIModelMapper.ChatCompletion.cs (1)
422InputTokenCount = tokenUsage.InputTokenCount,
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAISerializationTests.cs (2)
460InputTokenCount = 8, 579InputTokenCount = 8,
Microsoft.Extensions.AI.Tests (3)
ChatCompletion\FunctionInvokingChatClientTests.cs (1)
644InputTokenCount = value,
ChatCompletion\OpenTelemetryChatClientTests.cs (2)
48InputTokenCount = 10, 87InputTokenCount = 10,
25 references to InputTokenCount
Microsoft.Extensions.AI (3)
ChatCompletion\OpenTelemetryChatClient.cs (2)
336if (usage.InputTokenCount is int inputTokens) 383if (completion.Usage?.InputTokenCount is int inputTokens)
Embeddings\OpenTelemetryEmbeddingGenerator.cs (1)
190if (embeddings.Usage?.InputTokenCount is int i)
Microsoft.Extensions.AI.Abstractions (4)
UsageDetails.cs (4)
35InputTokenCount = NullableSum(InputTokenCount, usage.InputTokenCount); 65if (InputTokenCount is int input) 67parts.Add($"{nameof(InputTokenCount)} = {input}");
Microsoft.Extensions.AI.Abstractions.Tests (1)
Contents\UsageContentTests.cs (1)
26Assert.Null(c.Details.InputTokenCount);
Microsoft.Extensions.AI.AzureAIInference.Tests (2)
AzureAIInferenceChatClientTests.cs (2)
169Assert.Equal(8, response.Usage.InputTokenCount); 667Assert.Equal(42, response.Usage.InputTokenCount);
Microsoft.Extensions.AI.Integration.Tests (4)
ChatClientIntegrationTests.cs (4)
105Assert.True(response.Usage?.InputTokenCount > 1); 107Assert.Equal(response.Usage?.InputTokenCount + response.Usage?.OutputTokenCount, response.Usage?.TotalTokenCount); 132Assert.True(usage.Details.InputTokenCount > 1); 134Assert.Equal(usage.Details.InputTokenCount + usage.Details.OutputTokenCount, usage.Details.TotalTokenCount);
Microsoft.Extensions.AI.Ollama.Tests (2)
OllamaChatClientTests.cs (2)
127Assert.Equal(11, response.Usage.InputTokenCount); 199Assert.Equal(11, usage.Details.InputTokenCount);
Microsoft.Extensions.AI.OpenAI (1)
OpenAIModelMapper.ChatCompletion.cs (1)
492inputTokenCount: usageDetails.InputTokenCount ?? 0,
Microsoft.Extensions.AI.OpenAI.Tests (6)
OpenAIChatClientTests.cs (6)
199Assert.Equal(8, response.Usage.InputTokenCount); 281Assert.Equal(8, usage.Details.InputTokenCount); 546Assert.Equal(42, response.Usage.InputTokenCount); 645Assert.Equal(42, response.Usage.InputTokenCount); 876Assert.Equal(61, usage.Details.InputTokenCount); 1016Assert.Equal(42, response.Usage.InputTokenCount);
Microsoft.Extensions.AI.Tests (2)
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
581expectedTotalTokenCounts += usage.InputTokenCount!.Value; 627Assert.Equal(expectedTotalTokenCounts, actualUsage.InputTokenCount);