Skip to content

Commit

Permalink
Trying.
Browse files Browse the repository at this point in the history
  • Loading branch information
Emery Berger committed Apr 13, 2024
2 parents 2bbc5d7 + 31d70cd commit d1f5576
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: install test dependencies
run: |
python3 -m pip install pytest pytest-asyncio pytest-forked hypothesis pytest-mock
python3 -m pip install -r test/requirements.txt
python3 -m pip install -r test/requirements.txt
python3 -m pip install .
- name: run tests
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ ChatDBG is an AI-based debugging assistant for C/C++/Python/Rust code that integ

As far as we are aware, ChatDBG is the *first* debugger to automatically perform root cause analysis and to provide suggested fixes.

> [!INFO]
> For technical details and a complete evaluation, see our arXiv paper, [_ChatDBG: An AI-Powered Debugging Assistant_](https://arxiv.org/abs/2403.16354) ([PDF](https://github.com/plasma-umass/ChatDBG/blob/main/ChatDBG-arxiv-2403.16354.pdf)).
For technical details and a complete evaluation, see our arXiv paper, [_ChatDBG: An AI-Powered Debugging Assistant_](https://arxiv.org/abs/2403.16354) ([PDF](https://github.com/plasma-umass/ChatDBG/blob/main/ChatDBG-arxiv-2403.16354.pdf)).

> [!NOTE]
>
> ChatDBG for `pdb` and `lldb` are feature-complete; we are currently backporting features for these debuggers into the other debuggers.
>
## Installation

> [!NOTE]
> [!IMPORTANT]
>
> ChatDBG currently needs to be connected to an [OpenAI account](https://openai.com/api/). _Your account will need to have a positive balance for this to work_ ([check your balance](https://platform.openai.com/account/usage)). If you have never purchased credits, you will need to purchase at least \$1 in credits (if your API account was created before August 13, 2023) or \$0.50 (if you have a newer API account) in order to have access to GPT-4, which ChatDBG uses. [Get a key here.](https://platform.openai.com/account/api-keys)
>
Expand Down
2 changes: 1 addition & 1 deletion src/chatdbg/pdb_util/locals.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _repr_if_defined(obj: Any) -> bool:
return result


def _format_limited(value: Any, limit: int = 10, depth: int = 3) -> str:
def _format_limited(value: Union[int, np.ndarray], limit: int = 10, depth: int = 3) -> str:
def format_tuple(t, depth):
return tuple([helper(x, depth) for x in t])

Expand Down
4 changes: 2 additions & 2 deletions src/chatdbg/util/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@


def _chatdbg_get_env(
option_name: str, default_value: Union[int, bool, str]
) -> Union[int, bool, str]:
option_name: str, default_value: Union[bool, int, str]
) -> Union[bool, int, str]:
env_name = "CHATDBG_" + option_name.upper()
v = os.getenv(env_name, str(default_value))
if type(default_value) == int:
Expand Down
2 changes: 1 addition & 1 deletion src/chatdbg/util/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def _wrap_it(
before: str, text: Optional[str], after: str = "", maxlen: int = 2048
before: str, text: str, after: str = "", maxlen: int = 2048
) -> str:
if text:
text = truncate_proportionally(text, maxlen, 0.5)
Expand Down
2 changes: 1 addition & 1 deletion src/chatdbg/util/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def strip_ansi(s: str) -> str:


def truncate_proportionally(
text: str, maxlen: int = 32000, top_proportion: float = 0.5
text: str, maxlen: int = 32000, top_proportion: Union[float, int] = 0.5
) -> str:
"""Omit part of a string if needed to make it fit in a maximum length."""
if len(text) > maxlen:
Expand Down
4 changes: 2 additions & 2 deletions src/chatdbg/util/trim.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def _chunkify(messages, model):


def trim_messages(
messages: List[Dict], # list of JSON objects encoded as dicts
messages: List[Dict[str, str]], # list of JSON objects encoded as dicts
model: str,
trim_ratio: float = 0.75,
) -> List[Dict]:
) -> list:
"""
Strategy:
- chunk messages:
Expand Down

0 comments on commit d1f5576

Please sign in to comment.