93 instantiations of HostedFileContent
Microsoft.Extensions.AI.Abstractions (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.HostedFileContent.g.cs (1)
34ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.HostedFileContent((string)args[0]),
Microsoft.Extensions.AI.Abstractions.Tests (35)
Contents\AIContentTests.cs (1)
74new HostedFileContent("file123"),
Contents\CodeInterpreterToolCallContentTests.cs (2)
53new HostedFileContent("file123"), 73new HostedFileContent("file456")
Contents\CodeInterpreterToolResultContentTests.cs (2)
53new HostedFileContent("output.png"), 75new HostedFileContent("result.txt")
Contents\HostedFileContentTests.cs (17)
15Assert.Throws<ArgumentNullException>("fileId", () => new HostedFileContent(null!)); 16Assert.Throws<ArgumentException>("fileId", () => new HostedFileContent(string.Empty)); 17Assert.Throws<ArgumentException>("fileId", () => new HostedFileContent(" ")); 24HostedFileContent c = new(fileId); 39HostedFileContent c = new("id123"); 63var content = new HostedFileContent("file123"); 75HostedFileContent c = new("id123"); 97HostedFileContent c = new("id123"); 109HostedFileContent c = new("id123") { MediaType = mediaType }; 116HostedFileContent c = new("id123"); 132HostedFileContent c = new("id123"); 145HostedFileContent c = new("id123"); 160HostedFileContent c = new("id123"); 173HostedFileContent c = new("id123"); 188var content = new HostedFileContent("file123") 226HostedFileContent c = new("id123") { MediaType = mediaType }; 233HostedFileContent c = new("id123");
Files\DelegatingHostedFileClientTests.cs (4)
32var expectedFile = new HostedFileContent("file-123"); 88var expectedFile = new HostedFileContent("file-789") { Name = "info.txt" }; 115new HostedFileContent("file-1"), 116new HostedFileContent("file-2")
Files\HostedFileClientExtensionsTests.cs (6)
31return Task.FromResult(new HostedFileContent("file-1")); 82return new HostedFileContent("file-2"); 289var hostedFileContent = new HostedFileContent("file-hfc"); 308var content = new HostedFileContent("file-1"); 322var hostedFileContent = new HostedFileContent("file-scoped") { Scope = "container-42" }; 341var hostedFileContent = new HostedFileContent("file-scoped") { Scope = "container-from-content" };
Generated\361d1da7f942c932\TestJsonSerializerContext.HostedFileContent.g.cs (1)
32ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.HostedFileContent((string)args[0]),
Tools\HostedCodeInterpreterToolTests.cs (1)
47new HostedFileContent("id123"),
Tools\HostedFileSearchToolTests.cs (1)
49new HostedFileContent("id456"),
Microsoft.Extensions.AI.Evaluation.Reporting (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.HostedFileContent.g.cs (1)
34ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.HostedFileContent((string)args[0]),
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.HostedFileContent.g.cs (1)
34ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.HostedFileContent((string)args[0]),
Microsoft.Extensions.AI.OpenAI (7)
OpenAIAssistantsChatClient.cs (1)
232(hcitrc.Outputs ??= []).Add(new HostedFileContent(output.ImageFileId) { MediaType = "image/*" });
OpenAIChatClient.cs (1)
808contentPart.FileId is not null ? new HostedFileContent(contentPart.FileId) { Name = contentPart.Filename } :
OpenAIHostedFileClient.cs (2)
328new(openAIFile.Id) 347return new HostedFileContent(file.Id)
OpenAIResponsesChatClient.cs (3)
1698content = new HostedFileContent(part.InputImageFileId) { MediaType = "image/*" }; 1702content = new HostedFileContent(part.InputFileId) { Name = part.InputFilename }; 1954var hfc = new HostedFileContent(fileId) { MediaType = mimeType, RawRepresentation = output };
Microsoft.Extensions.AI.OpenAI.Tests (6)
OpenAIConversionTests.cs (1)
352var fileContent = new HostedFileContent("file-123");
OpenAIResponseClientTests.cs (5)
5056new FunctionResultContent("call_file", new HostedFileContent("file-abc123") { MediaType = "image/png", Name = "result.png" }) 5402new FunctionResultContent("call_hosted_file", new HostedFileContent("file-xyz789") { MediaType = "text/plain", Name = "document.txt" }) 5576new HostedFileContent("file-img-456") { MediaType = "image/png" }, 5577new HostedFileContent("file-img-789") { MediaType = "image/jpeg", AdditionalProperties = new AdditionalPropertiesDictionary { ["detail"] = "high" }}, 5578new HostedFileContent("file-123"),
Microsoft.Extensions.AI.Stabilization.Tests (23)
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.HostedFileContent.g.cs (1)
32ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.HostedFileContent((string)args[0]),
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\CodeInterpreterToolCallContentTests.cs (2)
53new HostedFileContent("file123"), 73new HostedFileContent("file456")
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\CodeInterpreterToolResultContentTests.cs (2)
53new HostedFileContent("output.png"), 75new HostedFileContent("result.txt")
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\HostedFileContentTests.cs (17)
15Assert.Throws<ArgumentNullException>("fileId", () => new HostedFileContent(null!)); 16Assert.Throws<ArgumentException>("fileId", () => new HostedFileContent(string.Empty)); 17Assert.Throws<ArgumentException>("fileId", () => new HostedFileContent(" ")); 24HostedFileContent c = new(fileId); 39HostedFileContent c = new("id123"); 63var content = new HostedFileContent("file123"); 75HostedFileContent c = new("id123"); 97HostedFileContent c = new("id123"); 109HostedFileContent c = new("id123") { MediaType = mediaType }; 116HostedFileContent c = new("id123"); 132HostedFileContent c = new("id123"); 145HostedFileContent c = new("id123"); 160HostedFileContent c = new("id123"); 173HostedFileContent c = new("id123"); 188var content = new HostedFileContent("file123") 226HostedFileContent c = new("id123") { MediaType = mediaType }; 233HostedFileContent c = new("id123");
parent\Microsoft.Extensions.AI.Abstractions.Tests\Tools\HostedCodeInterpreterToolTests.cs (1)
47new HostedFileContent("id123"),
Microsoft.Extensions.AI.Tests (19)
ChatCompletion\OpenTelemetryChatClientTests.cs (3)
412new HostedFileContent("file-abc123"), 428yield return new() { Contents = [new HostedFileContent("file-abc123")] }; 448new HostedFileContent("file-xyz789"),
Files\LoggingHostedFileClientTests.cs (5)
61Task.FromResult(new HostedFileContent("file-123") { Name = "test.txt" }), 170Task.FromResult<HostedFileContent?>(new HostedFileContent("file-456") { Name = "report.pdf" }), 233yield return new HostedFileContent("file-1") { Name = "a.txt" }; 234yield return new HostedFileContent("file-2") { Name = "b.txt" }; 510yield return new HostedFileContent("file-1");
Files\OpenTelemetryHostedFileClientTests.cs (10)
41Task.FromResult(new HostedFileContent("file-abc") { Name = "test.txt", SizeInBytes = 1024 }), 134Task.FromResult<HostedFileContent?>(new HostedFileContent("file-info") { Name = "report.pdf", SizeInBytes = 2048 }), 188yield return new HostedFileContent("file-1") { Name = "a.txt" }; 189yield return new HostedFileContent("file-2") { Name = "b.txt" }; 190yield return new HostedFileContent("file-3") { Name = "c.txt" }; 312yield return new HostedFileContent("file-1"); 367Task.FromResult(new HostedFileContent("file-1")), 499Task.FromResult(new HostedFileContent("file-1")), 537Task.FromResult(new HostedFileContent("file-1")), 574Task.FromResult(new HostedFileContent("file-1")),
Generated\361d1da7f942c932\TestJsonSerializerContext.HostedFileContent.g.cs (1)
32ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.HostedFileContent((string)args[0]),
381 references to HostedFileContent
Microsoft.Extensions.AI (15)
Common\OtelMessageSerializer.cs (1)
112case HostedFileContent fc:
Files\LoggingHostedFileClient.cs (7)
59public override async Task<HostedFileContent> UploadAsync( 79var result = await base.UploadAsync(content, mediaType, fileName, options, cancellationToken).ConfigureAwait(false); 144public override async Task<HostedFileContent?> GetFileInfoAsync( 161var result = await base.GetFileInfoAsync(fileId, options, cancellationToken).ConfigureAwait(false); 190public override async IAsyncEnumerable<HostedFileContent> ListFilesAsync( 205IAsyncEnumerator<HostedFileContent> e; 223HostedFileContent? file = null;
Files\OpenTelemetryHostedFileClient.cs (6)
135public override async Task<HostedFileContent> UploadAsync( 169HostedFileContent? result = null; 236public override async Task<HostedFileContent?> GetFileInfoAsync( 254HostedFileContent? result = null; 287public override async IAsyncEnumerable<HostedFileContent> ListFilesAsync( 308IAsyncEnumerator<HostedFileContent> e;
Realtime\OpenTelemetryRealtimeClientSession.cs (1)
577case HostedFileContent fc:
Microsoft.Extensions.AI.Abstractions (61)
Contents\AIContent.cs (1)
15[JsonDerivedType(typeof(HostedFileContent), typeDiscriminator: "hostedFile")]
Contents\CodeInterpreterToolCallContent.cs (1)
30/// Inputs can include various types of content such as <see cref="HostedFileContent"/> for files,
Contents\CodeInterpreterToolResultContent.cs (1)
26/// Outputs can include various types of content such as <see cref="HostedFileContent"/> for files,
Contents\HostedFileContent.cs (1)
24/// Initializes a new instance of the <see cref="HostedFileContent"/> class.
Contents\HostedVectorStoreContent.cs (1)
14/// Unlike <see cref="HostedFileContent"/> which represents a specific file that is hosted by the AI service,
Files\DelegatingHostedFileClient.cs (3)
39public virtual Task<HostedFileContent> UploadAsync( 55public virtual Task<HostedFileContent?> GetFileInfoAsync( 62public virtual IAsyncEnumerable<HostedFileContent> ListFilesAsync(
Files\HostedFileClientExtensions.cs (4)
32public static Task<HostedFileContent> UploadAsync( 59public static async Task<HostedFileContent> UploadAsync( 140/// Downloads a file referenced by a <see cref="HostedFileContent"/>. 151HostedFileContent hostedFile,
Files\IHostedFileClient.cs (4)
21/// interface can be referenced in AI requests using <see cref="HostedFileContent"/>. 44Task<HostedFileContent> UploadAsync( 76Task<HostedFileContent?> GetFileInfoAsync( 87IAsyncEnumerable<HostedFileContent> ListFilesAsync(
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
212if (type == typeof(global::Microsoft.Extensions.AI.HostedFileContent))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.HostedFileContent.g.cs (42)
15private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent>? _HostedFileContent; 21public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> HostedFileContent 24get => _HostedFileContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.HostedFileContent)); 27private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> Create_HostedFileContent(global::System.Text.Json.JsonSerializerOptions options) 29if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.HostedFileContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> jsonTypeInfo)) 31var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.HostedFileContent> 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string)}, modifiers: null), 41jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.HostedFileContent>(options, objectInfo); 58DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 60Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).FileId, 61Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).FileId = value!, 68AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("FileId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 80DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 82Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).MediaType, 83Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).MediaType = value!, 90AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("MediaType", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 100DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 102Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).Name, 103Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).Name = value!, 110AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Name", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 120DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 122Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).SizeInBytes, 123Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).SizeInBytes = value!, 130AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("SizeInBytes", InstanceMemberBindingFlags, null, typeof(long?), global::System.Array.Empty<global::System.Type>(), null), 140DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 142Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).CreatedAt, 143Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).CreatedAt = value!, 150AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("CreatedAt", InstanceMemberBindingFlags, null, typeof(global::System.DateTimeOffset?), global::System.Array.Empty<global::System.Type>(), null), 160DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 170AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Purpose", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 180DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 182Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).PurposeCore, 183Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).PurposeCore = value!, 190AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("PurposeCore", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 200DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 210AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Scope", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 220DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 222Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).ScopeCore, 223Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).ScopeCore = value!, 230AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("ScopeCore", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
Tools\HostedCodeInterpreterTool.cs (1)
39/// represented via <see cref="HostedFileContent"/>. Some also support binary data, represented via <see cref="DataContent"/>.
Tools\HostedFileSearchTool.cs (1)
39/// support different kinds of inputs, for example, some might respect <see cref="HostedFileContent"/> using provider-specific file IDs,
Microsoft.Extensions.AI.Abstractions.Tests (81)
Contents\CodeInterpreterToolCallContentTests.cs (3)
61Assert.IsType<HostedFileContent>(c.Inputs[1]); 86Assert.IsType<HostedFileContent>(deserializedSut.Inputs[1]); 87Assert.Equal("file456", ((HostedFileContent)deserializedSut.Inputs[1]).FileId);
Contents\CodeInterpreterToolResultContentTests.cs (3)
62Assert.IsType<HostedFileContent>(c.Outputs[1]); 88Assert.IsType<HostedFileContent>(deserializedSut.Outputs[1]); 89Assert.Equal("result.txt", ((HostedFileContent)deserializedSut.Outputs[1]).FileId);
Contents\HostedFileContentTests.cs (20)
24HostedFileContent c = new(fileId); 39HostedFileContent c = new("id123"); 63var content = new HostedFileContent("file123"); 66var deserializedContent = JsonSerializer.Deserialize<HostedFileContent>(json, AIJsonUtilities.DefaultOptions); 75HostedFileContent c = new("id123"); 97HostedFileContent c = new("id123"); 109HostedFileContent c = new("id123") { MediaType = mediaType }; 116HostedFileContent c = new("id123"); 132HostedFileContent c = new("id123"); 145HostedFileContent c = new("id123"); 160HostedFileContent c = new("id123"); 173HostedFileContent c = new("id123"); 188var content = new HostedFileContent("file123") 207var deserialized = JsonSerializer.Deserialize<HostedFileContent>(json, AIJsonUtilities.DefaultOptions); 226HostedFileContent c = new("id123") { MediaType = mediaType }; 233HostedFileContent c = new("id123"); 260var hostedFile = Assert.IsType<HostedFileContent>(result);
Files\DelegatingHostedFileClientTests.cs (5)
31var expectedResult = new TaskCompletionSource<HostedFileContent>(); 32var expectedFile = new HostedFileContent("file-123"); 87var expectedResult = new TaskCompletionSource<HostedFileContent?>(); 88var expectedFile = new HostedFileContent("file-789") { Name = "info.txt" }; 113HostedFileContent[] expectedFiles =
Files\HostedFileClientExtensionsTests.cs (7)
34var result = await client.UploadAsync(content); 85var result = await client.UploadAsync(tempFile); 289var hostedFileContent = new HostedFileContent("file-hfc"); 308var content = new HostedFileContent("file-1"); 316await Assert.ThrowsAsync<ArgumentNullException>("hostedFile", () => client.DownloadAsync((HostedFileContent)null!)); 322var hostedFileContent = new HostedFileContent("file-scoped") { Scope = "container-42" }; 341var hostedFileContent = new HostedFileContent("file-scoped") { Scope = "container-from-content" };
Generated\361d1da7f942c932\TestJsonSerializerContext.GetJsonTypeInfo.g.cs (1)
198if (type == typeof(global::Microsoft.Extensions.AI.HostedFileContent))
Generated\361d1da7f942c932\TestJsonSerializerContext.HostedFileContent.g.cs (34)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent>? _HostedFileContent; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> HostedFileContent 22get => _HostedFileContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.HostedFileContent)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> Create_HostedFileContent(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.HostedFileContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> jsonTypeInfo)) 29var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.HostedFileContent> 35ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string)}, modifiers: null), 39jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.HostedFileContent>(options, objectInfo); 56DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 58Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).FileId, 59Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).FileId = value!, 66AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("FileId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 78DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 80Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).MediaType, 81Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).MediaType = value!, 88AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("MediaType", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 98DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 100Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).Name, 101Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).Name = value!, 108AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Name", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 118DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 120Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).SizeInBytes, 121Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).SizeInBytes = value!, 128AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("SizeInBytes", InstanceMemberBindingFlags, null, typeof(long?), global::System.Array.Empty<global::System.Type>(), null), 138DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 140Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).CreatedAt, 141Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).CreatedAt = value!, 148AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("CreatedAt", InstanceMemberBindingFlags, null, typeof(global::System.DateTimeOffset?), global::System.Array.Empty<global::System.Type>(), null), 158DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 168AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Purpose", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 178DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 188AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Scope", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
TestHostedFileClient.cs (6)
21public Func<Stream, string?, string?, HostedFileClientOptions?, CancellationToken, Task<HostedFileContent>>? UploadAsyncCallback { get; set; } 25public Func<string, HostedFileClientOptions?, CancellationToken, Task<HostedFileContent?>>? GetFileInfoAsyncCallback { get; set; } 27public Func<HostedFileClientOptions?, CancellationToken, IAsyncEnumerable<HostedFileContent>>? ListFilesAsyncCallback { get; set; } 36public Task<HostedFileContent> UploadAsync( 50public Task<HostedFileContent?> GetFileInfoAsync( 56public IAsyncEnumerable<HostedFileContent> ListFilesAsync(
Tools\HostedCodeInterpreterToolTests.cs (1)
54Assert.IsType<HostedFileContent>(tool.Inputs[0]);
Tools\HostedFileSearchToolTests.cs (1)
58Assert.IsType<HostedFileContent>(tool.Inputs[1]);
Microsoft.Extensions.AI.Evaluation.Reporting (35)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
168if (type == typeof(global::Microsoft.Extensions.AI.HostedFileContent))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.HostedFileContent.g.cs (34)
15private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent>? _HostedFileContent; 21public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> HostedFileContent 24get => _HostedFileContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.HostedFileContent)); 27private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> Create_HostedFileContent(global::System.Text.Json.JsonSerializerOptions options) 29if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.HostedFileContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> jsonTypeInfo)) 31var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.HostedFileContent> 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string)}, modifiers: null), 41jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.HostedFileContent>(options, objectInfo); 58DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 60Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).FileId, 61Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).FileId = value!, 68AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("FileId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 80DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 82Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).MediaType, 83Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).MediaType = value!, 90AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("MediaType", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 100DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 102Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).Name, 103Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).Name = value!, 110AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Name", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 120DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 122Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).SizeInBytes, 123Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).SizeInBytes = value!, 130AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("SizeInBytes", InstanceMemberBindingFlags, null, typeof(long?), global::System.Array.Empty<global::System.Type>(), null), 140DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 142Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).CreatedAt, 143Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).CreatedAt = value!, 150AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("CreatedAt", InstanceMemberBindingFlags, null, typeof(global::System.DateTimeOffset?), global::System.Array.Empty<global::System.Type>(), null), 160DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 170AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Purpose", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 180DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 190AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Scope", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (35)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
164if (type == typeof(global::Microsoft.Extensions.AI.HostedFileContent))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.HostedFileContent.g.cs (34)
15private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent>? _HostedFileContent; 21public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> HostedFileContent 24get => _HostedFileContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.HostedFileContent)); 27private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> Create_HostedFileContent(global::System.Text.Json.JsonSerializerOptions options) 29if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.HostedFileContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> jsonTypeInfo)) 31var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.HostedFileContent> 37ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string)}, modifiers: null), 41jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.HostedFileContent>(options, objectInfo); 58DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 60Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).FileId, 61Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).FileId = value!, 68AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("FileId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 80DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 82Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).MediaType, 83Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).MediaType = value!, 90AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("MediaType", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 100DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 102Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).Name, 103Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).Name = value!, 110AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Name", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 120DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 122Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).SizeInBytes, 123Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).SizeInBytes = value!, 130AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("SizeInBytes", InstanceMemberBindingFlags, null, typeof(long?), global::System.Array.Empty<global::System.Type>(), null), 140DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 142Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).CreatedAt, 143Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).CreatedAt = value!, 150AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("CreatedAt", InstanceMemberBindingFlags, null, typeof(global::System.DateTimeOffset?), global::System.Array.Empty<global::System.Type>(), null), 160DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 170AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Purpose", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 180DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 190AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Scope", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
Microsoft.Extensions.AI.OpenAI (12)
OpenAIAssistantsChatClient.cs (1)
397if (input is HostedFileContent hostedFile)
OpenAIChatClient.cs (1)
321case HostedFileContent fileContent:
OpenAIHostedFileClient.cs (5)
96public async Task<HostedFileContent> UploadAsync( 185public async Task<HostedFileContent?> GetFileInfoAsync( 214public async IAsyncEnumerable<HostedFileContent> ListFilesAsync( 327private static HostedFileContent ToHostedFileContent(OpenAIFile openAIFile) => 338private static HostedFileContent? ToHostedFileContent(ContainerFileResource file, string? scope)
OpenAIResponsesChatClient.cs (5)
763new(codeTool.Inputs?.OfType<HostedFileContent>().Select(f => f.FileId).ToList() is { Count: > 0 } ids ? 1367case HostedFileContent fileContent when fileContent.HasTopLevelMediaType("image"): 1371case HostedFileContent fileContent: 1464case HostedFileContent fc: 1954var hfc = new HostedFileContent(fileId) { MediaType = mimeType, RawRepresentation = output };
Microsoft.Extensions.AI.OpenAI.Tests (29)
OpenAIConversionTests.cs (1)
352var fileContent = new HostedFileContent("file-123");
OpenAIHostedFileClientIntegrationTests.cs (19)
40var uploadedFile = await _client!.UploadAsync(uploadStream, "application/jsonl", fileName, new HostedFileClientOptions { Purpose = "fine-tune" }); 71var fileInfo = await _client.GetFileInfoAsync(uploadedFile.FileId); 94var uploadedFile = await _client!.UploadAsync(uploadStream, "text/plain", fileName, new HostedFileClientOptions { Purpose = "assistants" }); 97var files = new List<HostedFileContent>(); 98await foreach (var file in _client.ListFilesAsync(new HostedFileClientOptions { Purpose = "assistants" })) 126var uploadedFile = await _client!.UploadAsync(uploadStream, "text/plain", fileName, new HostedFileClientOptions { Purpose = "assistants" }); 129var fileInfo = await _client.GetFileInfoAsync(uploadedFileId); 163var fileInfo = await _client!.GetFileInfoAsync("file-nonexistent000000000000"); 179var uploadedFile = await _client!.UploadAsync(dataContent, new HostedFileClientOptions { Purpose = "assistants" }); 208var uploadedFile = await _client!.UploadAsync(uploadStream, "application/jsonl", fileName, new HostedFileClientOptions { Purpose = "fine-tune" }); 238var uploadedFile = await _client!.UploadAsync(uploadStream, "application/jsonl", fileName, new HostedFileClientOptions { Purpose = "fine-tune" }); 300var uploadedFile = await containerClient.UploadAsync( 309var files = new List<HostedFileContent>(); 310await foreach (var file in containerClient.ListFilesAsync(new HostedFileClientOptions { Scope = containerId })) 318var fileInfo = await containerClient.GetFileInfoAsync(uploadedFile.FileId, new HostedFileClientOptions { Scope = containerId }); 367var containerFiles = new List<HostedFileContent>(); 368await foreach (var file in fileClient.ListFilesAsync(new HostedFileClientOptions { Scope = containerId })) 376var firstFile = containerFiles[0]; 417var uploadedFile = await fileClient.UploadAsync(
OpenAIHostedFileClientTests.cs (9)
112var result = await client.UploadAsync(stream); 149var result = await client.UploadAsync(stream, options: new HostedFileClientOptions { Purpose = "fine-tune" }); 201var result = await client.GetFileInfoAsync("file-abc123"); 220var result = await client.GetFileInfoAsync("file-nonexistent"); 662var result = await client.UploadAsync(contentStream, "text/csv", "data.csv", new HostedFileClientOptions { Scope = "ctr-123" }); 743var result = await client.GetFileInfoAsync("cfile-1", new HostedFileClientOptions { Scope = "ctr-123" }); 758var result = await client.GetFileInfoAsync("cfile-nonexistent", new HostedFileClientOptions { Scope = "ctr-123" }); 846var result = await client.GetFileInfoAsync("cfile-1"); 872var result = await client.UploadAsync(contentStream, "text/csv", "data.csv", new HostedFileClientOptions
Microsoft.Extensions.AI.Stabilization.Tests (62)
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.GetJsonTypeInfo.g.cs (1)
74if (type == typeof(global::Microsoft.Extensions.AI.HostedFileContent))
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.HostedFileContent.g.cs (34)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent>? _HostedFileContent; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> HostedFileContent 22get => _HostedFileContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.HostedFileContent)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> Create_HostedFileContent(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.HostedFileContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> jsonTypeInfo)) 29var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.HostedFileContent> 35ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string)}, modifiers: null), 39jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.HostedFileContent>(options, objectInfo); 56DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 58Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).FileId, 59Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).FileId = value!, 66AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("FileId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 78DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 80Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).MediaType, 81Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).MediaType = value!, 88AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("MediaType", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 98DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 100Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).Name, 101Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).Name = value!, 108AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Name", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 118DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 120Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).SizeInBytes, 121Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).SizeInBytes = value!, 128AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("SizeInBytes", InstanceMemberBindingFlags, null, typeof(long?), global::System.Array.Empty<global::System.Type>(), null), 138DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 140Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).CreatedAt, 141Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).CreatedAt = value!, 148AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("CreatedAt", InstanceMemberBindingFlags, null, typeof(global::System.DateTimeOffset?), global::System.Array.Empty<global::System.Type>(), null), 158DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 168AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Purpose", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 178DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 188AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Scope", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\CodeInterpreterToolCallContentTests.cs (3)
61Assert.IsType<HostedFileContent>(c.Inputs[1]); 86Assert.IsType<HostedFileContent>(deserializedSut.Inputs[1]); 87Assert.Equal("file456", ((HostedFileContent)deserializedSut.Inputs[1]).FileId);
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\CodeInterpreterToolResultContentTests.cs (3)
62Assert.IsType<HostedFileContent>(c.Outputs[1]); 88Assert.IsType<HostedFileContent>(deserializedSut.Outputs[1]); 89Assert.Equal("result.txt", ((HostedFileContent)deserializedSut.Outputs[1]).FileId);
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\HostedFileContentTests.cs (20)
24HostedFileContent c = new(fileId); 39HostedFileContent c = new("id123"); 63var content = new HostedFileContent("file123"); 66var deserializedContent = JsonSerializer.Deserialize<HostedFileContent>(json, AIJsonUtilities.DefaultOptions); 75HostedFileContent c = new("id123"); 97HostedFileContent c = new("id123"); 109HostedFileContent c = new("id123") { MediaType = mediaType }; 116HostedFileContent c = new("id123"); 132HostedFileContent c = new("id123"); 145HostedFileContent c = new("id123"); 160HostedFileContent c = new("id123"); 173HostedFileContent c = new("id123"); 188var content = new HostedFileContent("file123") 207var deserialized = JsonSerializer.Deserialize<HostedFileContent>(json, AIJsonUtilities.DefaultOptions); 226HostedFileContent c = new("id123") { MediaType = mediaType }; 233HostedFileContent c = new("id123"); 260var hostedFile = Assert.IsType<HostedFileContent>(result);
parent\Microsoft.Extensions.AI.Abstractions.Tests\Tools\HostedCodeInterpreterToolTests.cs (1)
54Assert.IsType<HostedFileContent>(tool.Inputs[0]);
Microsoft.Extensions.AI.Tests (51)
Files\LoggingHostedFileClientTests.cs (5)
170Task.FromResult<HostedFileContent?>(new HostedFileContent("file-456") { Name = "report.pdf" }), 230static async IAsyncEnumerable<HostedFileContent> GetFilesAsync() 242await foreach (var file in client.ListFilesAsync()) 507static async IAsyncEnumerable<HostedFileContent> ThrowOnSecondItem() 521await foreach (var file in client.ListFilesAsync())
Files\OpenTelemetryHostedFileClientTests.cs (5)
134Task.FromResult<HostedFileContent?>(new HostedFileContent("file-info") { Name = "report.pdf", SizeInBytes = 2048 }), 185static async IAsyncEnumerable<HostedFileContent> GetFilesAsync() 198await foreach (var file in client.ListFilesAsync(new HostedFileClientOptions { Purpose = "assistants", Scope = "container-4" })) 309static async IAsyncEnumerable<HostedFileContent> ThrowOnSecondItem() 323await foreach (var file in client.ListFilesAsync())
Generated\361d1da7f942c932\TestJsonSerializerContext.GetJsonTypeInfo.g.cs (1)
150if (type == typeof(global::Microsoft.Extensions.AI.HostedFileContent))
Generated\361d1da7f942c932\TestJsonSerializerContext.HostedFileContent.g.cs (34)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent>? _HostedFileContent; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> HostedFileContent 22get => _HostedFileContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.HostedFileContent)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> Create_HostedFileContent(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.HostedFileContent>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.HostedFileContent> jsonTypeInfo)) 29var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.HostedFileContent> 35ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string)}, modifiers: null), 39jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.HostedFileContent>(options, objectInfo); 56DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 58Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).FileId, 59Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).FileId = value!, 66AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("FileId", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 78DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 80Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).MediaType, 81Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).MediaType = value!, 88AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("MediaType", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 98DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 100Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).Name, 101Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).Name = value!, 108AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Name", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 118DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 120Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).SizeInBytes, 121Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).SizeInBytes = value!, 128AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("SizeInBytes", InstanceMemberBindingFlags, null, typeof(long?), global::System.Array.Empty<global::System.Type>(), null), 138DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 140Getter = static obj => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).CreatedAt, 141Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.HostedFileContent)obj).CreatedAt = value!, 148AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("CreatedAt", InstanceMemberBindingFlags, null, typeof(global::System.DateTimeOffset?), global::System.Array.Empty<global::System.Type>(), null), 158DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 168AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Purpose", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null), 178DeclaringType = typeof(global::Microsoft.Extensions.AI.HostedFileContent), 188AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.HostedFileContent).GetProperty("Scope", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
parent\Microsoft.Extensions.AI.Abstractions.Tests\TestHostedFileClient.cs (6)
21public Func<Stream, string?, string?, HostedFileClientOptions?, CancellationToken, Task<HostedFileContent>>? UploadAsyncCallback { get; set; } 25public Func<string, HostedFileClientOptions?, CancellationToken, Task<HostedFileContent?>>? GetFileInfoAsyncCallback { get; set; } 27public Func<HostedFileClientOptions?, CancellationToken, IAsyncEnumerable<HostedFileContent>>? ListFilesAsyncCallback { get; set; } 36public Task<HostedFileContent> UploadAsync( 50public Task<HostedFileContent?> GetFileInfoAsync( 56public IAsyncEnumerable<HostedFileContent> ListFilesAsync(