Table of Contents

Class DownstreamAPIService

Namespace
FoundationaLLM.Common.Services.API
Assembly
FoundationaLLM.Common.dll

Contains methods for interacting with the downstream API.

public class DownstreamAPIService : IDownstreamAPIService
Inheritance
DownstreamAPIService
Implements
Inherited Members
Extension Methods

Constructors

DownstreamAPIService(string, IOrchestrationContext, IHttpClientFactoryService, ILogger<DownstreamAPIService>)

Contains methods for interacting with the downstream API.

public DownstreamAPIService(string downstreamHttpClientName, IOrchestrationContext callContext, IHttpClientFactoryService httpClientFactoryService, ILogger<DownstreamAPIService> logger)

Parameters

downstreamHttpClientName string

The name of the downstream HTTP client.

callContext IOrchestrationContext

Stores context information extracted from the current HTTP request. This information is primarily used to inject HTTP headers into downstream HTTP calls.

httpClientFactoryService IHttpClientFactoryService

The HTTP client factory service.

logger ILogger<DownstreamAPIService>

The ILogger used for logging.

Properties

APIName

The name of the downstream API.

public string APIName { get; }

Property Value

string

Methods

GetCompletion(string, CompletionRequest)

Gets a completion from the downstream API.

public Task<CompletionResponse> GetCompletion(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<CompletionResponse>

The completion response.

GetCompletionOperationStatus(string, string)

Gets the status of a completion operation.

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 an LongRunningOperation object containing the OperationId and Status.

StartCompletionOperation(string, CompletionRequest)

Begins a completion operation.

public Task<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<LongRunningOperation>

Returns an LongRunningOperation object containing the OperationId and Status.