4dad8be36b
Tutti i tier (S/A/B/C/D) ora passano per OpenRouter via OpenAI SDK.
Modelli Anthropic raggiungibili via prefisso `anthropic/...`.
- pyproject: rimosso `anthropic>=0.39` da deps + uv.lock
- config: rimosso `anthropic_api_key` field
- LLMClient: dispatch unico, single client OpenAI con base_url OpenRouter
- defaults S/A/B → `anthropic/claude-{opus-4-7,sonnet-4-6}`
- retry exceptions: solo openai.* (drop anthropic.*)
- test rinominati e adattati: tier S/A/B mockano OpenAI con prefisso `anthropic/`
- rimosso test `tier_S_without_anthropic_key_raises` (non più rilevante)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
"""Pydantic settings loader for Multi_Swarm_Coevolutive.
|
|
|
|
Loads configuration from environment variables and an optional ``.env`` file
|
|
in the project root. Required secrets are validated at instantiation time.
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
from pydantic import Field, SecretStr
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
extra="ignore",
|
|
case_sensitive=False,
|
|
)
|
|
|
|
cerbero_base_url: str = "http://localhost:9000"
|
|
cerbero_testnet_token: SecretStr
|
|
cerbero_mainnet_token: SecretStr | None = None
|
|
cerbero_bot_tag: str = "swarm-poc-phase1"
|
|
|
|
openrouter_api_key: SecretStr
|
|
|
|
llm_model_tier_s: str = "anthropic/claude-opus-4-7"
|
|
llm_model_tier_a: str = "anthropic/claude-sonnet-4-6"
|
|
llm_model_tier_b: str = "anthropic/claude-sonnet-4-6"
|
|
llm_model_tier_c: str = "qwen/qwen-2.5-72b-instruct"
|
|
llm_model_tier_d: str = "meta-llama/llama-3.3-70b-instruct"
|
|
openrouter_base_url: str = "https://openrouter.ai/api/v1"
|
|
|
|
run_name: str = "phase1-spike-001"
|
|
data_dir: Path = Field(default=Path("./data"))
|
|
series_dir: Path = Field(default=Path("./series"))
|
|
db_path: Path = Field(default=Path("./runs.db"))
|
|
|
|
|
|
def load_settings() -> Settings:
|
|
# Required fields are populated from environment / .env, not init kwargs.
|
|
return Settings() # type: ignore[call-arg]
|