AbstractOpenAILLMClient

abstract class AbstractOpenAILLMClient<TResponse : OpenAIBaseLLMResponse, TStreamResponse : OpenAIBaseLLMStreamResponse>(apiKey: String, settings: OpenAIBasedSettings, baseClient: HttpClient = HttpClient(), clock: Clock = Clock.System, logger: KLogger) : LLMClient(source)

Abstract base class for OpenAI-compatible LLM clients. Provides common functionality for communicating with OpenAI and OpenAI-compatible APIs.

Parameters

apiKey

The API key for authentication with the OpenAI-compatible API.

settings

Configuration settings including base URL, API paths, and timeout configuration.

baseClient

The HTTP client to use for API requests. Defaults to a new HttpClient instance.

clock

Clock instance used for tracking response metadata timestamps. Defaults to Clock.System.

Constructors

Link copied to clipboard
constructor(apiKey: String, settings: OpenAIBasedSettings, baseClient: HttpClient = HttpClient(), clock: Clock = Clock.System, logger: KLogger)

Functions

Link copied to clipboard
open suspend override fun execute(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<Message.Response>
Link copied to clipboard
open suspend override fun executeMultipleChoices(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<LLMChoice>
Link copied to clipboard
open override fun executeStreaming(prompt: Prompt, model: LLModel): Flow<String>
Link copied to clipboard
abstract suspend fun moderate(prompt: Prompt, model: LLModel): ModerationResult