Skip to main content

Gateway Class

The main class for interacting with LLMs through the Adaline Gateway.

Constructor

Parameters

options
GatewayOptionsType
Optional configuration for plugins.

Methods

completeChat

Non-streaming chat completion. Sends messages to an LLM and returns the full response.
request
GatewayCompleteChatRequestType
required
Returns: CompleteChatHandlerResponseType

streamChat

Streaming chat completion. Returns an async generator that yields response chunks.
request
GatewayStreamChatRequestType
required
Same shape as completeChat request. See above.
Returns: AsyncGenerator<StreamChatHandlerResponseType>

getEmbeddings

Generate embeddings for text or other modalities.
request
GatewayGetEmbeddingsRequestType
required
Returns: GetEmbeddingsHandlerResponseType

getToolResponses

Execute tool calls returned by an LLM.
request
GatewayGetToolResponsesRequestType
required
Returns: GetToolResponsesHandlerResponseType

getChatUsageCost (static)

Calculate the cost of a chat completion based on token usage.
Returns: GetChatUsageCostHandlerResponseType