26 instantiations of DataContent
Microsoft.Extensions.AI.Abstractions.Tests (22)
ChatCompletion\ChatMessageTests.cs (4)
144new DataContent("data:text/image;base64,aGVsbG8="),
145new DataContent("data:text/plain;base64,aGVsbG8="),
243new DataContent(new Uri("data:text/plain;base64,aGVsbG8="), "mime-type/2")
247new DataContent(new BinaryData(new[] { 1, 2, 3 }, options: TestJsonSerializerContext.Default.Options), "mime-type/3")
Contents\DataContentTests.cs (14)
45Assert.Throws(exception, () => new DataContent(path));
57Assert.Throws<ArgumentException>("mediaType", () => new DataContent("data:image/png;base64,aGVsbG8=", type));
67var content = new DataContent("data:image/png;base64,aGVsbG8=", mediaType);
70content = new DataContent("data:,", mediaType);
73content = new DataContent("data:text/plain,", mediaType);
76content = new DataContent(new Uri("data:text/plain,"), mediaType);
79content = new DataContent(new byte[] { 0, 1, 2 }, mediaType);
82content = new DataContent(content.Uri);
91content = new DataContent("data:image/png;base64,aGVsbG8=");
95content = new DataContent(new Uri("data:image/png;base64,aGVsbG8="));
105JsonSerializer.Serialize(new DataContent(
198DataContent c = new("data:,", mediaType);
211var content = new DataContent("data:application/octet-stream;base64,AQIDBA==", mediaType);
224var content = new DataContent("data:application/octet-stream;base64,AQIDBA==", mediaType);
Microsoft.Extensions.AI.Integration.Tests (1)
Microsoft.Extensions.AI.OpenAI (3)
32 references to DataContent
Microsoft.Extensions.AI.Abstractions (6)
Microsoft.Extensions.AI.Abstractions.Tests (19)
Contents\DataContentTests.cs (12)
67var content = new DataContent("data:image/png;base64,aGVsbG8=", mediaType);
89DataContent content;
120Assert.Throws<ArgumentNullException>("uri", () => JsonSerializer.Deserialize<DataContent>(json, TestJsonSerializerContext.Default.Options)!);
127var content = JsonSerializer.Deserialize<DataContent>("""{"uri":"data:application/octet-stream;base64,AQIDBA=="}""", TestJsonSerializerContext.Default.Options)!;
134content = JsonSerializer.Deserialize<DataContent>("""{"uri":"data:application/octet-stream;base64,AQIDBA=="}""", TestJsonSerializerContext.Default.Options)!;
140content = JsonSerializer.Deserialize<DataContent>("""
166var content = JsonSerializer.Deserialize<DataContent>(serialized, TestJsonSerializerContext.Default.Options)!;
198DataContent c = new("data:,", mediaType);
211var content = new DataContent("data:application/octet-stream;base64,AQIDBA==", mediaType);
224var content = new DataContent("data:application/octet-stream;base64,AQIDBA==", mediaType);
Microsoft.Extensions.AI.AzureAIInference (2)
Microsoft.Extensions.AI.Ollama (1)
Microsoft.Extensions.AI.OpenAI (4)