Class FileService
- Namespace
 - FoundationaLLM.Context.Services
 
- Assembly
 - FoundationaLLM.ContextEngine.dll
 
Provides the implementation for the FoundationaLLM File service.
public class FileService : IFileService
  - Inheritance
 - 
      
      FileService
 
- Implements
 
- Inherited Members
 
- Extension Methods
 
Constructors
FileService(IAzureCosmosDBFileService, IStorageService, IAuthorizationServiceClient, FileServiceSettings, ILogger<FileService>)
Provides the implementation for the FoundationaLLM File service.
public FileService(IAzureCosmosDBFileService cosmosDBService, IStorageService storageService, IAuthorizationServiceClient authorizationServiceClient, FileServiceSettings settings, ILogger<FileService> logger)
  Parameters
cosmosDBServiceIAzureCosmosDBFileServiceThe Azure Cosmos DB service providing database services.
storageServiceIStorageServiceThe IStorageService providing storage services.
authorizationServiceClientIAuthorizationServiceClientThe client for the FoundationaLLM Authorization API.
settingsFileServiceSettingsloggerILogger<FileService>The logger used for logging.
Methods
CreateFileForAgent(string, string, string, string, string, Stream, UnifiedUserIdentity, Dictionary<string, string>?)
Create a new file.
public Task<ContextFileRecord> CreateFileForAgent(string instanceId, string origin, string agentName, string fileName, string contentType, Stream content, UnifiedUserIdentity userIdentity, Dictionary<string, string>? metadata)
  Parameters
instanceIdstringThe FoundationaLLM instance identifier.
originstringThe origin of the file.
agentNamestringThe name of the agent.
fileNamestringThe original name of the file.
contentTypestringThe content type of the file.
contentStreamThe Stream providing the raw content of the file.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity providing details about the user identity.
metadataDictionary<string, string>Optional metadata dictionary associated with the file.
Returns
- Task<ContextFileRecord>
 A ContextFileRecord instance with details about the newly created file.
CreateFileForConversation(string, string, string, string, string, Stream, UnifiedUserIdentity, Dictionary<string, string>?)
Create a new file.
public Task<ContextFileRecord> CreateFileForConversation(string instanceId, string origin, string conversationId, string fileName, string contentType, Stream content, UnifiedUserIdentity userIdentity, Dictionary<string, string>? metadata)
  Parameters
instanceIdstringThe FoundationaLLM instance identifier.
originstringThe origin of the file.
conversationIdstringThe conversation identifier.
fileNamestringThe original name of the file.
contentTypestringThe content type of the file.
contentStreamThe Stream providing the raw content of the file.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity providing details about the user identity.
metadataDictionary<string, string>Optional metadata dictionary associated with the file.
Returns
- Task<ContextFileRecord>
 A ContextFileRecord instance with details about the newly created file.
DeleteFileRecord(string, string, UnifiedUserIdentity)
Deletes the file record associated with a file.
public Task DeleteFileRecord(string instanceId, string fileId, UnifiedUserIdentity userIdentity)
  Parameters
instanceIdstringThe FoundationaLLM instance identifier.
fileIdstringThe identifier of the file.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity providing details about the user identity.
Returns
GetFileContent(string, string, UnifiedUserIdentity)
Get the binary content of a file.
public Task<ContextFileContent?> GetFileContent(string instanceId, string fileId, UnifiedUserIdentity userIdentity)
  Parameters
instanceIdstringThe FoundationaLLM instance identifier.
fileIdstringThe identifier of the file.
userIdentityUnifiedUserIdentityThe 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
instanceIdstringThe FoundationaLLM instance identifier.
conversationIdstringThe conversation identifier.
fileNamestringThe name of the file to retrieve.
userIdentityUnifiedUserIdentityThe 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
instanceIdstringThe FoundationaLLM instance identifier.
fileIdstringThe identifier of the file.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity providing details about the user identity.
Returns
- Task<ContextFileRecord>
 A ContextFileRecord with the file record.
ShouldBypassOwnerCheck(string, UnifiedUserIdentity)
public Task<bool> ShouldBypassOwnerCheck(string instanceId, UnifiedUserIdentity userIdentity)
  Parameters
instanceIdstringuserIdentityUnifiedUserIdentity