Fix fail-open for grayswan and pass metadata to cygnal api endpoint - #19837
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@jquinter can you review this? |
| def _is_grayswan_block_exception(self, exc: HTTPException) -> bool: | ||
| detail = getattr(exc, "detail", None) | ||
| if isinstance(detail, dict): | ||
| return detail.get("error") == "Blocked by Gray Swan Guardrail" |
There was a problem hiding this comment.
Blocked by Gray Swan Guardrai
this should be in constants.py file
There was a problem hiding this comment.
can grayswan guarantee this won't change ?
There was a problem hiding this comment.
In global constants.py might be not the best idea? I put it as a local constant so when the error is raised when this is checked it is always going to use the same const so should be fine now.
| is_output=is_output, | ||
| ) | ||
| return result | ||
| except ModifyResponseException: |
There was a problem hiding this comment.
can this section be a function itself. handle_grayswan_exception()
There was a problem hiding this comment.
optimize the exception handling to be much cleaner
|
Linter is not passing due a dependency issue, not directly related to your PR, but if you could change this line in BEFORE AFTER |
|
Done but it leads to conflict. will let you handle that. |
|
same comment - let's revert the pyproject changes - we cannot merge due to this. @jquinter noting for future - we should not ask oss contributors to make this change. |
This reverts commit 4eece15.
|
Bumping this up thanks! |
2b25d03
into
BerriAI:litellm_oss_staging_02_03_2026
…erriAI#19837) * fix fail-open for grayswan; pass metadata to cygnal api endpoint; update docs * pass litellm_metadata to cygnal in payload * switch error msg to const, and clean exception handling. * update pyproject.toml as requested * Revert "update pyproject.toml as requested" This reverts commit 4eece15.

Relevant issues
Partially dependent on the fix on anthropic response mutation issue #19784
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unitType
🐛 Bug Fix
Changes
metadatafield inextra_bodyto grayswan cygnal endpoint.litellm_metadatafromrequest_datato grayswan cygnal endpoint