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: improved path detection in prompts, now works with more adjacent punctuation types #333

Merged
merged 1 commit into from
Dec 14, 2024

Conversation

ErikBjare
Copy link
Owner

@ErikBjare ErikBjare commented Dec 14, 2024

… punctuation types

@Miyou reported this when it didn't read a file that he had followed with a ,


Important

Improved path detection in prompts to handle more punctuation types and added tests for this functionality.

  • Behavior:
    • Improved path detection in _find_potential_paths() in chat.py to handle paths with adjacent punctuation (e.g., !, ?, ,, .).
    • Excludes paths within code blocks from detection.
  • Testing:
    • Added test_find_potential_paths() in test_chat.py to verify detection of various path formats and exclusion of paths in code blocks.
    • Added test_find_potential_paths_empty() to check behavior with empty content.
    • Added test_find_potential_paths_punctuation() to test path detection with trailing punctuation.

This description was created by Ellipsis for c353e4c. It will automatically update as commits are pushed.

@ErikBjare ErikBjare changed the title fix: improved path detection in prompts, now works with more adjacent… fix: improved path detection in prompts, now works with more adjacent punctuation types Dec 14, 2024
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 everything up to c353e4c in 1 minute and 6 seconds

More details
  • Looked at 215 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. gptme/chat.py:316
  • Draft comment:
    Consider using a single rstrip call to remove all punctuation characters at once for better performance and readability.
word = word.rstrip('?.!,')
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The _find_potential_paths function uses multiple rstrip calls to remove punctuation, which can be optimized by using a single rstrip call with all characters.
2. gptme/chat.py:325
  • Draft comment:
    Consider using a single rstrip call to remove all punctuation characters at once for better performance and readability.
word = word.rstrip('?.!,')
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The _find_potential_paths function uses multiple rstrip calls to remove punctuation, which can be optimized by using a single rstrip call with all characters. This is also applicable in another part of the function.

Workflow ID: wflow_LQ7agiPK6YqBzSQI


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@codecov-commenter
Copy link

codecov-commenter commented Dec 14, 2024

Codecov Report

Attention: Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 72.88%. Comparing base (d598ff3) to head (c353e4c).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
gptme/chat.py 96.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #333      +/-   ##
==========================================
+ Coverage   72.77%   72.88%   +0.10%     
==========================================
  Files          67       67              
  Lines        4951     4967      +16     
==========================================
+ Hits         3603     3620      +17     
+ Misses       1348     1347       -1     
Flag Coverage Δ
anthropic/claude-3-haiku-20240307 70.92% <96.66%> (+0.19%) ⬆️
openai/gpt-4o-mini 69.51% <96.66%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ErikBjare ErikBjare merged commit 8e8f28e into master Dec 14, 2024
7 checks passed
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