24 instantiations of UriContent
Microsoft.Extensions.AI.Abstractions.Tests (17)
Contents\UriContentTests.cs (17)
15Assert.Throws<ArgumentNullException>("uri", () => new UriContent((string)null!, "image/png")); 16Assert.Throws<ArgumentNullException>("uri", () => new UriContent((Uri)null!, "image/png")); 17Assert.Throws<UriFormatException>(() => new UriContent("notauri", "image/png")); 19Assert.Throws<ArgumentNullException>("mediaType", () => new UriContent("data:image/png;base64,aGVsbG8=", null!)); 20Assert.Throws<ArgumentException>("mediaType", () => new UriContent("data:image/png;base64,aGVsbG8=", "")); 21Assert.Throws<ArgumentException>("mediaType", () => new UriContent("data:image/png;base64,aGVsbG8=", "image")); 23Assert.Throws<ArgumentNullException>("mediaType", () => new UriContent(new Uri("data:image/png;base64,aGVsbG8="), null!)); 24Assert.Throws<ArgumentException>("mediaType", () => new UriContent(new Uri("data:image/png;base64,aGVsbG8="), "")); 25Assert.Throws<ArgumentException>("mediaType", () => new UriContent(new Uri("data:image/png;base64,aGVsbG8="), "audio")); 27UriContent c = new("http://localhost/something", "image/png"); 40Assert.Throws<ArgumentException>("mediaType", () => new UriContent("http://localhost/something", type)); 42UriContent c = new("http://localhost/something", "image/png"); 54var content = new UriContent("http://localhost/something", mediaType); 70new UriContent("http://localhost/something", "image/png"), 101UriContent c = new("http://localhost", mediaType); 114var content = new UriContent("http://localhost", mediaType); 127var content = new UriContent("http://localhost", mediaType);
Microsoft.Extensions.AI.AzureAIInference.Tests (1)
AzureAIInferenceChatClientTests.cs (1)
597new UriContent("http://dot.net/someimage.png", mediaType: "image/*"),
Microsoft.Extensions.AI.Evaluation.Integration.Tests (4)
SafetyEvaluatorTests.cs (4)
229new UriContent("https://uhf.microsoft.com/images/microsoft/RE1Mu3b.png", "image/png")], 296new UriContent("https://uhf.microsoft.com/images/banners/RW1iGSh.png", "image/png")], 323new UriContent("https://uhf.microsoft.com/images/microsoft/RE1Mu3b.png", "image/png")], 336new UriContent("https://uhf.microsoft.com/images/banners/RW1iGSh.png", "image/png")],
Microsoft.Extensions.AI.OpenAI (1)
OpenAIChatClient.cs (1)
699contentPart.ImageUri is not null ? new UriContent(contentPart.ImageUri, "image/*") :
Microsoft.Extensions.AI.Tests (1)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (1)
238var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, [new UriContent("https://example.com", "image/*")]));
16 references to UriContent
Microsoft.Extensions.AI.Abstractions (4)
Contents\AIContent.cs (1)
16[JsonDerivedType(typeof(UriContent), typeDiscriminator: "uri")]
Contents\DataContent.cs (1)
21/// The content represents in-memory data. For references to data at a remote URI, use <see cref="UriContent"/> instead.
Contents\UriContent.cs (2)
27/// <summary>Initializes a new instance of the <see cref="UriContent"/> class.</summary> 44/// <summary>Initializes a new instance of the <see cref="UriContent"/> class.</summary>
Microsoft.Extensions.AI.Abstractions.Tests (6)
Contents\UriContentTests.cs (6)
27UriContent c = new("http://localhost/something", "image/png"); 42UriContent c = new("http://localhost/something", "image/png"); 54var content = new UriContent("http://localhost/something", mediaType); 101UriContent c = new("http://localhost", mediaType); 114var content = new UriContent("http://localhost", mediaType); 127var content = new UriContent("http://localhost", mediaType);
Microsoft.Extensions.AI.AzureAIInference (2)
AzureAIInferenceChatClient.cs (2)
498case UriContent uriContent when uriContent.HasTopLevelMediaType("image"): 506case UriContent uriContent when uriContent.HasTopLevelMediaType("audio"):
Microsoft.Extensions.AI.Evaluation (1)
EvaluationContext.cs (1)
23/// <see cref="TextContent"/> objects for text, <see cref="DataContent"/> or <see cref="UriContent"/> objects for
Microsoft.Extensions.AI.Evaluation.Safety (1)
AIContentExtensions.cs (1)
13(content is UriContent uriContent && IsSupportedImageFormat(uriContent.MediaType)) ||
Microsoft.Extensions.AI.OpenAI (2)
OpenAIChatClient.cs (1)
192case UriContent uriContent when uriContent.HasTopLevelMediaType("image"):
OpenAIResponseChatClient.cs (1)
568case UriContent uriContent when uriContent.HasTopLevelMediaType("image"):