Skip to content

Fix crash when scorer LLM response is blocked by content filter#2072

Open
hannahwestra25 wants to merge 3 commits into
microsoft:mainfrom
hannahwestra25:hannahwestra25/fix-scorer-content-filter-crash
Open

Fix crash when scorer LLM response is blocked by content filter#2072
hannahwestra25 wants to merge 3 commits into
microsoft:mainfrom
hannahwestra25:hannahwestra25/fix-scorer-content-filter-crash

Conversation

@hannahwestra25

Copy link
Copy Markdown
Contributor

When the scorer's own LLM call is blocked by Azure content filtering (e.g., because it's grading harmful content), the response contains only an error piece with no text piece. The next() generator in _score_value_with_llm_async raises StopIteration, which becomes a RuntimeError inside the async coroutine.

This adds an explicit check before the next() call and raises a descriptive BadRequestException suggesting the user configure a scorer endpoint without content filtering.

hannahwestra25 and others added 3 commits June 23, 2026 21:07
When the scorer's own LLM call is blocked by Azure content filtering,
the response contains only an error piece with no text piece. The
next() call in _score_value_with_llm_async raises StopIteration, which
becomes a RuntimeError inside the async coroutine.

Add an explicit check for all-blocked response pieces before the next()
call and raise a descriptive BadRequestException instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants