144 references to DataContent
Microsoft.Extensions.AI.Abstractions (4)
Microsoft.Extensions.AI.Abstractions.Tests (74)
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (7)
923var image1 = new DataContent((byte[])[1, 2, 3, 4], "image/png") { Name = "image1.png" };
924var image2 = new DataContent((byte[])[5, 6, 7, 8], "image/jpeg") { Name = "image2.jpg" };
925var image3 = new DataContent((byte[])[9, 10, 11, 12], "image/png") { Name = "image3.png" };
926var image4 = new DataContent((byte[])[13, 14, 15, 16], "image/gif") { Name = "image4.gif" };
981var image1 = new DataContent((byte[])[1, 2, 3, 4], "image/png") { Name = "image1.png" };
982var image2 = new DataContent((byte[])[5, 6, 7, 8], "image/jpeg") { Name = "image2.jpg" };
983var image3 = new DataContent((byte[])[9, 10, 11, 12], "image/png") { Name = "image3.png" };
Contents\DataContentTests.cs (20)
87content = new DataContent(new byte[] { 0, 1, 2 }, mediaType);
153new DataContent(new ReadOnlyMemory<byte>([0x01, 0x02, 0x03, 0x04]), "application/octet-stream"),
159new DataContent(new ReadOnlyMemory<byte>([0x01, 0x02, 0x03, 0x04]), "application/octet-stream") { Name = "test.bin" },
287var content = new DataContent(data, "application/octet-stream");
306DataContent content = new(new byte[] { 1, 2, 3 }, "application/octet-stream");
457DataContent content = new(testData, "application/octet-stream");
484DataContent content = new(testData, "application/json");
511DataContent content = new(testData, "application/json")
543DataContent content = new(testData, "application/json");
572DataContent content = new(testData, "application/json");
598DataContent content = new(testData, "application/json");
628DataContent content = new(testData, "image/png") { Name = "myimage.png" };
657DataContent content = new(testData, "text/plain") { Name = $"testfile_{Guid.NewGuid()}.txt" };
702DataContent content = new(new byte[] { 1 }, "application/octet-stream");
739DataContent content = new(testData, "text/css");
796DataContent content = new(new byte[] { 1, 2, 3 }, "application/octet-stream");
836DataContent content = new(testData, "application/json")
867DataContent content = new(testData, "application/json");
925DataContent content = new(testData, "application/octet-stream");
958DataContent content = new(newContent, "application/octet-stream");
Contents\ImageGenerationToolResultContentTests.cs (5)
31IList<AIContent> outputs = [new DataContent(new byte[] { 1, 2, 3 }, "image/png")];
53new DataContent(new byte[] { 1, 2, 3 }, "image/png"),
55new DataContent(new byte[] { 4, 5, 6 }, "image/gif")
73new DataContent(new byte[] { 1, 2, 3 }, "image/png"),
98new DataContent(new byte[] { 7, 8, 9 }, "image/png"),
Image\ImageGenerationResponseTests.cs (3)
74new DataContent(imageData, "image/jpeg")
100new DataContent((byte[])[1, 2, 3, 4], "image/jpeg")
138new DataContent((byte[])[255, 216, 255, 224], "image/jpeg"),
Realtime\RealtimeClientMessageTests.cs (4)
76var audioContent = new DataContent(new byte[] { 1, 2, 3 }, "audio/pcm");
85var audioContent = new DataContent(new byte[] { 1, 2, 3 }, "audio/pcm");
88var newContent = new DataContent(new byte[] { 4, 5, 6 }, "audio/wav");
97var audioContent = new DataContent(new byte[] { 1, 2, 3 }, "audio/pcm");
TextToSpeech\TextToSpeechResponseTests.cs (6)
41content.Add(new DataContent(new byte[] { (byte)i }, "audio/mpeg"));
84List<AIContent> newContents = [new DataContent(new byte[] { 1 }, "audio/mpeg"), new DataContent(new byte[] { 2 }, "audio/mpeg")];
101new DataContent(new byte[] { 1, 2, 3 }, "audio/mpeg"),
142new DataContent(new byte[] { 1, 2, 3 }, "audio/mpeg"),
143new DataContent(new byte[] { 4, 5, 6 }, "audio/wav"),
TextToSpeech\TextToSpeechResponseUpdateExtensionsTests.cs (5)
26new([new DataContent(new byte[] { 1 }, "audio/mpeg")]) { ModelId = "model123", AdditionalProperties = new() { ["a"] = "b" } },
27new([new DataContent(new byte[] { 2 }, "audio/mpeg")]) { ModelId = "model123" },
28new([new DataContent(new byte[] { 3 }, "audio/mpeg")]) { ModelId = "model123", AdditionalProperties = new() { ["c"] = "d" } },
57new() { Contents = [new DataContent(new byte[] { 1 }, "audio/mpeg")] },
59new() { Contents = [new DataContent(new byte[] { 2 }, "audio/mpeg")] },
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (1)
Microsoft.Extensions.AI.Integration.Tests (4)
Microsoft.Extensions.AI.OpenAI (14)
Microsoft.Extensions.AI.OpenAI.Tests (9)
OpenAIResponseClientTests.cs (5)
4942new FunctionResultContent("call_789", new DataContent(imageData, "image/png"))
5178new FunctionResultContent("call_pdf", new DataContent(pdfData, "application/pdf") { Name = "report.pdf" })
5573new DataContent(imageData, "image/png"),
5574new DataContent(imageData, "image/png") { AdditionalProperties = new AdditionalPropertiesDictionary { ["detail"] = ResponseImageDetailLevel.Low }},
5575new DataContent(pdfData, "application/pdf") { Name = "doc.pdf" },
Microsoft.Extensions.AI.Stabilization.Tests (8)
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\ImageGenerationToolResultContentTests.cs (5)
31IList<AIContent> outputs = [new DataContent(new byte[] { 1, 2, 3 }, "image/png")];
53new DataContent(new byte[] { 1, 2, 3 }, "image/png"),
55new DataContent(new byte[] { 4, 5, 6 }, "image/gif")
73new DataContent(new byte[] { 1, 2, 3 }, "image/png"),
98new DataContent(new byte[] { 7, 8, 9 }, "image/png"),
Microsoft.Extensions.AI.Tests (28)
Functions\AIFunctionFactoryTest.cs (15)
1172AIFunctionFactory.Create(() => new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")),
1173AIFunctionFactory.Create(async () => new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")),
1174AIFunctionFactory.Create(async ValueTask<DataContent> () => new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")),
1179AIFunctionFactory.Create(() => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1180AIFunctionFactory.Create(async () => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1181AIFunctionFactory.Create(async ValueTask<IEnumerable<AIContent>> () => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1186AIFunctionFactory.Create(() => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1187AIFunctionFactory.Create(async () => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1188AIFunctionFactory.Create(async ValueTask<AIContent[]> () => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1193AIFunctionFactory.Create(() => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1194AIFunctionFactory.Create(async () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1195AIFunctionFactory.Create(async ValueTask<List<AIContent>> () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1200AIFunctionFactory.Create(() => (IList<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1201AIFunctionFactory.Create(async () => (IList<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1202AIFunctionFactory.Create(async ValueTask<IList<AIContent>> () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
Microsoft.Extensions.DataIngestion (1)
Microsoft.Extensions.DataIngestion.Tests (1)