OpenAILLMClient
open class OpenAILLMClient(apiKey: String, settings: OpenAIClientSettings = OpenAIClientSettings(), baseClient: HttpClient = HttpClient(), clock: Clock = Clock.System) : LLMEmbeddingProvider, LLMClient(source)
Implementation of LLMClient for OpenAI API. Uses Ktor HttpClient to communicate with the OpenAI API.
Parameters
apiKey
The API key for the OpenAI API
settings
The base URL and timeouts for the OpenAI API, defaults to "https://api.openai.com" and 900 s
clock
Clock instance used for tracking response metadata timestamps.
Constructors
Link copied to clipboard
constructor(apiKey: String, settings: OpenAIClientSettings = OpenAIClientSettings(), baseClient: HttpClient = HttpClient(), clock: Clock = Clock.System)
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
Link copied to clipboard
Moderates text and image content based on the provided model's capabilities.