Skip to main content
Claude 4.6+ does not support assistant message prefill. Enable append_trailing_user_message to append a trailing user turn when the conversation ends with an assistant message (e.g. during reasoning).
append_trailing_user_message.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export environment variables

4

Run the example

Save the code above as append_trailing_user_message.py, then run:
Full source: cookbook/90_models/aws/claude/append_trailing_user_message.py