OpenAIProvider
classin packageklyn.llm
public class OpenAIProvider extends Object implements LLMProvider:
└ OpenAIProvider
All Implemented Interfaces: LLMProvider
OpenAI-compatible HTTP provider. Despite its name, this class targets the chat-completions style API used by many OpenAI-compatible providers.
Fields
Modifier and Type Member Description
public apiKey
apiKey as String
Bearer API key.
public baseUrl
baseUrl as String
Provider API root.
public httpClient
httpClient as HttpClient
HTTP client used for provider calls.
public model
model as String
Model identifier.
public temperature
temperature as Double
Sampling temperature.
Properties
Modifier and Type Member Description
public readonly property chatCompletionsUrl
chatCompletionsUrl as String:
Returns the final chat-completions endpoint.
Properties inherited from Object: type
Constructors
Modifier and Type Member Description
public OpenAIProvider
OpenAIProvider(baseUrl as String, apiKey as String, model as String, temperature as Double = 0.7):
Creates a configured provider.
Methods
Modifier and Type Member Description
public override complete
complete(request as LLMRequest) as LLMResponse throws Exception:
Sends one completion request.
Methods inherited from Object: fromJson, toDict, toJson, toString, toXml