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