67 writes to Contents
Microsoft.Extensions.AI (3)
Microsoft.Extensions.AI.Abstractions (2)
Microsoft.Extensions.AI.Abstractions.Tests (43)
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (37)
35new() { Contents = [new UsageContent(new() { InputTokenCount = 1, OutputTokenCount = 2 })] },
36new() { Contents = [new UsageContent(new() { InputTokenCount = 4, OutputTokenCount = 5 })] },
577updates.Add(new() { Contents = [new DataContent("data:image/png;base64,aGVsbG8=")] });
607new() { Contents = [new TextReasoningContent("D")] },
608new() { Contents = [new TextReasoningContent("E")] },
609new() { Contents = [new TextReasoningContent("F")] },
612new() { Contents = [new TextReasoningContent("I")] },
613new() { Contents = [new TextReasoningContent("J")] },
615new() { Contents = [new TextReasoningContent("L")] },
618new() { Contents = [new TextReasoningContent("O")] },
619new() { Contents = [new TextReasoningContent("P")] },
642new() { Contents = [new TextReasoningContent("A") { ProtectedData = "1" }] },
643new() { Contents = [new TextReasoningContent("B") { ProtectedData = "2" }] },
644new() { Contents = [new TextReasoningContent("C")] },
645new() { Contents = [new TextReasoningContent("D")] },
646new() { Contents = [new TextReasoningContent("E") { ProtectedData = "3" }] },
647new() { Contents = [new TextReasoningContent("F") { ProtectedData = "4" }] },
648new() { Contents = [new TextReasoningContent("G")] },
649new() { Contents = [new TextReasoningContent("H")] },
682new() { Contents = [new TextContent("D") { Annotations = [new()] }] },
683new() { Contents = [new TextContent("E") { Annotations = [new()] }] },
684new() { Contents = [new TextContent("F") { Annotations = [new()] }] },
685new() { Contents = [new TextContent("G") { Annotations = [] }] },
686new() { Contents = [new TextContent("H") { Annotations = [] }] },
687new() { Contents = [new TextContent("I") { Annotations = [new()] }] },
688new() { Contents = [new TextContent("J") { Annotations = [new()] }] },
690new() { Contents = [new TextContent("L") { Annotations = [new()] }] },
693new() { Contents = [new TextContent("O") { Annotations = [new()] }] },
694new() { Contents = [new TextContent("P") { Annotations = [new()] }] },
721new() { Contents = [new UsageContent(new() { TotalTokenCount = 42 })] },
843new() { Contents = [new ImageGenerationToolResultContent { ImageId = "img1", Outputs = [image1] }] },
846new() { Contents = [new ImageGenerationToolResultContent { ImageId = "img2", Outputs = [image2] }] },
849new() { Contents = [new ImageGenerationToolResultContent { ImageId = "img1", Outputs = [image3] }] },
852new() { Contents = [new ImageGenerationToolResultContent { ImageId = "img2", Outputs = [image4] }] },
897new() { Contents = [new ImageGenerationToolResultContent { ImageId = null, Outputs = [image1] }] },
900new() { Contents = [new ImageGenerationToolResultContent { ImageId = "", Outputs = [image2] }] },
903new() { Contents = [new ImageGenerationToolResultContent { ImageId = null, Outputs = [image3] }] },
Microsoft.Extensions.AI.OpenAI.Tests (1)
Microsoft.Extensions.AI.Tests (18)
ChatCompletion\DistributedCachingChatClientTest.cs (8)
252Contents =
265Contents = [new FunctionCallContent("someCallId", "someFn", new Dictionary<string, object?> { ["arg1"] = "value1" })],
269Contents = [new UsageContent(new() { InputTokenCount = 123, OutputTokenCount = 456, TotalTokenCount = 99999 })],
315new() { Role = ChatRole.Assistant, Contents = [new FunctionCallContent("callId1", "separator")] },
368new() { Role = ChatRole.Assistant, Contents = [new TextContent("Hello")] },
369new() { Role = ChatRole.Assistant, Contents = [new TextContent(" world, ")] },
373Contents =
384Contents =
115 references to Contents
Aspire.Dashboard (3)
Microsoft.Extensions.AI (5)
Microsoft.Extensions.AI.Abstractions (6)
Microsoft.Extensions.AI.Abstractions.Tests (31)
ChatCompletion\ChatResponseUpdateTests.cs (31)
20Assert.Empty(update.Contents);
43Assert.Empty(update.Contents);
44update.Contents.Add(new TextContent("text"));
45Assert.Single(update.Contents);
47Assert.Same(update.Contents, update.Contents);
50Assert.Same(newList, update.Contents);
52Assert.NotNull(update.Contents);
53Assert.Empty(update.Contents);
101TextContent textContent = Assert.IsType<TextContent>(update.Contents[3]);
106((TextContent)update.Contents[3]).Text = "text-3";
108Assert.Same(textContent, update.Contents[3]);
140Assert.Equal(5, result.Contents.Count);
142Assert.IsType<TextContent>(result.Contents[0]);
143Assert.Equal("text-1", ((TextContent)result.Contents[0]).Text);
145Assert.IsType<DataContent>(result.Contents[1]);
146Assert.Equal("data:image/png;base64,aGVsbG8=", ((DataContent)result.Contents[1]).Uri);
148Assert.IsType<FunctionCallContent>(result.Contents[2]);
149Assert.Equal("fc1", ((FunctionCallContent)result.Contents[2]).Name);
151Assert.IsType<DataContent>(result.Contents[3]);
152Assert.Equal("data"u8.ToArray(), ((DataContent)result.Contents[3]).Data.ToArray());
154Assert.IsType<TextContent>(result.Contents[4]);
155Assert.Equal("text-2", ((TextContent)result.Contents[4]).Text);
213Assert.Same(original.Contents, clone.Contents);
242Assert.Empty(clone.Contents); // Contents property initializes to empty list
258Assert.Empty(clone.Contents);
323Assert.Same(original.Contents, clone.Contents);
326Assert.Equal(2, original.Contents.Count);
327Assert.Equal(2, clone.Contents.Count);
Microsoft.Extensions.AI.AzureAIInference (3)
Microsoft.Extensions.AI.AzureAIInference.Tests (2)
Microsoft.Extensions.AI.Integration.Tests (1)
Microsoft.Extensions.AI.OpenAI (15)
Microsoft.Extensions.AI.OpenAI.Tests (33)
Microsoft.Extensions.AI.Tests (16)