claude_sonnet_4
What it is
- A module-level definition of a preconfigured Anthropic Claude Sonnet 4 chat model wrapped in
naas_abi_core.models.Model.ChatModel. - Exposes constants for the model ID and provider plus a ready-to-use
modelobject.
Public API
MODEL_ID: str- The Anthropic model name:
"claude-sonnet-4-20250514".
- The Anthropic model name:
PROVIDER: str- Provider identifier:
"anthropic".
- Provider identifier:
model: ChatModel- A
ChatModelinstance configured with:model_id=MODEL_IDprovider=PROVIDERmodel=ChatAnthropic(...)using:model_name=MODEL_IDtemperature=0max_retries=2api_key=SecretStr(ABIModule.get_instance().configuration.anthropic_api_key)timeout=Nonestop=None
- A
Configuration/Dependencies
- Dependencies:
langchain_anthropic.ChatAnthropicnaas_abi_marketplace.ai.claude.ABIModule(used to fetch configuration)naas_abi_core.models.Model.ChatModelpydantic.SecretStr
- Required configuration:
ABIModule.get_instance().configuration.anthropic_api_keymust be set and accessible at import time.
Usage
from naas_abi_marketplace.ai.claude.models.claude_sonnet_4 import model
# Use `model` with the APIs expected by `naas_abi_core.models.Model.ChatModel`.
# (Exact invocation depends on ChatModel's interface in your environment.)
print(model.model_id, model.provider)
Caveats
- Import-time initialization:
- The module constructs the model on import; missing/invalid
anthropic_api_keyinABIModuleconfiguration can cause import failures.
- The module constructs the model on import; missing/invalid
- Retries/temperature are fixed here (
max_retries=2,temperature=0) unless you modify the source or wrap/replace the model instance.