wolverine icon indicating copy to clipboard operation
wolverine copied to clipboard

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

Open mlaugharn opened this issue 2 years ago • 5 comments

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

mlaugharn avatar Mar 19 '23 00:03 mlaugharn

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.

Tes-star avatar Mar 19 '23 08:03 Tes-star

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?

AswanthManoj avatar Apr 02 '23 21:04 AswanthManoj

thanks for the tip, I will look into PySnooper!

biobootloader avatar Apr 03 '23 00:04 biobootloader

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!

biobootloader avatar Apr 03 '23 00:04 biobootloader

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

jakob1379 avatar Apr 12 '23 07:04 jakob1379