Class CodeSessionService
- Namespace
- FoundationaLLM.Context.Services
- Assembly
- FoundationaLLM.Context.dll
Implements the FoundationaLLM Code Session service.
public class CodeSessionService : ICodeSessionService
- Inheritance
-
CodeSessionService
- Implements
- Inherited Members
- Extension Methods
Constructors
CodeSessionService(IFileService, IAzureCosmosDBCodeSessionService, IEnumerable<ICodeSessionProviderService>, IResourceValidatorFactory, ILogger<CodeSessionService>)
Implements the FoundationaLLM Code Session service.
public CodeSessionService(IFileService fileService, IAzureCosmosDBCodeSessionService cosmosDBService, IEnumerable<ICodeSessionProviderService> codeSessionProviderServices, IResourceValidatorFactory resourceValidatorFactory, ILogger<CodeSessionService> logger)
Parameters
fileService
IFileServiceThe file service used for file operations.
cosmosDBService
IAzureCosmosDBCodeSessionServiceThe Azure Cosmos DB service providing database services.
codeSessionProviderServices
IEnumerable<ICodeSessionProviderService>The code session provider services.
resourceValidatorFactory
IResourceValidatorFactoryThe resource validator factory.
logger
ILogger<CodeSessionService>The logger used for logging.
Methods
CreateCodeSession(string, CreateCodeSessionRequest, UnifiedUserIdentity)
Creates a new code session using one of the registered code session providers.
public Task<CreateCodeSessionResponse> CreateCodeSession(string instanceId, CreateCodeSessionRequest codeSessionRequest, UnifiedUserIdentity userIdentity)
Parameters
instanceId
stringThe unique identifier of the FoundationaLLM instance.
codeSessionRequest
CreateCodeSessionRequestThe CreateCodeSessionRequest providing the details of the request to create the code session.
userIdentity
UnifiedUserIdentityThe UnifiedUserIdentity providing the user identity information.
Returns
- Task<CreateCodeSessionResponse>
The properties of the code execution session.
DownloadFilesFromCodeSession(string, string, string, UnifiedUserIdentity)
Downloads newly created files from a code session.
public Task<CodeSessionFileDownloadResponse> DownloadFilesFromCodeSession(string instanceId, string sessionId, string operationId, UnifiedUserIdentity userIdentity)
Parameters
instanceId
stringThe FoundationaLLM instance identifier.
sessionId
stringThe identifier of the code session from where the files must be downloaded.
operationId
stringThe code session file upload operation identifier.
userIdentity
UnifiedUserIdentityThe UnifiedUserIdentity providing the user identity information.
Returns
- Task<CodeSessionFileDownloadResponse>
The result of downloading the newly created in the form of a dictionary with file names and file identifiers.
Remarks
By newly created files we mean files that were not uploaded to the code session but were created during the code execution.
The operationId
is the identifier of the file upload operation that initially uploaded the files.
UploadFilesToCodeSession(string, string, CodeSessionFileUploadRequest, UnifiedUserIdentity)
Uploads files to a code session.
public Task<CodeSessionFileUploadResponse> UploadFilesToCodeSession(string instanceId, string sessionId, CodeSessionFileUploadRequest request, UnifiedUserIdentity userIdentity)
Parameters
instanceId
stringThe FoundationaLLM instance identifier.
sessionId
stringThe identifier of the code session where the files must be uploaded.
request
CodeSessionFileUploadRequestThe CodeSessionFileUploadRequest providing the details of the request.
userIdentity
UnifiedUserIdentityThe UnifiedUserIdentity providing the user identity information.
Returns
- Task<CodeSessionFileUploadResponse>
The result of uploading the files to the code session in the form of a dictionary where the keys are the file names and the values are true/false.