79 instantiations of UriContent
Microsoft.Extensions.AI.Abstractions (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.UriContent.g.cs (1)
34ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.UriContent((global::System.Uri)args[0], (string)args[1]),
Microsoft.Extensions.AI.Abstractions.Tests (41)
Contents\AIContentTests.cs (1)
70new UriContent("http://example.com", "application/json"),
Contents\ImageGenerationToolResultContentTests.cs (3)
54new UriContent("http://example.com/image.jpg", "image/jpeg"), 74new UriContent("http://example.com/image.jpg", "image/jpeg") 99new UriContent("http://example.com/another.jpg", "image/jpeg")
Contents\UriContentTests.cs (25)
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<ArgumentException>("mediaType", () => new UriContent("data:image/png;base64,aGVsbG8=", "")); 20Assert.Throws<ArgumentException>("mediaType", () => new UriContent("data:image/png;base64,aGVsbG8=", "image")); 22Assert.Throws<ArgumentException>("mediaType", () => new UriContent(new Uri("data:image/png;base64,aGVsbG8="), "")); 23Assert.Throws<ArgumentException>("mediaType", () => new UriContent(new Uri("data:image/png;base64,aGVsbG8="), "audio")); 25UriContent c = new("http://localhost/something", "image/png"); 38Assert.Throws<ArgumentException>("mediaType", () => new UriContent("http://localhost/something", type)); 40UriContent c = new("http://localhost/something", "image/png"); 52var content = new UriContent("http://localhost/something", mediaType); 76var content = new UriContent(uri); 79var content2 = new UriContent(uri, null); 93var content = new UriContent(new Uri(uri)); 96var content2 = new UriContent(new Uri(uri), null); 112var content = new UriContent(new Uri(uri, UriKind.Relative)); 115var content2 = new UriContent(new Uri(uri, UriKind.Relative), null); 127var content = new UriContent(uri); 140var content = new UriContent(new Uri(uri, UriKind.Relative)); 147var content = new UriContent("http://localhost/image.png", "application/octet-stream"); 150var relContent = new UriContent(new Uri("image.png", UriKind.Relative), "application/octet-stream"); 160new UriContent("http://localhost/something", "image/png"), 191UriContent c = new("http://localhost", mediaType); 204var content = new UriContent("http://localhost", mediaType); 217var content = new UriContent("http://localhost", mediaType);
Contents\WebSearchToolResultContentTests.cs (7)
33new UriContent(new Uri("https://example.com/1"), "text/html") { AdditionalProperties = new() { ["title"] = "Result 1" } } 56new UriContent(new Uri("https://example.com/1"), "text/html") { AdditionalProperties = new() { ["title"] = "First" } }, 57new UriContent(new Uri("https://example.com/2"), "text/html") { AdditionalProperties = new() { ["title"] = "Second" } }, 58new UriContent(new Uri("https://example.com/3"), "text/html"), 82new UriContent(new Uri("https://example.com"), "text/html") { AdditionalProperties = new() { ["title"] = "Example Page" } }, 83new UriContent(new Uri("https://another.com"), "text/html"), 110new UriContent(new Uri("https://test.com"), "text/html") { AdditionalProperties = new() { ["title"] = "Test" } },
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestJsonSerializerContext.UriContent.g.cs (1)
32ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.UriContent((global::System.Uri)args[0], (string)args[1]),
Image\ImageGenerationResponseTests.cs (4)
33content.Add(new UriContent(new Uri($"https://example.com/image-{i}.png"), "image/png")); 73new UriContent(new Uri("https://example.com/image1.png"), "image/png"), 99new UriContent(new Uri("https://example.com/image1.png"), "image/png"), 137new UriContent(new Uri("https://example.com/image.png"), "image/png"),
Microsoft.Extensions.AI.Evaluation.Integration.Tests (4)
SafetyEvaluatorTests.cs (4)
340new UriContent("https://uhf.microsoft.com/images/microsoft/RE1Mu3b.png", "image/png")], 425new UriContent("https://uhf.microsoft.com/images/banners/RW1iGSh.png", "image/png")], 461new UriContent("https://uhf.microsoft.com/images/microsoft/RE1Mu3b.png", "image/png")], 474new UriContent("https://uhf.microsoft.com/images/banners/RW1iGSh.png", "image/png")],
Microsoft.Extensions.AI.Evaluation.Reporting (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.UriContent.g.cs (1)
34ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.UriContent((global::System.Uri)args[0], (string)args[1]),
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.UriContent.g.cs (1)
34ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.UriContent((global::System.Uri)args[0], (string)args[1]),
Microsoft.Extensions.AI.OpenAI (5)
OpenAIChatClient.cs (1)
794contentPart.ImageUri is not null ? new UriContent(contentPart.ImageUri, OpenAIClientExtensions.ImageUriToMediaType(contentPart.ImageUri)) :
OpenAIImageGenerator.cs (1)
124contents.Add(new UriContent(image.ImageUri, contentType));
OpenAIResponsesChatClient.cs (3)
1716content = new UriContent(imageUri, OpenAIClientExtensions.ImageUriToMediaType(imageUri)); 1829(results ??= []).Add(new UriContent(uriSource.Uri, "text/html") 1882outputContents.Add(new UriContent(cicio.ImageUri, OpenAIClientExtensions.ImageUriToMediaType(cicio.ImageUri)) { RawRepresentation = cicio });
Microsoft.Extensions.AI.OpenAI.Tests (6)
OpenAIConversionTests.cs (1)
1522new UriContent("https://example.com/image.jpg", "image/jpeg"),
OpenAIResponseClientTests.cs (5)
4999new FunctionResultContent("call_uri", new UriContent(new Uri("https://example.com/image.png"), "image/png")) 5118new UriContent(new Uri("https://example.com/result.png"), "image/png"), 5345new FunctionResultContent("call_file_uri", new UriContent(new Uri("https://example.com/document.pdf"), "application/pdf")) 5571new UriContent(new Uri("https://example.com/image.png"), "image/png"), 5572new UriContent(new Uri("https://example.com/image.png"), "image/png") { AdditionalProperties = new AdditionalPropertiesDictionary { ["detail"] = "high" }},
Microsoft.Extensions.AI.Stabilization.Tests (11)
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.UriContent.g.cs (1)
32ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.UriContent((global::System.Uri)args[0], (string)args[1]),
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\ImageGenerationToolResultContentTests.cs (3)
54new UriContent("http://example.com/image.jpg", "image/jpeg"), 74new UriContent("http://example.com/image.jpg", "image/jpeg") 99new UriContent("http://example.com/another.jpg", "image/jpeg")
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\WebSearchToolResultContentTests.cs (7)
33new UriContent(new Uri("https://example.com/1"), "text/html") { AdditionalProperties = new() { ["title"] = "Result 1" } } 56new UriContent(new Uri("https://example.com/1"), "text/html") { AdditionalProperties = new() { ["title"] = "First" } }, 57new UriContent(new Uri("https://example.com/2"), "text/html") { AdditionalProperties = new() { ["title"] = "Second" } }, 58new UriContent(new Uri("https://example.com/3"), "text/html"), 82new UriContent(new Uri("https://example.com"), "text/html") { AdditionalProperties = new() { ["title"] = "Example Page" } }, 83new UriContent(new Uri("https://another.com"), "text/html"), 110new UriContent(new Uri("https://test.com"), "text/html") { AdditionalProperties = new() { ["title"] = "Test" } },
Microsoft.Extensions.AI.Tests (9)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (1)
277var expectedResponse = new ChatResponse(new ChatMessage(ChatRole.Assistant, [new UriContent("https://example.com", "image/*")]));
ChatCompletion\OpenTelemetryChatClientTests.cs (5)
411new UriContent(new Uri("https://example.com/image.jpg"), "image/jpeg"), 427yield return new() { Contents = [new UriContent(new Uri("https://example.com/image.jpg"), "image/jpeg")] }; 447new UriContent(new Uri("https://example.com/video.mp4"), "video/mp4"), 664new ImageGenerationToolResultContent("img-123") { Outputs = [new UriContent(new Uri("https://example.com/image.png"), "image/png")] }, 686Outputs = [new UriContent(new Uri("https://example.com/image.png"), "image/png")]
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestJsonSerializerContext.UriContent.g.cs (1)
32ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.UriContent((global::System.Uri)args[0], (string)args[1]),
Image\OpenTelemetryImageGeneratorTests.cs (2)
47new UriContent("http://example/output.png", "image/png"), 76OriginalImages = [new UriContent("http://example/input.png", "image/png")],
213 references to UriContent
Microsoft.Extensions.AI (2)
Common\OtelMessageSerializer.cs (1)
103case UriContent uc:
Realtime\OpenTelemetryRealtimeClientSession.cs (1)
567case UriContent uc:
Microsoft.Extensions.AI.Abstractions (27)
Contents\AIContent.cs (1)
19[JsonDerivedType(typeof(UriContent), typeDiscriminator: "uri")]
Contents\DataContent.cs (1)
33/// The content represents in-memory data. For references to data at a remote URI, use <see cref="UriContent"/> instead.
Contents\ImageGenerationToolResultContent.cs (1)
30/// Content is typically <see cref="DataContent"/> for images streamed from the tool, or <see cref="UriContent"/> for remotely hosted images, but
Contents\UriContent.cs (2)
31/// <summary>Initializes a new instance of the <see cref="UriContent"/> class.</summary> 46/// <summary>Initializes a new instance of the <see cref="UriContent"/> class.</summary>
Contents\WebSearchToolResultContent.cs (2)
14/// found during the search, typically as <see cref="UriContent"/> instances. 31/// Each output represents a web page result found during the search, typically as a <see cref="UriContent"/> instance.
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
360if (type == typeof(global::Microsoft.Extensions.AI.UriContent))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.UriContent.g.cs (18)
15private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent>? _UriContent; 21public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> UriContent 24get => _UriContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.UriContent)); 27private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> Create_UriContent(global::System.Text.Json.JsonSerializerOptions options) 29if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.UriContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> jsonTypeInfo)) 31var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.UriContent> 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(global::System.Uri), typeof(string)}, modifiers: null), 41jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.UriContent>(options, objectInfo); 58DeclaringType = typeof(global::Microsoft.Extensions.AI.UriContent), 60Getter = static obj => ((global::Microsoft.Extensions.AI.UriContent)obj).Uri, 61Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.UriContent)obj).Uri = value!, 68AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetProperty("Uri", InstanceMemberBindingFlags, null, typeof(global::System.Uri), global::System.Array.Empty<global::System.Type>(), null), 80DeclaringType = typeof(global::Microsoft.Extensions.AI.UriContent), 82Getter = static obj => ((global::Microsoft.Extensions.AI.UriContent)obj).MediaType, 83Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.UriContent)obj).MediaType = value!, 90AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetProperty("MediaType", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
Image\ImageGenerationResponse.cs (1)
41/// Content is typically <see cref="DataContent"/> for images streamed from the generator, or <see cref="UriContent"/> for remotely hosted images, but
Microsoft.Extensions.AI.Abstractions.Tests (64)
Contents\ImageGenerationToolResultContentTests.cs (6)
62Assert.IsType<UriContent>(c.Outputs[1]); 87Assert.IsType<UriContent>(deserializedSut.Outputs[1]); 88Assert.Equal("http://example.com/image.jpg", ((UriContent)deserializedSut.Outputs[1]).Uri.ToString()); 117Assert.IsType<UriContent>(imageResult.Outputs[1]); 147var uriOutput = Assert.IsType<UriContent>(imgResult.Outputs[0]);
Contents\UriContentTests.cs (18)
25UriContent c = new("http://localhost/something", "image/png"); 40UriContent c = new("http://localhost/something", "image/png"); 52var content = new UriContent("http://localhost/something", mediaType); 76var content = new UriContent(uri); 79var content2 = new UriContent(uri, null); 93var content = new UriContent(new Uri(uri)); 96var content2 = new UriContent(new Uri(uri), null); 112var content = new UriContent(new Uri(uri, UriKind.Relative)); 115var content2 = new UriContent(new Uri(uri, UriKind.Relative), null); 127var content = new UriContent(uri); 140var content = new UriContent(new Uri(uri, UriKind.Relative)); 147var content = new UriContent("http://localhost/image.png", "application/octet-stream"); 150var relContent = new UriContent(new Uri("image.png", UriKind.Relative), "application/octet-stream"); 191UriContent c = new("http://localhost", mediaType); 204var content = new UriContent("http://localhost", mediaType); 217var content = new UriContent("http://localhost", mediaType); 238var uriContent = Assert.IsType<UriContent>(result);
Contents\WebSearchToolResultContentTests.cs (14)
65var first = Assert.IsType<UriContent>(c.Outputs[0]); 68var second = Assert.IsType<UriContent>(c.Outputs[1]); 71var third = Assert.IsType<UriContent>(c.Outputs[2]); 95var first = Assert.IsType<UriContent>(deserialized.Outputs[0]); 99var second = Assert.IsType<UriContent>(deserialized.Outputs[1]); 122var first = Assert.IsType<UriContent>(result.Outputs[0]); 153var uriResult = Assert.IsType<UriContent>(wsResult.Outputs[0]);
Generated\361d1da7f942c932\TestJsonSerializerContext.GetJsonTypeInfo.g.cs (1)
370if (type == typeof(global::Microsoft.Extensions.AI.UriContent))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestJsonSerializerContext.UriContent.g.cs (18)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent>? _UriContent; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> UriContent 22get => _UriContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.UriContent)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> Create_UriContent(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.UriContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> jsonTypeInfo)) 29var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.UriContent> 35ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(global::System.Uri), typeof(string)}, modifiers: null), 39jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.UriContent>(options, objectInfo); 56DeclaringType = typeof(global::Microsoft.Extensions.AI.UriContent), 58Getter = static obj => ((global::Microsoft.Extensions.AI.UriContent)obj).Uri, 59Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.UriContent)obj).Uri = value!, 66AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetProperty("Uri", InstanceMemberBindingFlags, null, typeof(global::System.Uri), global::System.Array.Empty<global::System.Type>(), null), 78DeclaringType = typeof(global::Microsoft.Extensions.AI.UriContent), 80Getter = static obj => ((global::Microsoft.Extensions.AI.UriContent)obj).MediaType, 81Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.UriContent)obj).MediaType = value!, 88AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetProperty("MediaType", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
Image\ImageGenerationResponseTests.cs (7)
48UriContent uc = Assert.IsType<UriContent>(response.Contents[i]); 112UriContent uriContent = Assert.IsType<UriContent>(deserialized.Contents[0]); 150Assert.IsType<UriContent>(deserialized.Contents[0]); 178var uriContent = Assert.IsType<UriContent>(result.Contents[0]);
Microsoft.Extensions.AI.Evaluation (1)
EvaluationContext.cs (1)
59/// <see cref="TextContent"/> objects for text, <see cref="DataContent"/> or <see cref="UriContent"/> objects for
Microsoft.Extensions.AI.Evaluation.Reporting (19)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
232if (type == typeof(global::Microsoft.Extensions.AI.UriContent))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.UriContent.g.cs (18)
15private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent>? _UriContent; 21public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> UriContent 24get => _UriContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.UriContent)); 27private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> Create_UriContent(global::System.Text.Json.JsonSerializerOptions options) 29if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.UriContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> jsonTypeInfo)) 31var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.UriContent> 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(global::System.Uri), typeof(string)}, modifiers: null), 41jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.UriContent>(options, objectInfo); 58DeclaringType = typeof(global::Microsoft.Extensions.AI.UriContent), 60Getter = static obj => ((global::Microsoft.Extensions.AI.UriContent)obj).Uri, 61Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.UriContent)obj).Uri = value!, 68AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetProperty("Uri", InstanceMemberBindingFlags, null, typeof(global::System.Uri), global::System.Array.Empty<global::System.Type>(), null), 80DeclaringType = typeof(global::Microsoft.Extensions.AI.UriContent), 82Getter = static obj => ((global::Microsoft.Extensions.AI.UriContent)obj).MediaType, 83Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.UriContent)obj).MediaType = value!, 90AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetProperty("MediaType", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (19)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
228if (type == typeof(global::Microsoft.Extensions.AI.UriContent))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.UriContent.g.cs (18)
15private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent>? _UriContent; 21public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> UriContent 24get => _UriContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.UriContent)); 27private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> Create_UriContent(global::System.Text.Json.JsonSerializerOptions options) 29if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.UriContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> jsonTypeInfo)) 31var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.UriContent> 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(global::System.Uri), typeof(string)}, modifiers: null), 41jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.UriContent>(options, objectInfo); 58DeclaringType = typeof(global::Microsoft.Extensions.AI.UriContent), 60Getter = static obj => ((global::Microsoft.Extensions.AI.UriContent)obj).Uri, 61Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.UriContent)obj).Uri = value!, 68AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetProperty("Uri", InstanceMemberBindingFlags, null, typeof(global::System.Uri), global::System.Array.Empty<global::System.Type>(), null), 80DeclaringType = typeof(global::Microsoft.Extensions.AI.UriContent), 82Getter = static obj => ((global::Microsoft.Extensions.AI.UriContent)obj).MediaType, 83Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.UriContent)obj).MediaType = value!, 90AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetProperty("MediaType", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
Microsoft.Extensions.AI.Evaluation.Safety (4)
AIContentExtensions.cs (1)
14(content is UriContent uriContent && IsSupportedImageFormat(uriContent.MediaType)) ||
ContentSafetyServicePayloadUtilities.cs (3)
328else if (content is UriContent uriContent && uriContent.HasTopLevelMediaType("image")) 515$"The current evaluation being performed by {evaluatorName} only supports content of type '{nameof(TextContent)}', '{nameof(UriContent)}' and '{nameof(DataContent)}'. " + 516$"For '{nameof(UriContent)}' and '{nameof(DataContent)}', only content with media type 'image/png', 'image/jpeg' and 'image/gif' are supported. " +
Microsoft.Extensions.AI.Integration.Tests (1)
ImageGeneratorIntegrationTests.cs (1)
49case UriContent uc:
Microsoft.Extensions.AI.OpenAI (6)
OpenAIAssistantsChatClient.cs (1)
542case UriContent image when image.HasTopLevelMediaType("image"):
OpenAIChatClient.cs (1)
298case UriContent uriContent when uriContent.HasTopLevelMediaType("image"):
OpenAIResponsesChatClient.cs (4)
1351case UriContent uriContent when uriContent.HasTopLevelMediaType("image"): 1355case UriContent uriContent when uriContent.MediaType.StartsWith("application/pdf", StringComparison.OrdinalIgnoreCase): 1448case UriContent uc when uc.HasTopLevelMediaType("image"): 1456case UriContent uc:
Microsoft.Extensions.AI.OpenAI.Tests (12)
OpenAIConversionTests.cs (2)
909Assert.Equal("http://example.com/image.png", Assert.IsType<UriContent>(message.Contents[1], exactMatch: false).Uri.ToString()); 940Assert.Equal("http://example.com/image.png", Assert.IsType<UriContent>(message.Contents[1], exactMatch: false).Uri.ToString());
OpenAIResponseClientIntegrationTests.cs (2)
113var uriContent = Assert.IsType<UriContent>(r);
OpenAIResponseClientTests.cs (8)
6231var imageContent = userMessage.Contents.OfType<UriContent>().FirstOrDefault(); 7149var source0 = Assert.IsType<UriContent>(wsResult.Outputs[0]); 7154var source1 = Assert.IsType<UriContent>(wsResult.Outputs[1]); 7289var streamSource = Assert.IsType<UriContent>(wsResult.Outputs[0]);
Microsoft.Extensions.AI.Stabilization.Tests (39)
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.GetJsonTypeInfo.g.cs (1)
134if (type == typeof(global::Microsoft.Extensions.AI.UriContent))
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.UriContent.g.cs (18)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent>? _UriContent; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> UriContent 22get => _UriContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.UriContent)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> Create_UriContent(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.UriContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> jsonTypeInfo)) 29var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.UriContent> 35ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(global::System.Uri), typeof(string)}, modifiers: null), 39jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.UriContent>(options, objectInfo); 56DeclaringType = typeof(global::Microsoft.Extensions.AI.UriContent), 58Getter = static obj => ((global::Microsoft.Extensions.AI.UriContent)obj).Uri, 59Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.UriContent)obj).Uri = value!, 66AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetProperty("Uri", InstanceMemberBindingFlags, null, typeof(global::System.Uri), global::System.Array.Empty<global::System.Type>(), null), 78DeclaringType = typeof(global::Microsoft.Extensions.AI.UriContent), 80Getter = static obj => ((global::Microsoft.Extensions.AI.UriContent)obj).MediaType, 81Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.UriContent)obj).MediaType = value!, 88AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetProperty("MediaType", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\ImageGenerationToolResultContentTests.cs (6)
62Assert.IsType<UriContent>(c.Outputs[1]); 87Assert.IsType<UriContent>(deserializedSut.Outputs[1]); 88Assert.Equal("http://example.com/image.jpg", ((UriContent)deserializedSut.Outputs[1]).Uri.ToString()); 117Assert.IsType<UriContent>(imageResult.Outputs[1]); 147var uriOutput = Assert.IsType<UriContent>(imgResult.Outputs[0]);
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\WebSearchToolResultContentTests.cs (14)
65var first = Assert.IsType<UriContent>(c.Outputs[0]); 68var second = Assert.IsType<UriContent>(c.Outputs[1]); 71var third = Assert.IsType<UriContent>(c.Outputs[2]); 95var first = Assert.IsType<UriContent>(deserialized.Outputs[0]); 99var second = Assert.IsType<UriContent>(deserialized.Outputs[1]); 122var first = Assert.IsType<UriContent>(result.Outputs[0]); 153var uriResult = Assert.IsType<UriContent>(wsResult.Outputs[0]);
Microsoft.Extensions.AI.Tests (19)
Generated\361d1da7f942c932\TestJsonSerializerContext.GetJsonTypeInfo.g.cs (1)
242if (type == typeof(global::Microsoft.Extensions.AI.UriContent))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestJsonSerializerContext.UriContent.g.cs (18)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent>? _UriContent; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> UriContent 22get => _UriContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.UriContent)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> Create_UriContent(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.UriContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.UriContent> jsonTypeInfo)) 29var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.UriContent> 35ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(global::System.Uri), typeof(string)}, modifiers: null), 39jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.UriContent>(options, objectInfo); 56DeclaringType = typeof(global::Microsoft.Extensions.AI.UriContent), 58Getter = static obj => ((global::Microsoft.Extensions.AI.UriContent)obj).Uri, 59Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.UriContent)obj).Uri = value!, 66AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetProperty("Uri", InstanceMemberBindingFlags, null, typeof(global::System.Uri), global::System.Array.Empty<global::System.Type>(), null), 78DeclaringType = typeof(global::Microsoft.Extensions.AI.UriContent), 80Getter = static obj => ((global::Microsoft.Extensions.AI.UriContent)obj).MediaType, 81Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.UriContent)obj).MediaType = value!, 88AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.UriContent).GetProperty("MediaType", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),