Skip to content

Handle action code that exceeds the max_tokens by truncating code after last full action and adding three backticks. #563

Description

@lyie28

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:

  1. 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

  2. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions