42 instantiations of DataContent
Microsoft.Extensions.AI.Abstractions.Tests (34)
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 (16)
46Assert.Throws(exception, () => new DataContent(path));
58Assert.Throws<ArgumentException>("mediaType", () => new DataContent("data:image/png;base64,aGVsbG8=", type));
68var content = new DataContent("data:image/png;base64,aGVsbG8=", mediaType);
72content = new DataContent("data:,", mediaType);
76content = new DataContent("data:text/plain,", mediaType);
80content = new DataContent(new Uri("data:text/plain,"), mediaType);
84content = new DataContent(new byte[] { 0, 1, 2 }, mediaType);
88content = new DataContent(content.Uri);
98content = new DataContent("data:image/png;base64,aGVsbG8=");
103content = new DataContent(new Uri("data:image/png;base64,aGVsbG8="));
114JsonSerializer.Serialize(new DataContent(
209DataContent c = new("data:,", mediaType);
222var content = new DataContent("data:application/octet-stream;base64,AQIDBA==", mediaType);
235var content = new DataContent("data:application/octet-stream;base64,AQIDBA==", mediaType);
248var content = new DataContent(data, "application/octet-stream");
258var content = new DataContent("data:text/plain,hello world");
Microsoft.Extensions.AI.AzureAIInference.Tests (1)
Microsoft.Extensions.AI.Evaluation.Integration.Tests (2)
Microsoft.Extensions.AI.Integration.Tests (2)
Microsoft.Extensions.AI.OpenAI (2)
Microsoft.Extensions.AI.OpenAI.Tests (1)
61 references to DataContent
Microsoft.Extensions.AI.Abstractions (10)
Microsoft.Extensions.AI.Abstractions.Tests (26)
Contents\DataContentTests.cs (14)
68var content = new DataContent("data:image/png;base64,aGVsbG8=", mediaType);
96DataContent content;
129Assert.Throws<ArgumentNullException>("uri", () => JsonSerializer.Deserialize<DataContent>(json, TestJsonSerializerContext.Default.Options)!);
136var content = JsonSerializer.Deserialize<DataContent>("""{"uri":"data:application/octet-stream;base64,AQIDBA=="}""", TestJsonSerializerContext.Default.Options)!;
144content = JsonSerializer.Deserialize<DataContent>("""{"uri":"data:application/octet-stream;base64,AQIDBA=="}""", TestJsonSerializerContext.Default.Options)!;
150content = JsonSerializer.Deserialize<DataContent>("""
177var content = JsonSerializer.Deserialize<DataContent>(serialized, TestJsonSerializerContext.Default.Options)!;
209DataContent c = new("data:,", mediaType);
222var content = new DataContent("data:application/octet-stream;base64,AQIDBA==", mediaType);
235var content = new DataContent("data:application/octet-stream;base64,AQIDBA==", mediaType);
248var content = new DataContent(data, "application/octet-stream");
258var content = new DataContent("data:text/plain,hello world");
Microsoft.Extensions.AI.AzureAIInference (6)
Microsoft.Extensions.AI.AzureAIInference.Tests (10)
AzureAIInferenceImageEmbeddingGeneratorTests.cs (10)
39IEmbeddingGenerator<DataContent, Embedding<float>> embeddingGenerator = client.AsIEmbeddingGenerator(model);
52Assert.Same(embeddingGenerator, embeddingGenerator.GetService<IEmbeddingGenerator<DataContent, Embedding<float>>>());
55using IEmbeddingGenerator<DataContent, Embedding<float>> pipeline = embeddingGenerator
61Assert.NotNull(pipeline.GetService<DistributedCachingEmbeddingGenerator<DataContent, Embedding<float>>>());
62Assert.NotNull(pipeline.GetService<CachingEmbeddingGenerator<DataContent, Embedding<float>>>());
63Assert.NotNull(pipeline.GetService<OpenTelemetryEmbeddingGenerator<DataContent, Embedding<float>>>());
66Assert.IsType<OpenTelemetryEmbeddingGenerator<DataContent, Embedding<float>>>(pipeline.GetService<IEmbeddingGenerator<DataContent, Embedding<float>>>());
72DataContent dotnetPng = new(ImageDataUri.GetImageDataUri());
106using IEmbeddingGenerator<DataContent, Embedding<float>> generator = new ImageEmbeddingsClient(
Microsoft.Extensions.AI.Evaluation (1)
Microsoft.Extensions.AI.Evaluation.Safety (1)
Microsoft.Extensions.AI.Ollama (1)
Microsoft.Extensions.AI.OpenAI (6)