2 writes to Details
Microsoft.Extensions.AI.Abstractions.Tests (2)
Contents\UsageContentTests.cs (2)
44
c.
Details
= details2;
56
Assert.Throws<ArgumentNullException>("value", () => c.
Details
= null!);
33 references to Details
Microsoft.Extensions.AI.Abstractions (1)
ChatCompletion\StreamingChatCompletionUpdateExtensions.cs (1)
172
completion.Usage = c.
Details
;
Microsoft.Extensions.AI.Abstractions.Tests (13)
ChatCompletion\ChatCompletionTests.cs (1)
295
Assert.Equal(123, Assert.IsType<UsageContent>(Assert.Single(update2.Contents)).
Details
.TotalTokenCount);
ChatCompletion\StreamingChatCompletionUpdateExtensionsTests.cs (1)
67
Assert.Same(Assert.IsType<UsageContent>(updates[6].Contents[0]).
Details
, completion.Usage);
Contents\UsageContentTests.cs (11)
24
Assert.NotNull(c.
Details
);
25
Assert.Same(c.
Details
, c.
Details
);
26
Assert.Null(c.
Details
.InputTokenCount);
27
Assert.Null(c.
Details
.OutputTokenCount);
28
Assert.Null(c.
Details
.TotalTokenCount);
29
Assert.Null(c.
Details
.AdditionalProperties);
41
Assert.Same(details, c.
Details
);
45
Assert.Same(details2, c.
Details
);
53
UsageDetails d = c.
Details
;
58
Assert.Same(d, c.
Details
);
Microsoft.Extensions.AI.Integration.Tests (6)
ChatClientIntegrationTests.cs (6)
133
Assert.True(usage.
Details
.InputTokenCount > 1);
134
Assert.True(usage.
Details
.OutputTokenCount > 1);
135
Assert.Equal(usage.
Details
.InputTokenCount + usage.
Details
.OutputTokenCount, usage.
Details
.TotalTokenCount);
185
Assert.True(finalUsage.TotalTokenCount > intermediate.
Details
.TotalTokenCount);
Microsoft.Extensions.AI.Ollama.Tests (3)
OllamaChatClientTests.cs (3)
199
Assert.Equal(11, usage.
Details
.InputTokenCount);
200
Assert.Equal(20, usage.
Details
.OutputTokenCount);
201
Assert.Equal(31, usage.
Details
.TotalTokenCount);
Microsoft.Extensions.AI.OpenAI.Tests (10)
OpenAIChatClientTests.cs (10)
275
Assert.Equal(8, usage.
Details
.InputTokenCount);
276
Assert.Equal(9, usage.
Details
.OutputTokenCount);
277
Assert.Equal(17, usage.
Details
.TotalTokenCount);
278
Assert.NotNull(usage.
Details
.AdditionalProperties);
279
Assert.Equal(new Dictionary<string, object> { [nameof(ChatOutputTokenUsageDetails.ReasoningTokenCount)] = 0 }, usage.
Details
.AdditionalProperties[nameof(ChatTokenUsage.OutputTokenDetails)]);
782
Assert.Equal(61, usage.
Details
.InputTokenCount);
783
Assert.Equal(16, usage.
Details
.OutputTokenCount);
784
Assert.Equal(77, usage.
Details
.TotalTokenCount);
785
Assert.NotNull(usage.
Details
.AdditionalProperties);
786
Assert.Equal(new Dictionary<string, object> { [nameof(ChatOutputTokenUsageDetails.ReasoningTokenCount)] = 0 }, usage.
Details
.AdditionalProperties[nameof(ChatTokenUsage.OutputTokenDetails)]);