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

Fix: Limit number of retries for parse failures #1569

Merged
merged 2 commits into from
Oct 24, 2024

Conversation

rskew
Copy link
Contributor

@rskew rskew commented Oct 24, 2024

When parsing of an LLM response fails, the invalid output is sent to the LLM to be fixed.

This PR threads the number of retries through this call, preventing unbounded recursion.

The old max_retries wasn't preventing this due to generate() and parse_output_string() being co-recursive via the call to generate() here

fixed_output_string = await fix_output_format_prompt.generate(

The result was a prompt that would keep growing through recursive calls (with nested versions becoming increasingly more deeply quoted) until the prompt was too big for the LLM to process.

Addresses #1538

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Oct 24, 2024
@rskew rskew force-pushed the fix-parse-error-recursion branch from cd3c239 to 6bfbccf Compare October 24, 2024 07:16
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Oct 24, 2024
rskew added 2 commits October 24, 2024 18:17
When parsing of an LLM response fails, the invalid output
is sent to the LLM to be fixed.
This fix threads the number of retries through this call,
preventing unbounded recursion.
@rskew rskew force-pushed the fix-parse-error-recursion branch from 6bfbccf to d3798f2 Compare October 24, 2024 07:17
@jjmachan jjmachan merged commit 38d09dc into explodinggradients:main Oct 24, 2024
15 checks passed
@jjmachan
Copy link
Member

@rskew really grateful for these improvements and the very well written PR 🙂 ❤️

ps: we are also doing https://forms.gle/7wdMqwdPghzL2iCn6 as part of the recent v0.2 release - do fill it out if you get the chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants