haystack-core-integrations icon indicating copy to clipboard operation
haystack-core-integrations copied to clipboard

Allow custom assistant role message content in request body in AnthropicClaudeAdapter

Open tlam-lyra opened this issue 7 months ago • 1 comments

Is your feature request related to a problem? Please describe. I'd like to prefill assistant role message content (as outlined here in Claude's official doc: https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/prefill-claudes-response) using AmazonBedrockGenerator component

Describe the solution you'd like Add additional param in run method of AmazonBedrockGenerator component that allows prefilling custom assistant role message in request body for AnthropicClaudeAdapter using messages api

Current implementation does not allow such behavior. It only allows passing in user prompt but not prefilling Claude response through custom assistant role message content. See https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/adapters.py#L135-L148

tlam-lyra avatar May 08 '25 20:05 tlam-lyra

Hey @tlam-lyra thanks for your request! I did want to let you know we have a Chat variant of this generator called AmazonBedrockChatGenerator (docs here) which should support this behavior already. Since we use the Converse API there and allow sending a list of messages at runtime.

sjrl avatar May 09 '25 05:05 sjrl