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: dedent json system prompt #465

Merged
merged 1 commit into from
Mar 2, 2024

Conversation

timothyasp
Copy link
Contributor

@timothyasp timothyasp commented Feb 23, 2024

Removes unnecessary extra whitespace before each line, cutting down on tokens (4 less lol) and possibly improving performance.

Hard to tell these days if indent whitespace messes with OpenAI's models, but with smaller open models it does impact performance.


Ellipsis 🚀 This PR description was created by Ellipsis for commit f49c9b6.

Summary:

The pull request optimizes the handle_response_model function in instructor/patch.py by using dedent to remove unnecessary leading whitespaces from a multi-line string.

Key points:

  • Imported dedent from textwrap module in instructor/patch.py.
  • Applied dedent to a multi-line string in the handle_response_model function to remove leading whitespaces.

Generated with ❤️ by ellipsis.dev

Removes unnecessary extra whitespace before each line, cutting down on tokens and possibly improving performance
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me!

  • Reviewed the entire pull request up to f49c9b6
  • Looked at 27 lines of code in 1 files
  • Took 29 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 1 additional comments because they didn't meet confidence threshold of 85%.
1. instructor/patch.py:134:
  • Assessed confidence : 0%
  • Comment:
    The use of dedent here is appropriate and improves the readability of the code. No issues found.
  • Reasoning:
    The change in this PR is to use the dedent function from the textwrap module to remove leading whitespaces from a multi-line string. This is a good practice as it makes the code cleaner and more readable. The change does not seem to introduce any bugs or violate any best practices. The change is also consistent with the rest of the codebase.

Workflow ID: wflow_9cCrbrEeO0pEGkEt


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

@jxnl jxnl merged commit ed2a702 into instructor-ai:main Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants