haystack-core-integrations
haystack-core-integrations copied to clipboard
Allow custom assistant role message content in request body in AnthropicClaudeAdapter
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
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.