29 writes to OutputTokenCount
Microsoft.Extensions.AI.Abstractions (1)
UsageDetails.cs (1)
39OutputTokenCount = NullableSum(OutputTokenCount, usage.OutputTokenCount);
Microsoft.Extensions.AI.Abstractions.Tests (6)
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (2)
35new() { Contents = [new UsageContent(new() { InputTokenCount = 1, OutputTokenCount = 2 })] }, 36new() { Contents = [new UsageContent(new() { InputTokenCount = 4, OutputTokenCount = 5 })] },
Contents\AIContentTests.cs (1)
72new UsageContent(new UsageDetails { InputTokenCount = 10, OutputTokenCount = 20, TotalTokenCount = 30 }),
Contents\UsageContentTests.cs (1)
68OutputTokenCount = 20,
SpeechToText\SpeechToTextResponseTests.cs (2)
161Usage = new() { InputTokenCount = 42, OutputTokenCount = 84, TotalTokenCount = 126 }, 219Usage = withUsage ? new UsageDetails { InputTokenCount = 100, OutputTokenCount = 200, TotalTokenCount = 300 } : null
Microsoft.Extensions.AI.AzureAIInference (2)
AzureAIInferenceChatClient.cs (2)
122OutputTokenCount = completionsUsage.CompletionTokens, 208OutputTokenCount = usage.CompletionTokens,
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (4)
ScenarioRunResultTests.cs (4)
68usage: new UsageDetails { InputTokenCount = 10, OutputTokenCount = 20, TotalTokenCount = 30 }, 76usage: new UsageDetails { InputTokenCount = 20, OutputTokenCount = 30, TotalTokenCount = 50 }, 160usage: new UsageDetails { InputTokenCount = 10, OutputTokenCount = 20, TotalTokenCount = 30 }, 168usage: new UsageDetails { InputTokenCount = 20, OutputTokenCount = 30, TotalTokenCount = 50 },
Microsoft.Extensions.AI.OpenAI (4)
OpenAIAssistantsChatClient.cs (1)
181OutputTokenCount = usage.OutputTokenCount,
OpenAIChatClient.cs (1)
645OutputTokenCount = tokenUsage.OutputTokenCount,
OpenAIImageGenerator.cs (1)
169OutputTokenCount = usage.OutputTokenCount,
OpenAIResponsesChatClient.cs (1)
1102OutputTokenCount = usage.OutputTokenCount,
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAIConversionTests.cs (2)
799OutputTokenCount = 12, 1015OutputTokenCount = 20,
Microsoft.Extensions.AI.Tests (10)
ChatCompletion\DistributedCachingChatClientTest.cs (3)
66OutputTokenCount = 456, 255new UsageContent(new() { InputTokenCount = 123, OutputTokenCount = 456, TotalTokenCount = 99999 }), 269Contents = [new UsageContent(new() { InputTokenCount = 123, OutputTokenCount = 456, TotalTokenCount = 99999 })],
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (1)
929OutputTokenCount = value,
ChatCompletion\FunctionInvokingChatClientTests.cs (1)
1311OutputTokenCount = value,
ChatCompletion\OpenTelemetryChatClientTests.cs (2)
45OutputTokenCount = 20, 85OutputTokenCount = 20,
Image\OpenTelemetryImageGeneratorTests.cs (1)
52OutputTokenCount = 20,
SpeechToText\OpenTelemetrySpeechToTextClientTests.cs (2)
50OutputTokenCount = 20, 77OutputTokenCount = 20,
73 references to OutputTokenCount
Microsoft.Extensions.AI (7)
ChatCompletion\FunctionInvokingChatClient.cs (1)
651if (usage.OutputTokenCount is long outputTokens)
ChatCompletion\OpenTelemetryChatClient.cs (2)
516if (usage.OutputTokenCount is long outputTokens) 560if (response.Usage?.OutputTokenCount is long outputTokens)
ChatCompletion\OpenTelemetryImageGenerator.cs (2)
265if (usage.OutputTokenCount is long outputTokens) 281if (usage.OutputTokenCount is long outputTokens)
SpeechToText\OpenTelemetrySpeechToTextClient.cs (2)
276if (usage.OutputTokenCount is long outputTokens) 313if (response.Usage?.OutputTokenCount is long outputTokens)
Microsoft.Extensions.AI.Abstractions (4)
UsageDetails.cs (4)
39OutputTokenCount = NullableSum(OutputTokenCount, usage.OutputTokenCount); 73if (OutputTokenCount is { } output) 75parts.Add($"{nameof(OutputTokenCount)} = {output}");
Microsoft.Extensions.AI.Abstractions.Tests (6)
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (1)
46Assert.Equal(7, response.Usage.OutputTokenCount);
Contents\UsageContentTests.cs (3)
28Assert.Null(c.Details.OutputTokenCount); 78Assert.Equal(content.Details.OutputTokenCount, deserializedContent.Details.OutputTokenCount);
SpeechToText\SpeechToTextResponseTests.cs (2)
189Assert.Equal(84, result.Usage.OutputTokenCount); 248Assert.Equal(200, usage.Details.OutputTokenCount);
Microsoft.Extensions.AI.AzureAIInference.Tests (4)
AzureAIInferenceChatClientTests.cs (4)
166Assert.Equal(9, response.Usage.OutputTokenCount); 1015Assert.Equal(15, response.Usage.OutputTokenCount); 1149Assert.Equal(15, response.Usage.OutputTokenCount); 1263Assert.Equal(16, response.Usage.OutputTokenCount);
Microsoft.Extensions.AI.Evaluation (2)
EvaluationMetricExtensions.cs (2)
171if (usage.OutputTokenCount is not null) 175value: usage.OutputTokenCount.Value.ToInvariantString());
Microsoft.Extensions.AI.Evaluation.Console (3)
Commands\ReportCommand.cs (3)
364CachedOutputTokenCount += turn.Usage?.OutputTokenCount; 370NonCachedOutputTokenCount += turn.Usage?.OutputTokenCount; 391if (turn.Usage?.OutputTokenCount is not null)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (11)
ChatTurnDetailsTests.cs (9)
137Assert.Equal(20, details.Usage.OutputTokenCount); 150Assert.Equal(details.Usage.OutputTokenCount, deserializedDetails.Usage.OutputTokenCount); 179Assert.Equal(20, details.Usage.OutputTokenCount); 192Assert.Equal(details.Usage.OutputTokenCount, deserializedDetails.Usage.OutputTokenCount); 222Assert.Equal(7, details.Usage.OutputTokenCount); 235Assert.Equal(details.Usage.OutputTokenCount, deserializedDetails.Usage.OutputTokenCount);
ScenarioRunResultTests.cs (2)
400x?.Usage?.OutputTokenCount == y?.Usage?.OutputTokenCount &&
Microsoft.Extensions.AI.Integration.Tests (5)
ChatClientIntegrationTests.cs (5)
134Assert.True(response.Usage?.OutputTokenCount > 1); 135Assert.Equal(response.Usage?.InputTokenCount + response.Usage?.OutputTokenCount, response.Usage?.TotalTokenCount); 161Assert.True(usage.Details.OutputTokenCount > 1); 162Assert.Equal(usage.Details.InputTokenCount + usage.Details.OutputTokenCount, usage.Details.TotalTokenCount); 397Assert.Equal(totalOutputTokens, finalUsage.OutputTokenCount * 2);
Microsoft.Extensions.AI.OpenAI (2)
MicrosoftExtensionsAIChatExtensions.cs (2)
65(int?)response.Usage?.OutputTokenCount ?? 0, 145(int?)usageContent.Details.OutputTokenCount ?? 0,
Microsoft.Extensions.AI.OpenAI.Tests (23)
OpenAIChatClientTests.cs (10)
172Assert.Equal(9, response.Usage.OutputTokenCount); 259Assert.Equal(9, usage.Details.OutputTokenCount); 846Assert.Equal(15, response.Usage.OutputTokenCount); 943Assert.Equal(15, response.Usage.OutputTokenCount); 1041Assert.Equal(15, response.Usage.OutputTokenCount); 1152Assert.Equal(16, response.Usage.OutputTokenCount); 1236Assert.Equal(16, response.Usage.OutputTokenCount); 1352Assert.Equal(16, usage.Details.OutputTokenCount); 1494Assert.Equal(15, response.Usage.OutputTokenCount); 1609Assert.Equal(56, response.Usage.OutputTokenCount);
OpenAIConversionTests.cs (2)
613Assert.Equal(2, response.Usage.OutputTokenCount); 644Assert.Equal(2, response.Usage.OutputTokenCount);
OpenAIResponseClientTests.cs (11)
170Assert.Equal(10, response.Usage.OutputTokenCount); 350Assert.Equal(122, usage.Details.OutputTokenCount); 477Assert.Equal(25, usage.Details.OutputTokenCount); 592Assert.Equal(10, usage.Details.OutputTokenCount); 954Assert.Equal(10, response.Usage.OutputTokenCount); 1224Assert.Equal(72, response.Usage.OutputTokenCount); 1492Assert.Equal(123, response.Usage.OutputTokenCount); 1906Assert.Equal(149, response.Usage.OutputTokenCount); 2721Assert.Equal(50, response.Usage.OutputTokenCount); 4356Assert.Equal(25, response.Usage.OutputTokenCount); 4975Assert.Equal(0, usage.Details.OutputTokenCount);
Microsoft.Extensions.AI.Tests (6)
ChatCompletion\DistributedCachingChatClientTest.cs (4)
793Assert.Equal(expected.Usage?.OutputTokenCount, actual.Usage?.OutputTokenCount); 865Assert.Equal(expectedUsage.Details.OutputTokenCount, actualUsage.Details.OutputTokenCount);
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (1)
912Assert.Equal(expectedTotalTokenCounts, actualUsage.OutputTokenCount);
ChatCompletion\FunctionInvokingChatClientTests.cs (1)
1294Assert.Equal(expectedTotalTokenCounts, actualUsage.OutputTokenCount);