OpenAILLMClient
open class OpenAILLMClient @JvmOverloads constructor(settings: OpenAIClientSettings = OpenAIClientSettings(), httpClient: KoogHttpClient, clock: KoogClock = KoogClock.System, toolsConverter: OpenAICompatibleToolDescriptorSchemaGenerator = OpenAICompatibleToolDescriptorSchemaGenerator()) : AbstractOpenAILLMClient<OpenAIChatCompletionResponse, OpenAIChatCompletionStreamResponse> (source)
Implementation of LLMClient for OpenAI API.
Parameters
settings
The base URL and timeouts for the OpenAI API, defaults to "https://api.openai.com" and 900 s
httpClient
A fully configured KoogHttpClient for making API requests. Use the secondary constructor that accepts an API key and a KoogHttpClient.Factory to create a client with standard defaults.
clock
Clock instance used for tracking response metadata timestamps.
Constructors
Link copied to clipboard
constructor(settings: OpenAIClientSettings = OpenAIClientSettings(), httpClient: KoogHttpClient, clock: KoogClock = KoogClock.System, toolsConverter: OpenAICompatibleToolDescriptorSchemaGenerator = OpenAICompatibleToolDescriptorSchemaGenerator())
constructor(apiKey: String, settings: OpenAIClientSettings = OpenAIClientSettings(), httpClientFactory: KoogHttpClient.Factory, clock: KoogClock = KoogClock.System, toolsConverter: OpenAICompatibleToolDescriptorSchemaGenerator = OpenAICompatibleToolDescriptorSchemaGenerator())
Functions
Link copied to clipboard
Link copied to clipboard
open suspend override fun execute(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): Message.Assistant
Link copied to clipboard
open suspend override fun executeMultipleChoices(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<Message.Assistant>
Link copied to clipboard
open override fun executeStreaming(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): Flow<StreamFrame>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Returns the specific implementation of the LLMProvider associated with this client.
Link copied to clipboard
Moderates text and image content based on the provided model's capabilities.