fix: derive LLM provider from adapter, not config
Remove redundant models.provider from team.yaml. Each adapter knows its own provider key — AnthropicAdapter always looks up 'anthropic' in the capability_map. This avoids a footgun where adapters.llm and models.provider could disagree. Future adapters (OpenAIAdapter, OllamaAdapter) will hardcode their own key the same way.
This commit is contained in:
@@ -22,7 +22,6 @@ class AnthropicAdapter(LLMAdapter):
|
||||
Reads model configuration from the loaded team.yaml config dict::
|
||||
|
||||
models:
|
||||
provider: anthropic
|
||||
default_max_tokens: 4096 # fallback max_tokens for all calls
|
||||
default_temperature: 0 # fallback temperature for all calls
|
||||
capability_map:
|
||||
@@ -33,6 +32,10 @@ class AnthropicAdapter(LLMAdapter):
|
||||
fast-cheap:
|
||||
anthropic: claude-haiku-3-5
|
||||
|
||||
The provider key used when looking up ``capability_map`` is hardcoded to
|
||||
``"anthropic"`` — the adapter knows its own provider; there is no need for
|
||||
a separate ``models.provider`` config field.
|
||||
|
||||
Both ``default_max_tokens`` and ``default_temperature`` can be overridden
|
||||
per-call via the ``context`` dict passed to :meth:`complete`.
|
||||
|
||||
@@ -116,15 +119,15 @@ class AnthropicAdapter(LLMAdapter):
|
||||
-------
|
||||
Anthropic model identifier (e.g. "claude-opus-4-6").
|
||||
"""
|
||||
provider: str = self._models_cfg.get("provider", "anthropic")
|
||||
# The adapter knows its own provider — no need to read it from config.
|
||||
cap_map: dict = self._models_cfg.get("capability_map", {})
|
||||
|
||||
if capability in cap_map and provider in cap_map[capability]:
|
||||
return cap_map[capability][provider]
|
||||
if capability in cap_map and "anthropic" in cap_map[capability]:
|
||||
return cap_map[capability]["anthropic"]
|
||||
|
||||
# Fall back to "capable" tier
|
||||
if "capable" in cap_map and provider in cap_map["capable"]:
|
||||
return cap_map["capable"][provider]
|
||||
if "capable" in cap_map and "anthropic" in cap_map["capable"]:
|
||||
return cap_map["capable"]["anthropic"]
|
||||
|
||||
# Hard-coded last resort
|
||||
return "claude-sonnet-4-6"
|
||||
|
||||
@@ -10,7 +10,6 @@ adapters:
|
||||
runtime: openclaw
|
||||
|
||||
models:
|
||||
provider: anthropic
|
||||
default_max_tokens: 4096
|
||||
default_temperature: 0
|
||||
capability_map:
|
||||
|
||||
Reference in New Issue
Block a user