Add `ContextWindowExceeded` exception for context window errors
Closed
DS
2mo ago+111802+111802+012345678901234567890123456789012345678901234567890123456789-17-17-01234567890123456789
Summary
- Adds
ContextWindowExceededexception to detect when providers return context window/token limit exceeded errors - Implemented detection for: OpenAI, Anthropic, Google, Groq, Bedrock, Mistral, Cohere
- Exception provides
status_code,model_name, and rawbodyfor debugging
Test plan
- VCR tests for all providers that raise
ContextWindowExceeded - Google test skips when credentials unavailable
- All existing model tests still pass
-
make typecheckpasses
Closes #4060
š¤ Generated with Claude Code
- Review AI generated code