Table of Contents

Class AzureContainerAppsCodeInterpreterService

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

Provides a code session service that uses Azure Container Apps Dynamic Sessions to execute code.

public class AzureContainerAppsCodeInterpreterService : AzureContainerAppsServiceBase, ICodeSessionProviderService
Inheritance
AzureContainerAppsCodeInterpreterService
Implements
Inherited Members
Extension Methods

Constructors

AzureContainerAppsCodeInterpreterService(IHttpClientFactory, IOptions<AzureContainerAppsCodeInterpreterServiceSettings>, ILogger<AzureContainerAppsCodeInterpreterService>)

Provides a code session service that uses Azure Container Apps Dynamic Sessions to execute code.

public AzureContainerAppsCodeInterpreterService(IHttpClientFactory httpClientFactory, IOptions<AzureContainerAppsCodeInterpreterServiceSettings> options, ILogger<AzureContainerAppsCodeInterpreterService> logger)

Parameters

httpClientFactory IHttpClientFactory

The factory used to create HttpClient instances.

options IOptions<AzureContainerAppsCodeInterpreterServiceSettings>

The options for the Azure Container Apps code execution service.

logger ILogger<AzureContainerAppsCodeInterpreterService>

The logger used for logging.

Properties

ProviderName

Gets the name of the code session provider.

public string ProviderName { get; }

Property Value

string

Methods

CreateCodeSession(string, string, string, string, string, UnifiedUserIdentity)

Creates a new code session.

public Task<CreateCodeSessionResponse> CreateCodeSession(string instanceId, string agentName, string conversationId, string context, string language, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The unique identifier of the FoundationaLLM instance.

agentName string

The name of the agent for which the code execution session is created.

conversationId string

The unique identifier of the conversation.

context string

The context in which the code execution session is created. This is usually the name of the agent tool, but it is not limited to that.

language string

The code session programing language.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing the user identity information.

Returns

Task<CreateCodeSessionResponse>

A CreateCodeSessionResponse object with the properties of the code execution session.

DeleteCodeSessionFileStoreItems(string, string)

Deletes all files from a code session.

public Task DeleteCodeSessionFileStoreItems(string codeSessionId, string endpoint)

Parameters

codeSessionId string

The identifier of the code session.

endpoint string

The endpoint of the code session service.

Returns

Task

DownloadFileFromCodeSession(string, string, string, string)

Downloads a file from a code session.

public Task<Stream?> DownloadFileFromCodeSession(string codeSessionId, string endpoint, string fileName, string filePath)

Parameters

codeSessionId string

The identifier of the code session.

endpoint string

The endpoint of the code session service.

fileName string

The name of the file to download.

filePath string

The path to the file to download.

Returns

Task<Stream>

A stream with the binary content of the file.

GetCodeSessionFileStoreItems(string, string)

Lists files from a code session.

public Task<List<CodeSessionFileStoreItem>> GetCodeSessionFileStoreItems(string codeSessionId, string endpoint)

Parameters

codeSessionId string

The identifier of the code session.

endpoint string

The endpoint of the code session service.

Returns

Task<List<CodeSessionFileStoreItem>>

The list of file paths from the code session.

UploadFileToCodeSession(string, string, string, Stream)

Uploads a file to a code execution session.

public Task<bool> UploadFileToCodeSession(string codeSessionId, string endpoint, string fileName, Stream fileContent)

Parameters

codeSessionId string

The identifier of the code session.

endpoint string

The endpoint of the code session service.

fileName string

The name of the file to upload.

fileContent Stream

The stream containing the binary content of the file to upload.

Returns

Task<bool>