Table of Contents

Class CompletionsController

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

Provides methods for retrieving and managing completions.

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

Remarks

Constructor for the Completions Controller.

Constructors

CompletionsController(ICoreService, IOrchestrationContext, IEnumerable<IResourceProviderService>, IQuotaService, ILogger<CompletionsController>)

Methods for orchestration services exposed by the Gatekeeper API service.

public CompletionsController(ICoreService coreService, IOrchestrationContext callContext, IEnumerable<IResourceProviderService> resourceProviderServices, IQuotaService quotaService, ILogger<CompletionsController> logger)

Parameters

coreService ICoreService

The Core service provides methods for getting completions from the orchestrator.

callContext IOrchestrationContext

The call context for the request.

resourceProviderServices IEnumerable<IResourceProviderService>

The list of IResourceProviderService resource provider services.

quotaService IQuotaService

The quota service.

logger ILogger<CompletionsController>

The logging interface used to log under the CompletionsController type name.

Remarks

Constructor for the Orchestration Controller.

Methods

GetAgents(string)

Retrieves a list of global and private agents.

[HttpGet("completions/agents", Name = "GetAgents")]
public Task<IEnumerable<ResourceProviderGetResult<AgentBase>>> GetAgents(string instanceId)

Parameters

instanceId string

The instance ID of the current request.

Returns

Task<IEnumerable<ResourceProviderGetResult<AgentBase>>>

A list of available agents.

GetCompletion(string, CompletionRequest)

Requests a completion from the downstream APIs.

[HttpPost("completions", Name = "GetCompletion")]
public Task<IActionResult> GetCompletion(string instanceId, CompletionRequest completionRequest)

Parameters

instanceId string

The instance ID of the current request.

completionRequest CompletionRequest

The user prompt for which to generate a completion.

Returns

Task<IActionResult>

GetCompletionOperationStatus(string, string)

Gets the status of a completion operation.

[HttpGet("async-completions/{operationId}/status")]
public Task<LongRunningOperation> GetCompletionOperationStatus(string instanceId, string operationId)

Parameters

instanceId string

The FoundationaLLM instance id.

operationId string

The OperationId for which to retrieve the status.

Returns

Task<LongRunningOperation>

Returns a LongRunningOperation object containing the OperationId, Status, and result.

StartCompletionOperation(string, CompletionRequest)

Begins a completion operation.

[HttpPost("async-completions")]
public Task<ActionResult<LongRunningOperation>> StartCompletionOperation(string instanceId, CompletionRequest completionRequest)

Parameters

instanceId string

The FoundationaLLM instance id.

completionRequest CompletionRequest

The completion request containing the user prompt and message history.

Returns

Task<ActionResult<LongRunningOperation>>

Returns an LongRunningOperation object containing the OperationId and Status.