FlowiseAI / Flowise

Drag & drop UI to build your customized LLM flow
https://flowiseai.com
Apache License 2.0
30.31k stars 15.65k forks source link

[BUG] My flow work with Gpt-4o but not with claude-3.5-sonnet #3181

Open abernardini-inc opened 3 weeks ago

abernardini-inc commented 3 weeks ago

Hello everyone!

I have developed an AgentFlow capable of collecting and returning the information contained in the image of an ID card or a passport. If the uploaded image does not contain one of these documents, it will return an empty JSON.

The flow works using Gpt-4o as the ChatModel, but when I try to change it to Claude-3.5-sonnet, I get the following error:

Error buildAgentGraph - Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Your API request included an assistant message in the final position, which would pre-fill the assistant response. When using tools, pre-filling the assistant response is not supported."}}

It manages to identify through the first LLM Node whether it is an ID card or a passport, but once it reaches the point of evaluating the condition, it stops and returns the error.

Here is the flow:

CM OCR 5.0 Agents.json

I hope someone can help me. Thank you!

Screenshot 2024-09-12 123919
HenryHengZJ commented 2 weeks ago

This is related to the strict requirement of Claude models that require alternate roles between each messages. Currently, every messages between the LLM nodes above is "assistant" role, and Claude doesnt allow that