Skip to content

Conversation

@sonianuj287
Copy link

@sonianuj287 sonianuj287 commented Oct 7, 2025

This PR updates the DefaultLlmImpl class to properly parse responses from the Claude V3 family of Bedrock models. Previously, only the V2 response format (completion field) was supported. With this change, the parser now supports the V3 format (content -> text) while maintaining backward compatibility with V2.

Changes Made

  • Updated buildChatCompletionOutput():
    Detects "content" field for Claude V3 responses.
    Extracts text from the first element of the content list.
    Adds extracted text to answers.
    Added a new unit test in DefaultLlmImplTests.java:
  • testChatCompletionApiForBedrockClaudeV3()
    Mocks a V3-style Bedrock response and validates output parsing.
    Reformatted test files to satisfy Spotless formatting rules.

Why this change is needed
Claude V2 models are deprecated; V3 is the current standard.
Without this fix, requests to "bedrock/anthropic-claude" with V3 models fail to extract answers, causing RAG pipelines to break.
Ensures users don’t need to pass llmResponseField manually for default Bedrock Claude models.

How to test
Run all existing unit tests:
./gradlew clean build

resolves #4168 (comment)

@sonianuj287 sonianuj287 requested a deployment to ml-commons-cicd-env-require-approval October 7, 2025 15:01 — with GitHub Actions Waiting
@sonianuj287 sonianuj287 requested a deployment to ml-commons-cicd-env-require-approval October 7, 2025 15:01 — with GitHub Actions Waiting
@sonianuj287 sonianuj287 requested a deployment to ml-commons-cicd-env-require-approval October 7, 2025 15:01 — with GitHub Actions Waiting
@sonianuj287 sonianuj287 requested a deployment to ml-commons-cicd-env-require-approval October 7, 2025 15:01 — with GitHub Actions Waiting
@sonianuj287 sonianuj287 force-pushed the fix/claude-v3-bedrock-support branch from aa64626 to 540a52e Compare October 7, 2025 15:02
@sonianuj287 sonianuj287 had a problem deploying to ml-commons-cicd-env-require-approval October 7, 2025 15:03 — with GitHub Actions Failure
@sonianuj287 sonianuj287 had a problem deploying to ml-commons-cicd-env-require-approval October 7, 2025 15:03 — with GitHub Actions Error
@sonianuj287 sonianuj287 had a problem deploying to ml-commons-cicd-env-require-approval October 7, 2025 15:03 — with GitHub Actions Failure
@sonianuj287 sonianuj287 had a problem deploying to ml-commons-cicd-env-require-approval October 7, 2025 15:03 — with GitHub Actions Error
@sonianuj287
Copy link
Author

Hi @mingshl @rithin-pullela-aws , Could you please review my PR and suggest changes.

Thanks :)

@mingshl
Copy link
Collaborator

mingshl commented Oct 7, 2025

oh great, this is going to use the same interface string, and it will auto detect these two formats and parse accordingly. Can you also add in ITs? this is the best way we can monitor and keep track when the model interface failed.

I ran your CIs and also I added the resolved issues and link the issue in the PR descriptions.

@sonianuj287 sonianuj287 requested a deployment to ml-commons-cicd-env-require-approval October 7, 2025 20:02 — with GitHub Actions Waiting
@sonianuj287 sonianuj287 requested a deployment to ml-commons-cicd-env-require-approval October 7, 2025 20:02 — with GitHub Actions Waiting
@sonianuj287 sonianuj287 requested a deployment to ml-commons-cicd-env-require-approval October 7, 2025 20:02 — with GitHub Actions Waiting
@sonianuj287 sonianuj287 requested a deployment to ml-commons-cicd-env-require-approval October 7, 2025 20:02 — with GitHub Actions Waiting
@sonianuj287 sonianuj287 had a problem deploying to ml-commons-cicd-env-require-approval October 23, 2025 18:45 — with GitHub Actions Error
@sonianuj287 sonianuj287 had a problem deploying to ml-commons-cicd-env-require-approval October 23, 2025 18:45 — with GitHub Actions Failure
@sonianuj287 sonianuj287 had a problem deploying to ml-commons-cicd-env-require-approval October 23, 2025 18:45 — with GitHub Actions Error
@sonianuj287 sonianuj287 had a problem deploying to ml-commons-cicd-env-require-approval October 24, 2025 05:01 — with GitHub Actions Failure
@sonianuj287 sonianuj287 had a problem deploying to ml-commons-cicd-env-require-approval October 24, 2025 05:01 — with GitHub Actions Error
@sonianuj287 sonianuj287 had a problem deploying to ml-commons-cicd-env-require-approval October 24, 2025 05:01 — with GitHub Actions Failure
@sonianuj287 sonianuj287 had a problem deploying to ml-commons-cicd-env-require-approval October 24, 2025 05:01 — with GitHub Actions Error
@ylwu-amzn ylwu-amzn force-pushed the fix/claude-v3-bedrock-support branch from 8fbd45a to da23d19 Compare October 27, 2025 20:45
@ylwu-amzn
Copy link
Collaborator

rebased with latest main branch

@ylwu-amzn ylwu-amzn had a problem deploying to ml-commons-cicd-env-require-approval October 27, 2025 20:47 — with GitHub Actions Failure
@ylwu-amzn ylwu-amzn had a problem deploying to ml-commons-cicd-env-require-approval October 27, 2025 20:47 — with GitHub Actions Error
@ylwu-amzn ylwu-amzn had a problem deploying to ml-commons-cicd-env-require-approval October 27, 2025 20:47 — with GitHub Actions Error
@ylwu-amzn ylwu-amzn had a problem deploying to ml-commons-cicd-env-require-approval October 27, 2025 20:47 — with GitHub Actions Failure
@ylwu-amzn
Copy link
Collaborator

Can you add some test REST API examples to the description? Like how to create model, how to create pipeline and how to run it. So other reviews can understand more clearly.

@mingshl
Copy link
Collaborator

mingshl commented Oct 27, 2025

can you try remove the response filter in this IT and see if this IT still pass?

+ "\"response_filter\": \"$.content[0].text\""

this response filter was added to force the new interface is working. hopefully after this PR, we don't need changing the connectors.

@ylwu-amzn ylwu-amzn force-pushed the fix/claude-v3-bedrock-support branch from da23d19 to 95fddb8 Compare October 28, 2025 03:45
@ylwu-amzn ylwu-amzn had a problem deploying to ml-commons-cicd-env-require-approval October 28, 2025 03:47 — with GitHub Actions Error
@ylwu-amzn ylwu-amzn had a problem deploying to ml-commons-cicd-env-require-approval October 28, 2025 03:47 — with GitHub Actions Error
@ylwu-amzn ylwu-amzn had a problem deploying to ml-commons-cicd-env-require-approval October 28, 2025 03:47 — with GitHub Actions Failure
@ylwu-amzn ylwu-amzn had a problem deploying to ml-commons-cicd-env-require-approval October 28, 2025 03:47 — with GitHub Actions Failure
@sonianuj287
Copy link
Author

Hi @ylwu-amzn , I can see some test cases failed and your code changes. Let me know my further steps, what actions should I take.
I can take a look for test case fixing, if so anything to keep focus on..

@sonianuj287
Copy link
Author

Can you add some test REST API examples to the description? Like how to create model, how to create pipeline and how to run it. So other reviews can understand more clearly.

Yes, will do that

@sonianuj287
Copy link
Author

can you try remove the response filter in this IT and see if this IT still pass?

+ "\"response_filter\": \"$.content[0].text\""

this response filter was added to force the new interface is working. hopefully after this PR, we don't need changing the connectors.

Thanks for pointing this. surely will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Outdated Default Claude model parsing in Generative QA Processor

5 participants