* Optimize cache performance by avoiding expensive operations when caching is disabled
- Moved cache availability checks before expensive operations to improve performance for non-cached requests
- Updated client code to handle None responses from caching handler
* clean hot path
* Fix TypeError with isinstance check for CustomStreamWrapper in caching
Fixed `TypeError: typing.Any cannot be used with isinstance()` that was
occurring in the caching handler when checking cached streaming responses.
The issue was caused by CustomStreamWrapper being aliased to `typing.Any`
at runtime through the TYPE_CHECKING conditional import pattern. When the
code attempted to use isinstance(cached_result, CustomStreamWrapper) at
lines 222 and 338, it failed because Python's isinstance() cannot be used
with typing.Any.
Solution: Import CustomStreamWrapper at runtime separately from the
TYPE_CHECKING block, while keeping a type alias for static type checking.
This allows isinstance checks to work properly while maintaining type hints.
* fix: remove unnecessary type checking
* feat: UI to add specific tools under creating MCP connection
* chore: pydantic + prisma changes
* feat: adding specific MCP tools now works
* fix: allowed tools filtering
* chore: filtered list to mcp server cost config
* chore: update Readme
* chore: refactor the filtering
* test: Added tests
When the allowed_tests is null, empty list or populated
* chore: resolve the proxy issue
* feat: updating MCP tool filtering
• Preserve newlines and spaces as content
• Remove .strip() call on strings
• Treat all non-empty strings as meaningful
• Update logic comment for clarity
• Fix edge case with whitespace-only text
* perf(router): optimize unhealthy deployment filtering in retry path
Convert unhealthy_deployments list to set for O(1) lookups in
_async_get_healthy_deployments, reducing complexity from O(n*m) to O(n+m).
This method is called on every retry attempt (inside the retry loop), so
the optimization compounds during failures:
Before: 100 deployments × 50 unhealthy = 5,000 operations per call
After: 100 deployments + 50 unhealthy = 150 operations per call
Impact during cascading failures:
- With 1000 req/sec, 40% error rate, 3 retries
- Prevents 32M+ operations/sec during incidents
- Critical for preventing router CPU spikes when you need performance most
Matches the pattern already used in _filter_cooldown_deployments (line 7272).
* fix: Undefined name HTTPException
* added oauth mcp to docs
* added azure ai/grok-4 model family
* Revert "added oauth mcp to docs"
This reverts commit 950b7cef44f14b2db1429f6fbd32548a7c95d325.