Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] LLM Node connected to Tools node produces infinitely growing escape characters in message content. This leads to error: 'Sorry we have encountered an issue with repetitive patterns in your prompt'. #3472

Closed
serhiy-matoffo opened this issue Nov 6, 2024 · 0 comments · Fixed by #3470

Comments

@serhiy-matoffo
Copy link
Contributor

serhiy-matoffo commented Nov 6, 2024

Describe the bug
I have an agentflow containing an LLM Node connected to Tool Node (with a Google Custom Search tool). The content produced by LLM Node tool itself is added to history as an empty string. Each consecutive call of the agentflow calls the restructureMessages method, that will call message.content = JSON.stringify(message.content). For the first call it will convert an empty string to '""', and each consecutive call will just produce new escape characters for existing content. Leading to an ever-growing string looking like this: "\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\. Eventually, ChatGPT will respond with an error: 'Sorry we have encountered an issue with repetitive patterns in your prompt' and the flow will crash.

Fix
I fixed it in #3470 for an empty string case.
For non-empty string - it will not change anything. Not sure if the bug is present for a non-empty string, as I have no idea how to achieve that - in my case it's always empty.

@HenryHengZJ HenryHengZJ linked a pull request Nov 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant