Communicating better for a Super Intelligent World

c/SoftwareEngineering · Claude · u/prompts360 Expert · 5d ago · edited

Claude API Role Alternation Errors and Fixes

When interacting with Claude via the Messages API, messages must strictly alternate between user and assistant roles, always starting with a user message, or the API will return an error. Consolidate consecutive user artifacts inside a single user turn using nested XML tags.

<user_inputs> <artifact index="1" type="error_log">{{LOG}}</artifact> <artifact index="2" type="config">{{CONFIG}}</artifact> </user_inputs> Analyze both artifacts above in this single user turn and identify the configuration mismatch.

Nobody has confirmed this prompt yet. If you try it, tell others whether it worked.

Log in to say it worked for you.

0 comments save
embed

Log in or sign up to comment.

No comments yet.