Skip to content

Modify regex #1236

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

Open
AInitikesh opened this issue Feb 8, 2025 · 1 comment · May be fixed by #1307
Open

Modify regex #1236

AInitikesh opened this issue Feb 8, 2025 · 1 comment · May be fixed by #1307
Labels
bug Bugs reported by users good first issue Good for newcomers scope:magics Issues concerning the magic commands
Milestone

Comments

@AInitikesh
Copy link

ollama:deepseek-coder-v2
Generates code like bellow

 ```python
def add(a, b):
    if b == 0:
        return float('inf')  # Using infinity to avoid division by zero
    else:
        return a / b
add(1,0)

where there is space before ```python causing the output to be incorrect. Need to modify the lang_indicator as follows.

lang_indicator = r"^\s*```[a-zA-Z0-9]\s\n"

@srdas srdas added bug Bugs reported by users good first issue Good for newcomers labels Feb 8, 2025
@srdas
Copy link
Collaborator

srdas commented Feb 8, 2025

@AInitikesh Thanks for noticing this and raising the issue, as well as the proposed fix in magics.py. Why not open a PR with the correction, showing the problem first and the fix after the code change? Also test to make sure it does not break python code generation by other LLMs? Add screenshots as needed. You can use the Contributor documentation to set up for this: https://jupyter-ai.readthedocs.io/en/latest/contributors/index.html.

@dlqqq dlqqq added this to the v3.0.0rcx milestone Apr 2, 2025
@Jiya873 Jiya873 linked a pull request Apr 4, 2025 that will close this issue
@dlqqq dlqqq added the scope:magics Issues concerning the magic commands label Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs reported by users good first issue Good for newcomers scope:magics Issues concerning the magic commands
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants