Skip to content

fix: use UserPromptMessage instead of AssistantPromptMessage for resp…#167

Open
harryzsh wants to merge 1 commit into
aws-samples:mainfrom
harryzsh:fix/response-format-use-user-message
Open

fix: use UserPromptMessage instead of AssistantPromptMessage for resp…#167
harryzsh wants to merge 1 commit into
aws-samples:mainfrom
harryzsh:fix/response-format-use-user-message

Conversation

@harryzsh

Copy link
Copy Markdown

…onse_format hint

Issue #, if available:

fixing this issue langgenius/dify-official-plugins#2824

Description of changes:

Since AWS bedrock converse API doesn't support prefill (dify has a feature to set structured output in such format like json), we will need to replace the assistance message with user message and i have tested it with claude opus 4.6 which works perfectly fine with the user message but again for some other LLM, the json format may not always be enforced.

The real fix is to add in the nre structured output https://docs.aws.amazon.com/bedrock/latest/userguide/structured-output.html to the existing code but it requires a lot of code change as well as boto3 upgrade which requires thorough test before release

Hence, the short fix which can unblock our user quickly is to replace assistance message with user message first.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@nadazero

nadazero commented Apr 16, 2026

Copy link
Copy Markdown

@harryzsh Thank you for your support!! Your solution is simple but effective.

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