2 writes to Details
Microsoft.Extensions.AI.Abstractions.Tests (2)
Contents\UsageContentTests.cs (2)
45
c.
Details
= details2;
57
Assert.Throws<ArgumentNullException>("value", () => c.
Details
= null!);
58 references to Details
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvokingChatClient.cs (1)
509
totalUsage.Add(uc.
Details
);
Microsoft.Extensions.AI.Abstractions (2)
ChatCompletion\ChatResponseExtensions.cs (1)
544
(response.Usage ??= new()).Add(usage.
Details
);
SpeechToText\SpeechToTextResponseUpdateExtensions.cs (1)
100
(response.Usage ??= new()).Add(usage.
Details
);
Microsoft.Extensions.AI.Abstractions.Tests (21)
Contents\UsageContentTests.cs (18)
25
Assert.NotNull(c.
Details
);
26
Assert.Same(c.
Details
, c.
Details
);
27
Assert.Null(c.
Details
.InputTokenCount);
28
Assert.Null(c.
Details
.OutputTokenCount);
29
Assert.Null(c.
Details
.TotalTokenCount);
30
Assert.Null(c.
Details
.AdditionalCounts);
42
Assert.Same(details, c.
Details
);
46
Assert.Same(details2, c.
Details
);
54
UsageDetails d = c.
Details
;
59
Assert.Same(d, c.
Details
);
76
Assert.NotNull(deserializedContent.
Details
);
77
Assert.Equal(content.
Details
.InputTokenCount, deserializedContent.
Details
.InputTokenCount);
78
Assert.Equal(content.
Details
.OutputTokenCount, deserializedContent.
Details
.OutputTokenCount);
79
Assert.Equal(content.
Details
.TotalTokenCount, deserializedContent.
Details
.TotalTokenCount);
SpeechToText\SpeechToTextResponseTests.cs (3)
247
Assert.Equal(100, usage.
Details
.InputTokenCount);
248
Assert.Equal(200, usage.
Details
.OutputTokenCount);
249
Assert.Equal(300, usage.
Details
.TotalTokenCount);
Microsoft.Extensions.AI.Integration.Tests (5)
ChatClientIntegrationTests.cs (5)
160
Assert.True(usage.
Details
.InputTokenCount > 1);
161
Assert.True(usage.
Details
.OutputTokenCount > 1);
162
Assert.Equal(usage.
Details
.InputTokenCount + usage.
Details
.OutputTokenCount, usage.
Details
.TotalTokenCount);
Microsoft.Extensions.AI.OpenAI (3)
MicrosoftExtensionsAIChatExtensions.cs (3)
145
(int?)usageContent.
Details
.OutputTokenCount ?? 0,
146
(int?)usageContent.
Details
.InputTokenCount ?? 0,
147
(int?)usageContent.
Details
.TotalTokenCount ?? 0) :
Microsoft.Extensions.AI.OpenAI.Tests (20)
OpenAIChatClientTests.cs (8)
258
Assert.Equal(8, usage.
Details
.InputTokenCount);
259
Assert.Equal(9, usage.
Details
.OutputTokenCount);
260
Assert.Equal(17, usage.
Details
.TotalTokenCount);
270
}, usage.
Details
.AdditionalCounts);
1351
Assert.Equal(61, usage.
Details
.InputTokenCount);
1352
Assert.Equal(16, usage.
Details
.OutputTokenCount);
1353
Assert.Equal(77, usage.
Details
.TotalTokenCount);
1363
}, usage.
Details
.AdditionalCounts);
OpenAIResponseClientTests.cs (12)
349
Assert.Equal(17, usage.
Details
.InputTokenCount);
350
Assert.Equal(122, usage.
Details
.OutputTokenCount);
351
Assert.Equal(139, usage.
Details
.TotalTokenCount);
476
Assert.Equal(10, usage.
Details
.InputTokenCount);
477
Assert.Equal(25, usage.
Details
.OutputTokenCount);
478
Assert.Equal(35, usage.
Details
.TotalTokenCount);
591
Assert.Equal(26, usage.
Details
.InputTokenCount);
592
Assert.Equal(10, usage.
Details
.OutputTokenCount);
593
Assert.Equal(36, usage.
Details
.TotalTokenCount);
4974
Assert.Equal(15, usage.
Details
.InputTokenCount);
4975
Assert.Equal(0, usage.
Details
.OutputTokenCount);
4976
Assert.Equal(15, usage.
Details
.TotalTokenCount);
Microsoft.Extensions.AI.Tests (6)
ChatCompletion\DistributedCachingChatClientTest.cs (6)
864
Assert.Equal(expectedUsage.
Details
.InputTokenCount, actualUsage.
Details
.InputTokenCount);
865
Assert.Equal(expectedUsage.
Details
.OutputTokenCount, actualUsage.
Details
.OutputTokenCount);
866
Assert.Equal(expectedUsage.
Details
.TotalTokenCount, actualUsage.
Details
.TotalTokenCount);