diff --git a/agent/core/llm_params.py b/agent/core/llm_params.py index bac5073..e19a402 100644 --- a/agent/core/llm_params.py +++ b/agent/core/llm_params.py @@ -106,8 +106,8 @@ def _resolve_llm_params( will reject this; the probe's cascade catches that and falls back to no thinking. - • ``openai/`` — ``reasoning_effort`` forwarded as a top-level - kwarg (GPT-5 / o-series). LiteLLM uses the user's ``OPENAI_API_KEY``. + • ``openai/`` or ``azure/`` — ``reasoning_effort`` forwarded + as a top-level kwarg. LiteLLM uses the user's API key or Azure credentials. • Anything else is treated as a HuggingFace router id. We hit the auto-routing OpenAI-compatible endpoint at @@ -162,13 +162,14 @@ def _resolve_llm_params( # the same way, so we leave it off for now. return {"model": model_name} - if model_name.startswith("openai/"): + if model_name.startswith(("openai/", "azure/")): params = {"model": model_name} if reasoning_effort: if reasoning_effort not in _OPENAI_EFFORTS: if strict: + provider = "Azure" if model_name.startswith("azure/") else "OpenAI" raise UnsupportedEffortError( - f"OpenAI doesn't accept effort={reasoning_effort!r}" + f"{provider} doesn't accept effort={reasoning_effort!r}" ) else: params["reasoning_effort"] = reasoning_effort diff --git a/agent/core/model_switcher.py b/agent/core/model_switcher.py index 63c0f40..37d33d4 100644 --- a/agent/core/model_switcher.py +++ b/agent/core/model_switcher.py @@ -44,6 +44,7 @@ def is_valid_model_id(model_id: str) -> bool: Accepts: • anthropic/ • openai/ + • azure//[:] (HF router; tag = provider or policy) • huggingface//[:] (same, accepts legacy prefix) @@ -63,10 +64,17 @@ def _print_hf_routing_info(model_id: str, console) -> bool: proceed with the switch, ``False`` to indicate a hard problem the user should notice before we fire the effort probe. - Anthropic / OpenAI ids return ``True`` without printing anything — + Anthropic / OpenAI / Azure ids return ``True`` without printing anything — the probe below covers "does this model exist". """ - if model_id.startswith(("anthropic/", "openai/")): + if model_id.startswith(("anthropic/", "openai/", "azure/")): + import os + if model_id.startswith("azure/") and not os.environ.get("AZURE_API_BASE"): + console.print( + "[bold yellow]Warning:[/bold yellow] AZURE_API_BASE is not set. " + "Ensure AZURE_API_BASE, AZURE_API_KEY (or AZURE_AD_TOKEN), and " + "AZURE_API_VERSION are in your environment." + ) return True from agent.core import hf_router_catalog as cat @@ -139,7 +147,7 @@ def print_model_listing(config, console) -> None: console.print( "\n[dim]Paste any HF model id (e.g. 'MiniMaxAI/MiniMax-M2.7').\n" "Add ':fastest', ':cheapest', ':preferred', or ':' to override routing.\n" - "Use 'anthropic/' or 'openai/' for direct API access.[/dim]" + "Use 'anthropic/', 'openai/', or 'azure/' for direct API access.[/dim]" ) @@ -149,7 +157,8 @@ def print_invalid_id(arg: str, console) -> None: "[dim]Expected:\n" " • /[:tag] (HF router — paste from huggingface.co)\n" " • anthropic/\n" - " • openai/[/dim]" + " • openai/\n" + " • azure/[/dim]" )