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

Suggestion: add pysnooper.snoop decorator to add failing function's variables' types/values/updates to error message context #1

Open
mlaugharn opened this issue Mar 19, 2023 · 5 comments

Comments

@mlaugharn
Copy link

mlaugharn commented Mar 19, 2023

pysnooper.snoop() is a decorator that helps automate printf style debugging: example

import pysnooper

@pysnooper.snoop()
def number_to_bits(number):
    if number:
        bits = []
        while number:
            number, remainder = divmod(number, 2)
            bits.insert(0, remainder)
        return bits
    else:
        return [0]

number_to_bits(6)

example

I think this will help focus/improve GPT-4's debugging ability - https://github.com/cool-RR/PySnooper

There's also torchsnooper for even better snoop insight into pytorch

@Tes-star
Copy link

Cool idea. As it increases the number of tokens it increases costs and reduces the maximal length of processed code as far as I know. Could be an additional option.

@AswanthManoj
Copy link

Does vectorizing the Python code make it easier for the LLM to understand the syntax and semantics of the code, and potentially provide better suggestions for error fixes?

@biobootloader
Copy link
Owner

thanks for the tip, I will look into PySnooper!

@biobootloader
Copy link
Owner

Does vectorizing the Python code make it easier for the LLM to understand the syntax and semantics of the code, and potentially provide better suggestions for error fixes?

GPT-4 is pretty good at understanding syntax, loops, etc. It's possible it could help, feel free to experiment and let us know!

@jakob1379
Copy link

I mean, you could simply cut out the first row with timestamps to reduce the number of token. But I would suggest making a test in all 3 cases to compare the performance

biobootloader pushed a commit that referenced this issue Apr 14, 2023
Reconcile with master branch
prayagnshah added a commit to prayagnshah/wolverine that referenced this issue Apr 15, 2023
commit 742aaaf
Merge: f2d21e7 fe87faa
Author: biobootloader <[email protected]>
Date:   Fri Apr 14 15:44:12 2023 -0700

    Merge pull request biobootloader#13 from fsboehme/main

    more robust parsing of JSON (+ indentation)

commit fe87faa
Author: Felix Boehme <[email protected]>
Date:   Fri Apr 14 17:49:48 2023 -0400

    cleanup

commit 4db9d1b
Author: Felix Boehme <[email protected]>
Date:   Fri Apr 14 17:49:09 2023 -0400

    more cleanup

commit e1d0a79
Author: Felix Boehme <[email protected]>
Date:   Fri Apr 14 17:46:18 2023 -0400

    cleanup

commit b044882
Author: Felix Boehme <[email protected]>
Date:   Fri Apr 14 17:37:27 2023 -0400

    remove duplicate code from rebase

commit dd174cf
Author: Felix Boehme <[email protected]>
Date:   Fri Apr 14 17:15:07 2023 -0400

    add DEFAULT_MODEL to .env.sample

    + fix typo

commit 2497fb8
Author: Felix Boehme <[email protected]>
Date:   Fri Apr 14 16:29:45 2023 -0400

    move json_validated_response to standalone function

commit 923f705
Author: Felix Boehme <[email protected]>
Date:   Thu Apr 13 11:35:24 2023 -0400

    update readme

    - updated readme to mention .env
    - added model arg back

commit 0656a83
Author: Felix Boehme <[email protected]>
Date:   Thu Apr 13 11:29:06 2023 -0400

    recursive calls if not json parsable

    - makes recursive calls to API (with a comment about it not being parsable) if response was not parsable
    - pass prompt.txt as system prompt
    - use env var for `DEFAULT_MODEL`
    - use env var for OPENAI_API_KEY

commit 7c072fb
Author: Felix Boehme <[email protected]>
Date:   Thu Apr 13 11:24:41 2023 -0400

    update prompt to make it pay attention to indentation

commit c62f91e
Author: Felix Boehme <[email protected]>
Date:   Thu Apr 13 11:23:44 2023 -0400

    Update .gitignore

commit f2d21e7
Merge: 0420860 6343f6f
Author: biobootloader <[email protected]>
Date:   Fri Apr 14 13:59:44 2023 -0700

    Merge pull request biobootloader#12 from chriscarrollsmith/main

    Implemented .env file API key storage

commit 6343f6f
Author: biobootloader <[email protected]>
Date:   Fri Apr 14 13:59:31 2023 -0700

    Apply suggestions from code review

commit d87ebfa
Merge: 9af5480 75f08e2
Author: Christopher Carroll Smith <[email protected]>
Date:   Fri Apr 14 16:53:25 2023 -0400

    Merge branch 'main' of https://github.com/chriscarrollsmith/wolverine

commit 9af5480
Author: Christopher Carroll Smith <[email protected]>
Date:   Fri Apr 14 16:53:02 2023 -0400

    Added python-dotenv to requirements.txt

commit 75f08e2
Merge: e8a8931 0420860
Author: Christopher Carroll Smith <[email protected]>
Date:   Fri Apr 14 16:50:29 2023 -0400

    Merge pull request biobootloader#1 from biobootloader/main

    Reconcile with master branch

commit 0420860
Merge: d547822 6afb4db
Author: biobootloader <[email protected]>
Date:   Fri Apr 14 13:22:53 2023 -0700

    Merge pull request biobootloader#20 from eltociear/patch-1

    fix typo in README.md

commit d547822
Merge: 1b9649e 4863df6
Author: biobootloader <[email protected]>
Date:   Fri Apr 14 13:19:43 2023 -0700

    Merge pull request biobootloader#17 from hemangjoshi37a/main

    added `star-history` ⭐⭐⭐⭐⭐

commit 6afb4db
Author: Ikko Eltociear Ashimine <[email protected]>
Date:   Fri Apr 14 16:37:05 2023 +0900

    fix typo in README.md

    reliablity -> reliability

commit 4863df6
Author: Hemang Joshi <[email protected]>
Date:   Fri Apr 14 10:27:32 2023 +0530

    added `star-history`

    added `star-history`

commit e8a8931
Author: Christopher Carroll Smith <[email protected]>
Date:   Wed Apr 12 13:45:54 2023 -0400

    Implemented .env file API key storage
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

No branches or pull requests

5 participants