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

Improve PlanningOutputParser whitespace handling #5143

Merged
merged 1 commit into from
May 23, 2023

Conversation

TMRolle
Copy link
Contributor

@TMRolle TMRolle commented May 23, 2023

Some LLM's will produce numbered lists with leading whitespace, i.e. in response to "What is the sum of 2 and 3?":

Plan:
  1. Add 2 and 3.
  2. Given the above steps taken, please respond to the users original question.

This commit updates the PlanningOutputParser regex to ignore leading whitespace before the step number, enabling it to correctly parse this format.

Some LLM's will produce numbered lists with leading whitespace, i.e.
```
Plan:
  1. Add 2 and 3.
  2. Given the above steps taken, please respond to the users original question.
```
This commit updates the PlanningOutputParser regex to ignore leading whitespace before the step number, enabling it to parse this format.
@dev2049
Copy link
Contributor

dev2049 commented May 23, 2023

thanks @TMRolle!

@dev2049 dev2049 added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label May 23, 2023
@dev2049 dev2049 merged commit 754b513 into langchain-ai:master May 23, 2023
vowelparrot pushed a commit that referenced this pull request May 24, 2023
Some LLM's will produce numbered lists with leading whitespace, i.e. in
response to "What is the sum of 2 and 3?":
```
Plan:
  1. Add 2 and 3.
  2. Given the above steps taken, please respond to the users original question.
```
This commit updates the PlanningOutputParser regex to ignore leading
whitespace before the step number, enabling it to correctly parse this
format.
@danielchalef danielchalef mentioned this pull request Jun 5, 2023
This was referenced Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm PR looks good. Use to confirm that a PR is ready for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants