73 references to DataContent
Microsoft.Extensions.AI.Abstractions (2)
ChatCompletion\ChatResponseExtensions.cs (1)
290return new DataContent(new ReadOnlyMemory<byte>(ms.GetBuffer(), 0, (int)ms.Length), first.MediaType) { Name = first.Name };
Image\ImageGeneratorExtensions.cs (1)
195var dataContent = new DataContent(originalImageData, mediaType) { Name = fileName };
Microsoft.Extensions.AI.Abstractions.Tests (25)
ChatCompletion\ChatMessageTests.cs (1)
263new DataContent(new BinaryData(new[] { 1, 2, 3 }, options: TestJsonSerializerContext.Default.Options), "mime-type/3")
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (7)
832var image1 = new DataContent((byte[])[1, 2, 3, 4], "image/png") { Name = "image1.png" }; 833var image2 = new DataContent((byte[])[5, 6, 7, 8], "image/jpeg") { Name = "image2.jpg" }; 834var image3 = new DataContent((byte[])[9, 10, 11, 12], "image/png") { Name = "image3.png" }; 835var image4 = new DataContent((byte[])[13, 14, 15, 16], "image/gif") { Name = "image4.gif" }; 890var image1 = new DataContent((byte[])[1, 2, 3, 4], "image/png") { Name = "image1.png" }; 891var image2 = new DataContent((byte[])[5, 6, 7, 8], "image/jpeg") { Name = "image2.jpg" }; 892var image3 = new DataContent((byte[])[9, 10, 11, 12], "image/png") { Name = "image3.png" };
ChatCompletion\ChatResponseUpdateTests.cs (1)
124new DataContent("data"u8.ToArray(), "text/plain"),
Contents\AIContentTests.cs (1)
65new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream"),
Contents\CodeInterpreterToolCallContentTests.cs (1)
57new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")
Contents\CodeInterpreterToolResultContentTests.cs (1)
57new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream"),
Contents\DataContentTests.cs (5)
84content = new DataContent(new byte[] { 0, 1, 2 }, mediaType); 121new DataContent(new ReadOnlyMemory<byte>([0x01, 0x02, 0x03, 0x04]), "application/octet-stream"), 127new DataContent(new ReadOnlyMemory<byte>([0x01, 0x02, 0x03, 0x04]), "application/octet-stream") { Name = "test.bin" }, 255var content = new DataContent(data, "application/octet-stream"); 274DataContent content = new(new byte[] { 1, 2, 3 }, "application/octet-stream");
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"),
Image\ImageGeneratorExtensionsTests.cs (3)
64var dataContent = new DataContent(imageData, "image/png") { Name = "test.png" }; 92var dataContent = new DataContent(new byte[] { 1, 2, 3 }, "image/png"); 202var dataContent = new DataContent(imageData, "image/png");
Image\ImageGeneratorTests.cs (1)
139AIContent[] originalImages = [new DataContent((byte[])[1, 2, 3, 4], "image/png")];
Tools\HostedCodeInterpreterToolTests.cs (1)
29new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")
Microsoft.Extensions.AI.Integration.Tests (5)
ImageGeneratingChatClientIntegrationTests.cs (3)
159var originalImageData = new DataContent(testImageData, "image/png") { Name = "original.png" }; 375var originalImage = new DataContent(testImageData, "image/png") { Name = "test.png" }; 422var imageContent = new DataContent(imageData, TestImageMediaType)
ImageGeneratorIntegrationTests.cs (1)
96AIContent[] originalImages = [new DataContent(imageData, "image/png") { Name = "dotnet.png" }];
ToolReductionTests.cs (1)
311new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream"),
Microsoft.Extensions.AI.OpenAI (10)
OpenAIAssistantsChatClient.cs (1)
205Inputs = [new DataContent(Encoding.UTF8.GetBytes(details.CodeInterpreterInput), "text/x-python")],
OpenAIChatClient.cs (4)
368responseUpdate.Contents.Add(new DataContent(audioUpdate.AudioBytesUpdate.ToMemory(), GetOutputAudioMimeType(options)) 486returnMessage.Contents.Add(new DataContent(audio.AudioBytes.ToMemory(), GetOutputAudioMimeType(chatCompletionOptions)) 713contentPart.ImageBytes is not null ? new DataContent(contentPart.ImageBytes.ToMemory(), contentPart.ImageBytesMediaType) : 726contentPart.FileBytes is not null ? new DataContent(contentPart.FileBytes.ToMemory(), contentPart.FileBytesMediaType) { Name = contentPart.Filename } :
OpenAIImageGenerator.cs (1)
151contents.Add(new DataContent(image.ImageBytes.ToMemory(), contentType));
OpenAIResponsesChatClient.cs (4)
1148results.Add(new DataContent(part.InputFileBytes, part.InputFileBytesMediaType ?? "application/octet-stream") 1251Inputs = !string.IsNullOrWhiteSpace(cicri.Code) ? [new DataContent(Encoding.UTF8.GetBytes(cicri.Code), "text/x-python")] : null, 1288new DataContent(outputItem.ImageResultBytes, $"image/{outputFormat}") 1304new DataContent(update.PartialImageBytes, $"image/{outputType}")
Microsoft.Extensions.AI.OpenAI.Tests (7)
OpenAIConversionTests.cs (1)
789new DataContent(new byte[] { 1, 2, 3, 4 }, "application/octet-stream")
OpenAIResponseClientIntegrationTests.cs (1)
535new DataContent(imageBytes, "image/png"),
OpenAIResponseClientTests.cs (5)
3782new FunctionResultContent("call_789", new DataContent(imageData, "image/png")) 4018new FunctionResultContent("call_pdf", new DataContent(pdfData, "application/pdf") { Name = "report.pdf" }) 4411new DataContent(imageData, "image/png"), 4412new DataContent(imageData, "image/png") { AdditionalProperties = new AdditionalPropertiesDictionary { ["detail"] = ResponseImageDetailLevel.Low }}, 4413new DataContent(pdfData, "application/pdf") { Name = "doc.pdf" },
Microsoft.Extensions.AI.Tests (20)
ChatCompletion\OpenTelemetryChatClientTests.cs (3)
359new DataContent(Convert.FromBase64String("aGVsbG8gd29ybGQ="), "image/png"), 375yield return new() { Contents = [new DataContent(Convert.FromBase64String("aGVsbG8gd29ybGQ="), "image/png")] }; 395new DataContent(Convert.FromBase64String("ZGF0YSBjb250ZW50"), "audio/mp3"),
Functions\AIFunctionFactoryTest.cs (15)
941AIFunctionFactory.Create(() => new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")), 942AIFunctionFactory.Create(async () => new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")), 943AIFunctionFactory.Create(async ValueTask<DataContent> () => new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")), 948AIFunctionFactory.Create(() => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 949AIFunctionFactory.Create(async () => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 950AIFunctionFactory.Create(async ValueTask<IEnumerable<AIContent>> () => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 955AIFunctionFactory.Create(() => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 956AIFunctionFactory.Create(async () => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 957AIFunctionFactory.Create(async ValueTask<AIContent[]> () => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 962AIFunctionFactory.Create(() => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 963AIFunctionFactory.Create(async () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 964AIFunctionFactory.Create(async ValueTask<List<AIContent>> () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 969AIFunctionFactory.Create(() => (IList<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 970AIFunctionFactory.Create(async () => (IList<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 971AIFunctionFactory.Create(async ValueTask<IList<AIContent>> () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
Image\LoggingImageGeneratorTests.cs (1)
116AIContent[] originalImages = [new DataContent((byte[])[1, 2, 3, 4], "image/png")];
Image\OpenTelemetryImageGeneratorTests.cs (1)
46new DataContent(new byte[] { 1, 2, 3, 4 }, "image/png") { Name = "moreOutput.png" },
Microsoft.Extensions.DataIngestion (1)
Processors\ImageAlternativeTextEnricher.cs (1)
93contents.Add(new DataContent(image.Content!.Value, image.MediaType!));
Microsoft.Extensions.DataIngestion.MarkItDown (2)
MarkItDownMcpReader.cs (2)
58DataContent dataContent = new( 80DataContent dataContent = new(
Microsoft.Extensions.DataIngestion.Tests (1)
IngestionPipelineTests.cs (1)
182content: new(image.Content.GetValueOrDefault(), image.MediaType!),