plasma-umass / chatdbg Goto Github PK
View Code? Open in Web Editor NEWChatDBG - AI-assisted debugging. Uses AI to answer 'why'
License: Apache License 2.0
ChatDBG - AI-assisted debugging. Uses AI to answer 'why'
License: Apache License 2.0
When the user has no access to GPT-4, or when there is not enough money in the account, the HTTP requests succeeds but the JSON contains an error message, which causes soe KeyNotFoundError
. Currently, we report this as if OPENAI_API_KEY
was not defined, when it is.
@ravenblood000 and I ran into this because there is some issue with her account, actually took us quite a while debugging.
We should report better when such an issue occurs. I will look into it, maybe https://github.com/plasma-umass/cwhy also has the same issue.
I'm trying to load a core and its binary.
While trying with the why
I'm getting
(gdb-ChatDBG) why
Execution stopped at a breakpoint, not an error.
(gdb-ChatDBG)
Is it not supported yet?
I teach out of JupyterLab notebooks. Given time, I might be able to write a notebook extension that makes use of this. I'll let you know if I can get around to it.
Hello developers,
Can you point me to good first steps towards learning the pre-reqs for this project (video tutorials, or books etc). I was always passionate about the idea of a smoother debugging workflow, but hardly have any idea as to how to 'hack into' a code-editor's debugger and make it work programmatically. Any help is much appreciated. Looking forward to making a small contribution to this amazing project! ๐ Thank you!
(Self-explanatory)
In some places, it's not convenient to access openai addresses, or the speed of response from azure is much better than from openai directly. thanks!
macOS 13.2.1
$ echo $OPENAI_API_KEY
$ python3 --version
Python 3.10.10
$ python3 -m pip install chatdbg
$ python3 -m chatdbg -c continue testme.py
ZeroDivisionError: division by zero
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> ~/chatdbg/test/testme.py(4)tryme()
-> if x / i > 2:
(ChatDBG Pdb) why
EXCEPTION 'choices'
(ChatDBG Pdb)
It starts working after setting OPENAI_API_KEY
$ export OPENAI_API_KEY=<key>
$ python3 -m chatdbg -c continue testme.py
ZeroDivisionError: division by zero
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> ~/chatdbg/test/testme.py(4)tryme()
-> if x / i > 2:
(ChatDBG Pdb) why
The root cause of the error is that the code tries to divide by zero.
This occurs in the `tryme` function where `range(100)` includes the
value 0, and the code tries to divide by 0 on the line `if x / i >
2:`.
Tried with test_c.cpp
on WSL2.
I get this error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/[email protected]/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/homebrew/Cellar/[email protected]/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/juraj/tmp/models/lib/python3.10/site-packages/chatdbg/__main__.py", line 22, in <module>
main()
File "/Users/juraj/tmp/models/lib/python3.10/site-packages/chatdbg/__main__.py", line 20, in main
chatdbg.main()
File "/Users/juraj/tmp/models/lib/python3.10/site-packages/chatdbg/chatdbg.py", line 1789, in main
pdb.interaction(None, t)
File "/Users/juraj/tmp/models/lib/python3.10/site-packages/chatdbg/chatdbg.py", line 428, in interaction
self._cmdloop()
File "/Users/juraj/tmp/models/lib/python3.10/site-packages/chatdbg/chatdbg.py", line 393, in _cmdloop
self.cmdloop()
File "/opt/homebrew/Cellar/[email protected]/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
File "/Users/juraj/tmp/models/lib/python3.10/site-packages/chatdbg/chatdbg.py", line 493, in onecmd
return cmd.Cmd.onecmd(self, line)
File "/opt/homebrew/Cellar/[email protected]/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/cmd.py", line 217, in onecmd
return func(arg)
File "/Users/juraj/tmp/models/lib/python3.10/site-packages/chatdbg/chatdbg.py", line 996, in do_why
asyncio.run(chatdbg_why.why(self, arg))
File "/opt/homebrew/Cellar/[email protected]/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/opt/homebrew/Cellar/[email protected]/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/Users/juraj/tmp/models/lib/python3.10/site-packages/chatdbg/chatdbg_why.py", line 51, in why
positions = inspect.getframeinfo(frame).positions
AttributeError: 'Traceback' object has no attribute 'positions'
Regardless of actual exception. I have OPENAPI_AI_KEY set up.
There is no "why" for this exception ๐
Litellm supports function calls; not sure how well they work but this would enable the use of ChatDBG with other AI providers, notably Amazon AWS Bedrock.
Expected to be cleanly formatted, but is not.
The root cause of this error is that the variable `x` is initialized
to 1.0, and then iteratively multiplied by `i` in the `for` loop in
the `fact` function. However, the loop starts from `i = 0.0`, which
means that `x` will always be multiplied by 0 in the first iteration,
resulting in `x` being 0.0. The subsequent `assert` statement checks
if `x` is not equal to 0.0, which will always fail.
To fix this error, we need to initialize `x` to 1.0 instead of 0.0.
This can be done by changing the initialization of `i` in the `for`
loop to start from 1.0 instead of 0.0.
Fixed source code: ``` /* frame 0 */ /* frame 1 */ /* frame 2 */ /*
frame 3 */ /* frame 4 */ #include <assert.h> #include <iostream>
float fact(float n) { auto x = 1.0; for (auto i = 1.0; i < n; i++)
{ x *= i; } assert(x != 0.0); ^-----------------------------
------------------------------------------------ /* frame 5 */ for
(auto i = 1.0; i < n; i++) { x *= i; } assert(x != 0.0);
return x; }
int main()
{
std::cout << fact(100) << std::endl;
^-----------------------------------------------------------------------------
```
With this fix, `x` will correctly accumulate the product of `i`
values, starting from 1 instead of 0, and the `assert` statement will
not fail.
@ravenblood000 and I ran into issues installing chatDBG. Culprit seems to be f330919, specifically this line. I suspect it works on your Python version but not other versions.
Reproduction.
% docker run -it ubuntu
% apt update
% apt install -y git python3 python3-pip
% git clone https://github.com/plasma-umass/ChatDBG.git
% cd ChatDBG
% python3 -m pip install --upgrade pip
% python3 -m pip install -e .
% python3 -m chatdbg
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/ChatDBG/src/chatdbg/__main__.py", line 3, in <module>
from . import chatdbg
File "/ChatDBG/src/chatdbg/chatdbg.py", line 14, in <module>
from pdb import Pdb, Restart, _ModuleTarget, _ScriptTarget
ImportError: cannot import name '_ModuleTarget' from 'pdb' (/usr/lib/python3.10/pdb.py)
Would you consider adding a command that inspects the current state of a program at the stopped breakpoint to answer questions such as "Is parameter 'a' equal to parameter 'b'?" This feature would utilize natural language, eliminating the need to declare a local watch with.
Could you help me with this issue?
env:
Linux fc10339df926 5.4.126-1.el7.elrepo.x86_64 #1 SMP Mon Jun 14 17:48:40 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux
debugger: lldb 14.0.0
compiler: clang++15
python and pip:
Python 3.10.6
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
install command
apt update
apt-get install python3-pip -y
python3 -m pip install chatdbg
python3 -c 'import chatdbg; print(f"command script import {chatdbg.__path__[0]}/chatdbg_lldb.py")' >> ~/.lldbinit
~/.lldbinit
command script import /usr/local/lib/python3.10/dist-packages/chatdbg/chatdbg_lldb.py
usage:
I want to use LLDB to debug my unit test, and meet this error
lldb ./src/unit_tests_dbms
root@fc10339df926:/clickhouse/build_debug_# lldb ./src/unit_tests_dbms
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'lldb.embedded_interpreter'
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'lldb' is not defined
error: module importing failed: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.10/dist-packages/chatdbg/chatdbg_lldb.py", line 8, in <module>
def __lldb_init_module(debugger: lldb.SBDebugger, internal_dict: dict) -> None:
AttributeError: module 'lldb' has no attribute 'SBDebugger'
Unable to execute this program. Can you help me?
(venv) ghost:testLLMDebugging hemanth$ chatdbg -c continue executeProgram.py
Traceback (most recent call last):
File "/Users/hemanth/Documents/work/plv/testLLMDebugging/venv/lib/python3.11/site-packages/chatdbg/chatdbg.py", line 77, in main
pdb._run(target)
File "/Users/hemanth/Documents/work/plv/testLLMDebugging/venv/lib/python3.11/site-packages/chatdbg/pdb.py", line 1643, in _run
self.run(target.code)
File "/Users/hemanth/.pyenv/versions/3.11.4/lib/python3.11/bdb.py", line 600, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "/Users/hemanth/Documents/work/plv/testLLMDebugging/executeProgram.py", line 9, in <module>
print(tryme(100))
^^^^^^^^^^
File "/Users/hemanth/Documents/work/plv/testLLMDebugging/executeProgram.py", line 4, in tryme
if x / i > 2:
~~^~~
ZeroDivisionError: division by zero
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /Users/hemanth/Documents/work/plv/testLLMDebugging/executeProgram.py(4)tryme()
-> if x / i > 2:
(ChatDBG Pdb) why
EXCEPTION _send_to_openai.<locals>.send_to_openai() got an unexpected keyword argument 'stream'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.