Class FileManagementClient
- Namespace
- GenerativeAI.Types.RagEngine
- Assembly
- GenerativeAI.dll
A client for interacting with the RAG Engine API for file management.
public class FileManagementClient : BaseClient
- Inheritance
-
FileManagementClient
- Inherited Members
- Extension Methods
Constructors
FileManagementClient(IPlatformAdapter, HttpClient?, ILogger?)
Initializes a new instance of the FileManagementClient class.
public FileManagementClient(IPlatformAdapter platform, HttpClient? httpClient = null, ILogger? logger = null)
Parameters
platformIPlatformAdapterThe platform adapter for API communication.
httpClientHttpClientOptional HTTP client for API requests.
loggerILoggerOptional logger for diagnostic output.
Methods
DeleteRagFileAsync(string, CancellationToken)
Deletes a RAG file.
public Task DeleteRagFileAsync(string name, CancellationToken cancellationToken = default)
Parameters
namestringThe name of the RagFile resource to delete.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation.
Returns
- Task
A task representing the asynchronous operation.
- See Also
GetRagFileAsync(string, CancellationToken)
Gets a specific RAG file.
public Task<RagFile?> GetRagFileAsync(string name, CancellationToken cancellationToken = default)
Parameters
namestringThe name of the RagFile resource.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation.
Returns
- See Also
ImportRagFilesAsync(string, ImportRagFilesRequest, CancellationToken)
Imports RAG files from the specified source into the RAG corpus.
public Task<GoogleLongRunningOperation> ImportRagFilesAsync(string parent, ImportRagFilesRequest request, CancellationToken cancellationToken = default)
Parameters
parentstringThe name of the target RagCorpus resource where the RAG files will be imported.
requestImportRagFilesRequestThe request object containing the details and configuration for importing the RAG files.
cancellationTokenCancellationTokenThe cancellation token to cancel the import operation if needed.
Returns
- Task<GoogleLongRunningOperation>
A task representing the asynchronous operation, resulting in a GoogleLongRunningOperation.
ListRagFilesAsync(string, int?, string?, CancellationToken)
Lists available RAG files in the specified RAG corpus.
public Task<ListRagFilesResponse?> ListRagFilesAsync(string parent, int? pageSize = null, string? pageToken = null, CancellationToken cancellationToken = default)
Parameters
parentstringThe name of the RagCorpus resource.
pageSizeint?The maximum number of RAG files to return.
pageTokenstringA page token, received from a previous ListRagFilesAsync(string, int?, string?, CancellationToken) call.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation.
Returns
- Task<ListRagFilesResponse>
A list of RAG files.
- See Also
UploadRagFileAsync(string, string, string?, string?, UploadRagFileConfig?, Action<double>?, CancellationToken)
Uploads a RAG file to the specified RAG corpus.
public Task<RagFile?> UploadRagFileAsync(string corpusName, string filePath, string? displayName = null, string? description = null, UploadRagFileConfig? uploadRagFileConfig = null, Action<double>? progressCallback = null, CancellationToken cancellationToken = default)
Parameters
corpusNamestringThe name of the target RAG corpus to which the file will be uploaded.
filePathstringThe file path of the RAG file to be uploaded.
displayNamestringAn optional display name for the RAG file.
descriptionstringAn optional description for the RAG file.
uploadRagFileConfigUploadRagFileConfigThe configuration data for uploading the RAG file.
progressCallbackAction<double>An optional callback to report upload progress as a percentage.
cancellationTokenCancellationTokenThe cancellation token to cancel the upload operation.