Table of Contents

Class FileService

Namespace
FoundationaLLM.Context.Services
Assembly
FoundationaLLM.Context.dll

Provides the implementation for the FoundationaLLM File service.

public class FileService : IFileService
Inheritance
FileService
Implements
Inherited Members
Extension Methods

Constructors

FileService(IAzureCosmosDBFileService, IStorageService, ILogger<FileService>)

Provides the implementation for the FoundationaLLM File service.

public FileService(IAzureCosmosDBFileService cosmosDBService, IStorageService storageService, ILogger<FileService> logger)

Parameters

cosmosDBService IAzureCosmosDBFileService

The Azure Cosmos DB service providing database services.

storageService IStorageService

The IStorageService providing storage services.

logger ILogger<FileService>

The logger used for logging.

Methods

CreateFile(string, string, string, string, string, Stream, UnifiedUserIdentity, Dictionary<string, string>?)

Create a new file.

public Task<ContextFileRecord> CreateFile(string instanceId, string origin, string conversationId, string fileName, string contentType, Stream content, UnifiedUserIdentity userIdentity, Dictionary<string, string>? metadata)

Parameters

instanceId string

The FoundationaLLM instance identifier.

origin string

The origin of the file.

conversationId string

The conversation identifier.

fileName string

The original name of the file.

contentType string

The content type of the file.

content Stream

The Stream providing the raw content of the file.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing details about the user identity.

metadata Dictionary<string, string>

Optional metadata dictionary associated with the file.

Returns

Task<ContextFileRecord>

A ContextFileRecord instance with details about the newly created file.

GetFileContent(string, string, UnifiedUserIdentity)

Get the binary content of a file.

public Task<ContextFileContent?> GetFileContent(string instanceId, string fileId, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

fileId string

The identifier of the file.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing details about the user identity.

Returns

Task<ContextFileContent>

A ContextFileContent instance with the content of the file.

GetFileContent(string, string, string, UnifiedUserIdentity)

Get the binary content of a file.

public Task<ContextFileContent?> GetFileContent(string instanceId, string conversationId, string fileName, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

conversationId string

The conversation identifier.

fileName string

The name of the file to retrieve.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing details about the user identity.

Returns

Task<ContextFileContent>

A ContextFileContent instance with the content of the file.

GetFileRecord(string, string, UnifiedUserIdentity)

Get the file record associated with a file.

public Task<ContextFileRecord?> GetFileRecord(string instanceId, string fileId, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

fileId string

The identifier of the file.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing details about the user identity.

Returns

Task<ContextFileRecord>

A ContextFileRecord with the file record.