11 writes to TotalTokenCount
Microsoft.Extensions.AI.Abstractions.Tests (2)
ChatCompletion\ChatCompletionTests.cs (1)
264Usage = new UsageDetails { TotalTokenCount = 123 },
ChatCompletion\StreamingChatCompletionUpdateExtensionsTests.cs (1)
199new() { Contents = [new UsageContent(new() { TotalTokenCount = 42 })] },
Microsoft.Extensions.AI.AzureAIInference (3)
AzureAIInferenceChatClient.cs (2)
128TotalTokenCount = completionsUsage.TotalTokens, 220TotalTokenCount = usage.TotalTokens,
AzureAIInferenceEmbeddingGenerator.cs (1)
104TotalTokenCount = embeddings.Usage.TotalTokens
Microsoft.Extensions.AI.Ollama (2)
OllamaChatClient.cs (1)
202TotalTokenCount = response.PromptEvalCount.GetValueOrDefault() + response.EvalCount.GetValueOrDefault(),
OllamaEmbeddingGenerator.cs (1)
139TotalTokenCount = tokens,
Microsoft.Extensions.AI.OpenAI (2)
OpenAIChatClient.cs (1)
297TotalTokenCount = tokenUsage.TotalTokenCount,
OpenAIEmbeddingGenerator.cs (1)
128TotalTokenCount = embeddings.Usage.TotalTokenCount
Microsoft.Extensions.AI.Tests (2)
ChatCompletion\OpenTelemetryChatClientTests.cs (2)
50TotalTokenCount = 42, 84TotalTokenCount = 42,
18 references to TotalTokenCount
Microsoft.Extensions.AI.Abstractions (2)
UsageDetails.cs (2)
43if (TotalTokenCount is int total) 45parts.Add($"{nameof(TotalTokenCount)} = {total}");
Microsoft.Extensions.AI.Abstractions.Tests (3)
ChatCompletion\ChatCompletionTests.cs (1)
295Assert.Equal(123, Assert.IsType<UsageContent>(Assert.Single(update2.Contents)).Details.TotalTokenCount);
ChatCompletion\StreamingChatCompletionUpdateExtensionsTests.cs (1)
207Assert.Equal(42, completion.Usage.TotalTokenCount);
Contents\UsageContentTests.cs (1)
28Assert.Null(c.Details.TotalTokenCount);
Microsoft.Extensions.AI.AzureAIInference.Tests (2)
AzureAIInferenceChatClientTests.cs (2)
158Assert.Equal(17, response.Usage.TotalTokenCount); 420Assert.Equal(57, response.Usage.TotalTokenCount);
Microsoft.Extensions.AI.Integration.Tests (3)
ChatClientIntegrationTests.cs (3)
108Assert.Equal(response.Usage?.InputTokenCount + response.Usage?.OutputTokenCount, response.Usage?.TotalTokenCount); 135Assert.Equal(usage.Details.InputTokenCount + usage.Details.OutputTokenCount, usage.Details.TotalTokenCount); 185Assert.True(finalUsage.TotalTokenCount > intermediate.Details.TotalTokenCount);
Microsoft.Extensions.AI.Ollama.Tests (2)
OllamaChatClientTests.cs (2)
129Assert.Equal(21, response.Usage.TotalTokenCount); 201Assert.Equal(31, usage.Details.TotalTokenCount);
Microsoft.Extensions.AI.OpenAI.Tests (6)
OpenAIChatClientTests.cs (6)
201Assert.Equal(17, response.Usage.TotalTokenCount); 277Assert.Equal(17, usage.Details.TotalTokenCount); 474Assert.Equal(57, response.Usage.TotalTokenCount); 567Assert.Equal(57, response.Usage.TotalTokenCount); 784Assert.Equal(77, usage.Details.TotalTokenCount); 918Assert.Equal(57, response.Usage.TotalTokenCount);