Repository navigation
translator: map Bedrock guardrail_intervened to finish_reason content_filter - #2897
Open
pcbeingused333 wants to merge 2 commits into
Open
pcbeingused333 wants to merge 2 commits into
pcbeingused333 wants to merge 2 commits into
Conversation
…_filter bedrockStopReasonToOpenAIStopReason handled content_filtered but not guardrail_intervened, which fell to the default and was reported as a normal stop. A Bedrock Guardrails block now finishes with content_filter for OpenAI-API clients, in both the streaming and the non-streaming path. Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>
✅ Deploy Preview for theagentrouter canceled.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Author
|
@gavrissh thanks for the approval on the 27th. The branch is still mergeable with main; the only red check is This comment was drafted with Claude Code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
bedrockStopReasonToOpenAIStopReasonmapscontent_filteredtocontent_filterbut notguardrail_intervened(awsbedrock.StopReasonGuardrailIntervenedis defined and unused), so a Bedrock Guardrails block falls to the default and looks like a normalstopto OpenAI-API clients. This adds it to thecontent_filteredcase; the function is used by both the streaming and the non-streaming path.TestBedrockStopReasonToOpenAIStopReasonis a table test over the known stop reasons; theguardrail intervenedrow fails onmain(stopinstead ofcontent_filter) and passes here.This PR was prepared with an AI coding assistant (Claude Code), and the submitter is responsible for it.
Related Issues/PRs (if applicable)
None found: no open issue or PR on this stop reason.
Special notes for reviewers (if applicable)
go test ./internal/translator/(whole package) passes with Go 1.27.2;make precommitwas not run.