12 instantiations of UsageContent
Microsoft.Extensions.AI.Abstractions (1)
ChatCompletion\ChatCompletion.cs (1)
124extra.Contents.Add(new UsageContent(usage));
Microsoft.Extensions.AI.Abstractions.Tests (7)
ChatCompletion\StreamingChatCompletionUpdateExtensionsTests.cs (3)
50new() { ChoiceIndex = 0, Contents = new[] { new UsageContent(new() { InputTokenCount = 1, OutputTokenCount = 2 }) } }, 51new() { ChoiceIndex = 3, Contents = new[] { new UsageContent(new() { InputTokenCount = 4, OutputTokenCount = 5 }) } }, 199new() { Contents = [new UsageContent(new() { TotalTokenCount = 42 })] },
Contents\UsageContentTests.cs (4)
14Assert.Throws<ArgumentNullException>("details", () => new UsageContent(null!)); 20UsageContent c = new(); 37UsageContent c = new(details); 51UsageContent c = new();
Microsoft.Extensions.AI.AzureAIInference (1)
AzureAIInferenceChatClient.cs (1)
218completionUpdate.Contents.Add(new UsageContent(new()
Microsoft.Extensions.AI.Ollama (1)
OllamaChatClient.cs (1)
173update.Contents.Add(new UsageContent(usage));
Microsoft.Extensions.AI.OpenAI.Tests (1)
OpenAISerializationTests.cs (1)
591contents.Add(new UsageContent(usageDetails));
Microsoft.Extensions.AI.Tests (1)
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
85Contents = [new UsageContent(new()
18 references to UsageContent
Microsoft.Extensions.AI.Abstractions (4)
ChatCompletion\StreamingChatCompletionUpdateExtensions.cs (1)
186if (content is UsageContent c)
Contents\AIContent.cs (1)
16[JsonDerivedType(typeof(UsageContent), typeDiscriminator: "usage")]
Contents\UsageContent.cs (2)
19/// <summary>Initializes a new instance of the <see cref="UsageContent"/> class with an empty <see cref="UsageDetails"/>.</summary> 25/// <summary>Initializes a new instance of the <see cref="UsageContent"/> class with the specified <see cref="UsageDetails"/> instance.</summary>
Microsoft.Extensions.AI.Abstractions.Tests (5)
ChatCompletion\ChatCompletionTests.cs (1)
295Assert.Equal(123, Assert.IsType<UsageContent>(Assert.Single(update2.Contents)).Details.TotalTokenCount);
ChatCompletion\StreamingChatCompletionUpdateExtensionsTests.cs (1)
67Assert.Same(Assert.IsType<UsageContent>(updates[6].Contents[0]).Details, completion.Usage);
Contents\UsageContentTests.cs (3)
20UsageContent c = new(); 37UsageContent c = new(details); 51UsageContent c = new();
Microsoft.Extensions.AI.Integration.Tests (2)
ChatClientIntegrationTests.cs (2)
131UsageContent usage = chunks.SelectMany(c => c.Contents).OfType<UsageContent>().Single();
Microsoft.Extensions.AI.Ollama.Tests (2)
OllamaChatClientTests.cs (2)
198UsageContent usage = Assert.IsType<UsageContent>(updates[updates.Count - 1].Contents[1]);
Microsoft.Extensions.AI.OpenAI (1)
OpenAIModelMappers.StreamingChatCompletion.cs (1)
42else if (content is UsageContent usageContent)
Microsoft.Extensions.AI.OpenAI.Tests (4)
OpenAIChatClientTests.cs (4)
280UsageContent usage = updates.SelectMany(u => u.Contents).OfType<UsageContent>().Single(); 875UsageContent usage = updates.SelectMany(u => u.Contents).OfType<UsageContent>().Single();