HostedFileClient class abstract

A client for uploading, downloading, and managing files hosted by an AI service.

Files uploaded through this interface can be referenced in AI requests using HostedFileContent.

This is an experimental feature.

Implemented types
Implementers
Annotations
  • @Source(name: 'IHostedFileClient.cs', namespace: 'Microsoft.Extensions.AI', repository: 'dotnet/extensions', path: 'src/Libraries/Microsoft.Extensions.AI.Abstractions/Files/')

Constructors

HostedFileClient()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

delete(String fileId, {HostedFileClientOptions? options, CancellationToken? cancellationToken}) Future<bool>
Deletes a file. Returns true if deleted, false if not found.
dispose() → void
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
inherited
download(String fileId, {HostedFileClientOptions? options, CancellationToken? cancellationToken}) Stream<List<int>>
Downloads a file from the AI service as a byte stream.
getFile(String fileId, {HostedFileClientOptions? options, CancellationToken? cancellationToken}) Future<HostedFileContent?>
Gets metadata about a file, or null if not found.
getService<T>({Object? key}) → T?
Gets a service of the specified type.
listFiles({HostedFileClientOptions? options, CancellationToken? cancellationToken}) Stream<HostedFileContent>
Returns all files visible to this client.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
upload(Stream<List<int>> content, {String? mediaType, String? fileName, HostedFileClientOptions? options, CancellationToken? cancellationToken}) Future<HostedFileContent>
Uploads a file to the AI service.

Operators

operator ==(Object other) bool
The equality operator.
inherited