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 type yaml, json, etc. not only where there is yaml , but also when there is ```yaml and at least one action - even if there is not three ending backticks
-
In 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.
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
DynamicExtractorget_typeto 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
extractmethod 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.