Handle action code that exceeds the max_tokens by truncating code after last full action and adding three backticks. #563
Labels
bug
Something isn't working
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
If the LLM generates an action that is longer than max tokens it will be cut off and not have the final three ticks to end the yaml code, which leads to an error.
To handle this, we can:
In extractors.py:
Change the
DynamicExtractor
get_type
to return the typeyaml, json, etc.
not only where there isyaml
, but also when there is ```yaml and at least one action - even if there is not three ending backticksIn at least YamlFromMarkdownExtractor - as this is the most frequently used extractor - but logic could be applied to others as well:
Modify
extract
method so that if there is three opening backticks but not three ending ones - it will truncate the text after the last full action & then add three backticks, before continuing as normal to return the action text.The text was updated successfully, but these errors were encountered: