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

feat(sidebar): enhance pattern matching for local LLM (closes #588) #589

Merged
merged 1 commit into from
Sep 15, 2024

Conversation

ddillert
Copy link
Contributor

@ddillert ddillert commented Sep 15, 2024

This update strengthens pattern matching to handle slight deviations in output introduced by local LLMs. Instead of manually adjusting templates for each LLM, we capture the most common variations to improve robustness, while ensuring compatibility with the officially supported LLM (e.g., Claude-3.5-Sonnet).

Enhanced Pattern Matching:

The primary pattern we are currently targeting is:

  • "Replace lines: 5-7"

This update also captures the following common deviations:

  • " Replace lines: 5-7" — Extra whitespace after a line break.
  • "1. Replace lines: 5-7" — Numbered changes.
  • "1 Replace lines: 5-7" — Numbering without punctuation.
  • "1) Replace lines: 5-7" and "1.) Replace lines: 5-7" — Different numbering formats.
  • "Replace lines 5-7" — Missing colon (:), now optional.
  • "Replace line: 5" — Singular line references.
  • "And replace lines: 5-7" — Optional keywords before the pattern.
  • "replace lines: 5-7" — Case-insensitive matching.

Additionally, we now support indented code blocks, allowing for whitespace before the opening backticks (```). Previously, code blocks could not be indented, which caused issues when certain LLMs added indentation to code snippets. This update ensures that these blocks can be correctly processed and included in the original file.

By broadening pattern recognition, this update ensures we capture common deviations from local LLMs while preserving compatibility with officially supported models.

- Extend pattern matching beyond "Replace lines: {{start_line}}-{{end_line}}" to support variations such as:
  - Extra whitespace
  - Numbered changes
  - Optional colons
  - Case insensitivity (upper- and lowercase)
  - Singular line references

- Add support for indented code snippets, allowing whitespace before code
blocks beginning with three backticks (```)
@ddillert
Copy link
Contributor Author

The PR likely addresses the issue mentioned in #588.

@aarnphm aarnphm changed the title Enhancing pattern matching for local LLM variations feat(sidebar): enhance pattern matching for local LLM (closes #588) Sep 15, 2024
Copy link
Collaborator

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this

@aarnphm aarnphm merged commit 6604d03 into yetone:main Sep 15, 2024
4 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