Skip to content

LlmFactory ​

Category: Agent

Source: llm_factory.dart

Classes ​

LlmClientFactory ​

Creates [LlmClient] instances from a [ModelRef] via the adapter registry.

The legacy provider-enum switch is gone — every client flows through catalog → resolved provider + model → adapter.createClient.

Constructor ​

dart
LlmClientFactory(this._config)
dart
LlmClientFactory(
        _config.copyWith(reasoning: const ReasoningConfig()),
      )

Methods ​

LlmClient createFor(ModelRef ref, {required String systemPrompt}) ​

Build an [LlmClient] for [ref]. Resolves the provider (credentials included), looks up the adapter by wire protocol, and delegates.

Throws [ConfigError] when the provider is unknown or the adapter has not been registered.

LlmClient createFromConfig({required String systemPrompt}) ​

Shortcut: use the config's [GlueConfig.activeModel].

LlmClient createSmall({required String systemPrompt}) ​

Client for the configured small model — titles, recaps, and anything else cheap and out-of-band.

Reasoning is forced back to auto: the small model usually doesn't support whatever effort the user picked for the main model, and [createFor] would throw [ConfigError] rather than fall back. Thinking on a one-line summary is wasted latency and spend regardless.

Released under the MIT License.