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.

Validation has already filled it in from the vendor's shared llm4s.credentials.<id>.apiKey when the section set none, so this fails only for a section that did not come through validation - one built in code.

Attributes

def requireAuthExtra(providerName: String, auth: AuthConfig, key: String): Result[String]

Reads a key the provider declares in ProviderConfigSpec.authExtras as required, or gives a default.

Reads a key the provider declares in ProviderConfigSpec.authExtras as required, or gives a default.

Validation has already enforced that, so this fails only for a section that did not come through validation - one built in code and handed to buildConfig directly.

Value parameters

key

the declared key's name, e.g. "tokenUrl".

Attributes

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

Reads a provider-specific key that the provider's ProviderConfigSpec.extras declares as required, or gives a default.

Reads a provider-specific key that the provider's ProviderConfigSpec.extras declares as required, or gives a default.

Validation has already enforced that, so this fails only for a section that did not come through validation - one built in code and handed to buildConfig directly.

Value parameters

key

the declared key's name, e.g. "region".

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