ianarawjo / ChainForge

An open-source visual programming environment for battle-testing prompts to LLMs.
https://chainforge.ai/docs
MIT License
2.28k stars 178 forks source link

Anthropic Claude: The Messages API accepts a top-level `system` parameter, not \"system\" as an input message role. #271

Closed tfriedel closed 6 months ago

tfriedel commented 6 months ago

I set up this flow: TextFields node with 2 different system messages -> Prompt node with this text:

{=system_msg}
How to grow okra?

3 different models: gpt 3.5 turbo, gpt4 and claude haiku

So far so good, I can generate responses for all 3 models.

Then I add a Chat Turn node with this content:

I plant to grow  it.

[x] Continue with prior LLMs.

For ChatGPT this works, but for Claude I get this error: Claude: "invalid_request_error: messages: Unexpected role \"system\". The Messages API accepts a top-level system parameter, not \"system\" as an input message role."

ianarawjo commented 6 months ago

Thanks for the feedback. This error occurs because of a nuance in how Anthropic now deals with system messages in their new Messages API. It should now be fixed.