Table of Contents

Class FilesController

Namespace
FoundationaLLM.Core.API.Controllers
Assembly
FoundationaLLM.Core.API.dll

Provides methods for retrieving and managing files.

[Authorize(AuthenticationSchemes = "Bearer", Policy = "MicrosoftEntraIDStandard")]
[Authorize(AuthenticationSchemes = "AgentAccessToken", Policy = "FoundationaLLMAgentAccessToken")]
[ApiController]
[Route("instances/{instanceId}/[controller]")]
public class FilesController : ControllerBase
Inheritance
FilesController
Inherited Members
Extension Methods

Constructors

FilesController(IOrchestrationContext, IOptions<InstanceSettings>, ICoreService, ILogger<FilesController>)

The controller for managing files.

public FilesController(IOrchestrationContext callContext, IOptions<InstanceSettings> instanceOptions, ICoreService coreService, ILogger<FilesController> logger)

Parameters

callContext IOrchestrationContext

The IOrchestrationContext call context of the request being handled.

instanceOptions IOptions<InstanceSettings>

The options providing the InstanceSettings with instance settings.

coreService ICoreService

The ICoreService core service.

logger ILogger<FilesController>

Exceptions

ResourceProviderException

Methods

Delete(string, List<string>)

Deletes the specified file(s).

[HttpPost("delete")]
public Task<IActionResult> Delete(string instanceId, List<string> resourcePaths)

Parameters

instanceId string

The instance ID.

resourcePaths List<string>

The list of object identifiers to be deleted.

Returns

Task<IActionResult>

Download(string, string, string)

Downloads a file.

[HttpGet("{fileProvider}/{fileId}")]
public Task<IActionResult> Download(string instanceId, string fileProvider, string fileId)

Parameters

instanceId string

The instance ID.

fileProvider string

The name of the file provider.

fileId string

The identifier of the file.

Returns

Task<IActionResult>

The file content.

Remarks

The following file providers are supported:

  • FoundationaLLM.Attachments
  • FoundationaLLM.AzureOpenAI

Upload(string, string, string, IFormFile)

Uploads an attachment.

[HttpPost("upload")]
public Task<IActionResult> Upload(string instanceId, string sessionId, string agentName, IFormFile file)

Parameters

instanceId string

The instance ID.

sessionId string

The session ID from which the file is uploaded.

agentName string

The agent name.

file IFormFile

The file sent with the HTTP request.

Returns

Task<IActionResult>