3 ms·
Since you say you've found it invaluable for your own projects, can you explain why? What bugs has it found for you that you wouldn't immediately notice by runn
by peter_l_downs 3y ago
Since you say you've found it invaluable for your own projects, can you explain why? What bugs has it found for you that you wouldn't immediately notice by running code or unit tests?
I ask because in the example, you ask it to find bugs in a script that immediately fails when you run it. So I'm not sure what the value add is here.
$ ipython
Python 3.11.3 (main, Apr 7 2023, 21:05:46) [Clang 14.0.0 (clang-1400.0.29.202)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.13.2 -- An enhanced Interactive Python. Type '?' for help.
In [1]: def greet(name, age):
...: print("hello, my name is {} and I am {} years old".format(name))
...:
In [2]: greet("John", 25)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[2], line 1
----> 1 greet("John", 25)
Cell In[1], line 2, in greet(name, age)
1 def greet(name, age):
----> 2 print("hello, my name is {} and I am {} years old".format(name))
IndexError: Replacement index 1 out of range for positional args tuple
EDIT: For anyone else who is wondering, this is just:
system prompt:
Find bugs in the user's code.
- Format results as JSON like so:
[{"line":1,"reason":"short reason", "type":"type"},...]
- It is better to return an empty array than a mistake (not really a bug).
user prompt:
Here is my code:
${source_code}
JSON Result:
@funerr why would you even create this and post it here? Is it just to try to market your newsletter? Who do you think would look at this and be impressed?
- funerr 3y agoI personally use a bit of a different prompt, so it's tailored for my repo. But yeah, you can also customize it pretty simply, like you mentioned in the ./src/ai.ts file. This is a blueprint on how to have checks in the CI, it took me sometime to build and get working - do you know anything that does this out of the box? Thanks for the feedback eitherway!