org.llm4s.llmconnect.spi.ProviderDescriptor
See theProviderDescriptor companion object
@Stable
trait ProviderDescriptor
Everything llm4s needs to know about one LLM provider, supplied by the provider itself.
A descriptor is the whole extension point: implement it, register it (by listing it in an Llm4sProviderModule, or by handing it to ProviderRegistry.of), and the provider becomes reachable from configuration, validation, client construction and model discovery without editing anything in llm4s-core. Before this existed, adding a provider meant edits to roughly eight shared files — see #1131.
Attributes
- Example
-
object BedrockProvider extends ProviderDescriptor: val id = ProviderId("bedrock") val configSpec = ProviderConfigSpec( extras = Seq( ProviderConfigKey.required("region", "the AWS region hosting the model, e.g. us-east-1"), ProviderConfigKey.optional("profile", "the AWS named profile to authenticate with") ) ) def buildConfig(providerName: String, section: NamedProviderConfig)(using ContextWindowResolver ): Result[ProviderConfig] = ProviderDescriptor .requireExtra(providerName, section, "region") .flatMap(region => BedrockConfig.fromValues(section.model.asString, region, section.extra("profile"))) def buildClient(config: ProviderConfig, options: LlmClientOptions)(using ModelRegistryService ): Result[LLMClient] = ProviderDescriptor.expectConfig[BedrockConfig](id, config).flatMap(BedrockClient(_, options.metrics)) - Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object AnthropicProviderobject AzureProviderobject BedrockProviderobject CohereProviderobject DeepSeekProviderobject GeminiProviderobject MistralProviderobject OllamaProviderobject OpenAICompatibleProviderobject OpenAIProviderobject OpenRouterProviderobject RequestyProviderobject VertexAIProviderobject WatsonXProviderobject ZaiProvider
Members list
In this article