feat: add provider arbitrage policy and fallback routing

This commit is contained in:
Musa 2026-03-18 15:54:49 -07:00
parent de2d8847f3
commit 07ad4c6ae2
No known key found for this signature in database
10 changed files with 670 additions and 57 deletions

View file

@ -289,6 +289,107 @@ llm_providers:
tracing:
random_sampling: 100
""",
},
{
"id": "arbitrage_policy_enabled_requires_non_empty_rank",
"expected_error": "arbitrage_policy.enabled=true but rank is empty",
"plano_config": """
version: v0.1.0
listeners:
egress_traffic:
address: 0.0.0.0
port: 12000
message_format: openai
timeout: 30s
llm_providers:
- model: openai/gpt-4o-mini
access_key: $OPENAI_API_KEY
default: true
arbitrage_policy:
enabled: true
rank: []
""",
},
{
"id": "arbitrage_policy_rank_candidate_must_exist",
"expected_error": "arbitrage_policy.rank candidate 'openai/not-configured'",
"plano_config": """
version: v0.1.0
listeners:
egress_traffic:
address: 0.0.0.0
port: 12000
message_format: openai
timeout: 30s
llm_providers:
- model: openai/gpt-4o-mini
access_key: $OPENAI_API_KEY
default: true
arbitrage_policy:
enabled: true
rank:
- openai/not-configured
""",
},
{
"id": "arbitrage_policy_rejects_duplicate_rank_entries",
"expected_error": "duplicate entries in arbitrage_policy.rank",
"plano_config": """
version: v0.1.0
listeners:
egress_traffic:
address: 0.0.0.0
port: 12000
message_format: openai
timeout: 30s
llm_providers:
- model: openai/gpt-4o-mini
access_key: $OPENAI_API_KEY
default: true
arbitrage_policy:
enabled: true
rank:
- openai/gpt-4o-mini
- openai/gpt-4o-mini
""",
},
{
"id": "arbitrage_policy_valid_rank",
"expected_error": None,
"plano_config": """
version: v0.1.0
listeners:
egress_traffic:
address: 0.0.0.0
port: 12000
message_format: openai
timeout: 30s
llm_providers:
- model: openai/gpt-4o-mini
access_key: $OPENAI_API_KEY
default: true
- model: openai/gpt-4o
access_key: $OPENAI_API_KEY
- model: groq/llama-3.1-8b-instant
access_key: $GROQ_API_KEY
arbitrage_policy:
enabled: true
rank:
- openai/gpt-4o-mini
- openai/gpt-4o
on_failure:
fallback_to_primary: true
""",
},
]