deepset-ai / deepset-ai/haystack-core-integrations

Allow custom assistant role message content in request body in AnthropicClaudeAdapter

Open
#1,720 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

integration:amazon-bedrock P3
Dominant language
Python
Stars
203
Forks
332
Avg merge
2d 4h
Merged PRs (30d)
80

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the AnthropicClaudeAdapter implementation in integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/adapters.py, especially lines 135-148, and trace how AmazonBedrockGenerator.run builds the messages request. Done means the run API can pass custom assistant-role content to AnthropicClaudeAdapter through the messages API, while preserving the existing user-prompt behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
ai
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.