Table of Contents

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

platform IPlatformAdapter

The platform adapter for API communication.

httpClient HttpClient

Optional HTTP client for API requests.

logger ILogger

Optional logger for diagnostic output.

Methods

DeleteRagFileAsync(string, CancellationToken)

Deletes a RAG file.

public Task DeleteRagFileAsync(string name, CancellationToken cancellationToken = default)

Parameters

name string

The name of the RagFile resource to delete.

cancellationToken CancellationToken

The 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

name string

The name of the RagFile resource.

cancellationToken CancellationToken

The cancellation token to cancel the operation.

Returns

Task<RagFile>

The RagFile resource.

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

parent string

The name of the target RagCorpus resource where the RAG files will be imported.

request ImportRagFilesRequest

The request object containing the details and configuration for importing the RAG files.

cancellationToken CancellationToken

The 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

parent string

The name of the RagCorpus resource.

pageSize int?

The maximum number of RAG files to return.

pageToken string

A page token, received from a previous ListRagFilesAsync(string, int?, string?, CancellationToken) call.

cancellationToken CancellationToken

The 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

corpusName string

The name of the target RAG corpus to which the file will be uploaded.

filePath string

The file path of the RAG file to be uploaded.

displayName string

An optional display name for the RAG file.

description string

An optional description for the RAG file.

uploadRagFileConfig UploadRagFileConfig

The configuration data for uploading the RAG file.

progressCallback Action<double>

An optional callback to report upload progress as a percentage.

cancellationToken CancellationToken

The cancellation token to cancel the upload operation.

Returns

Task<RagFile>

The response containing details of the uploaded RagFile.

See Also