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
IAzureCosmosDBFileServiceThe Azure Cosmos DB service providing database services.
storageService
IStorageServiceThe 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
stringThe FoundationaLLM instance identifier.
origin
stringThe origin of the file.
conversationId
stringThe conversation identifier.
fileName
stringThe original name of the file.
contentType
stringThe content type of the file.
content
StreamThe Stream providing the raw content of the file.
userIdentity
UnifiedUserIdentityThe 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
stringThe FoundationaLLM instance identifier.
fileId
stringThe identifier of the file.
userIdentity
UnifiedUserIdentityThe 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
stringThe FoundationaLLM instance identifier.
conversationId
stringThe conversation identifier.
fileName
stringThe name of the file to retrieve.
userIdentity
UnifiedUserIdentityThe 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
stringThe FoundationaLLM instance identifier.
fileId
stringThe identifier of the file.
userIdentity
UnifiedUserIdentityThe UnifiedUserIdentity providing details about the user identity.
Returns
- Task<ContextFileRecord>
A ContextFileRecord with the file record.