79 instantiations of UriContent
Microsoft.Extensions.AI.Abstractions (1)
Microsoft.Extensions.AI.Abstractions.Tests (41)
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" } },
Microsoft.Extensions.AI.Evaluation.Integration.Tests (4)
Microsoft.Extensions.AI.Evaluation.Reporting (1)
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (1)
Microsoft.Extensions.AI.OpenAI (5)
Microsoft.Extensions.AI.OpenAI.Tests (6)
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)
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)
213 references to UriContent
Microsoft.Extensions.AI (2)
Microsoft.Extensions.AI.Abstractions (27)
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.Abstractions.Tests (64)
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);
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),
Microsoft.Extensions.AI.Evaluation (1)
Microsoft.Extensions.AI.Evaluation.Reporting (19)
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.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)
Microsoft.Extensions.AI.Integration.Tests (1)
Microsoft.Extensions.AI.OpenAI (6)
Microsoft.Extensions.AI.OpenAI.Tests (12)
Microsoft.Extensions.AI.Stabilization.Tests (39)
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),
Microsoft.Extensions.AI.Tests (19)
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),