ProviderDescriptor

org.llm4s.llmconnect.spi.ProviderDescriptor
See theProviderDescriptor companion trait

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def expectConfig[C <: ProviderConfig](id: ProviderId, config: ProviderConfig)(using ct: ClassTag[C]): Result[C]

Narrows a ProviderConfig to the subtype a provider's client needs.

Narrows a ProviderConfig to the subtype a provider's client needs.

Attributes

Returns

Left with a org.llm4s.error.ConfigurationError naming both the provider and the config type it was handed, when the config belongs to a different provider.

def requireApiKey(providerName: String, section: NamedProviderConfig): Result[String]

Reads the apiKey that a requiresApiKey ProviderConfigSpec guarantees is present.

Reads the apiKey that a requiresApiKey ProviderConfigSpec guarantees is present.

Attributes

def requireField[A](providerName: String, fieldName: String, value: Option[A], hint: String): Result[A]

Reads a required field out of a config section, failing with the message shape used across all providers.

Reads a required field out of a config section, failing with the message shape used across all providers.

Value parameters

fieldName

human-readable field name, e.g. "api key".

hint

where to set it, e.g. "llm4s.providers.<name>.apiKey".

providerName

the user's instance name (llm4s.providers.<name>).

Attributes

def resolveBaseUrl(providerName: String, section: NamedProviderConfig, spec: ProviderConfigSpec): Result[String]

The section's baseUrl, falling back to the spec's defaultBaseUrl.

The section's baseUrl, falling back to the spec's defaultBaseUrl.

Fails only for a provider that has neither — Ollama, whose endpoint is wherever the user happens to run it.

Attributes