Commit graph

769 commits

Author SHA1 Message Date
Paul Gauthier
6c87d5be1c better 2023-06-28 13:52:43 -07:00
Paul Gauthier
777f179c6d better 2023-06-28 10:54:58 -07:00
Paul Gauthier
1ac366aa62 works 2023-06-27 19:38:14 -07:00
Paul Gauthier
582143d563 wip 2023-06-27 18:34:52 -07:00
Paul Gauthier
9cfebc0b60 record response hashes too 2023-06-27 16:11:05 -07:00
Paul Gauthier
974d96973c move the empty list into init 2023-06-27 15:00:49 -07:00
Paul Gauthier
64e16c8ad1 aider: Added SHA1 hash of kwargs to chat_completion_call_hashes in send_with_retries method.
# Context:
USER: when calling `ChatCompletion`, take a sha1 hash of dict with all the args and append it to a list self.chat_completion_call_hashes
ASSISTANT: To implement this change, we need to modify the `send_with_retries` method in the `Coder` class in the `aider/coders/base_coder.py` file. We will import the `hashlib` module to generate the SHA1 hash. We will also add a new attribute `chat_completion_call_hashes` to the `Coder` class to store the hashes.

Here are the changes:

```python
aider/coders/base_coder.py
<<<<<<< ORIGINAL
import json
import os
import sys
import traceback
from json.decoder import JSONDecodeError
from pathlib import Path
=======
import hashlib
import json
import os
import sys
import traceback
from json.decoder import JSONDecodeError
from pathlib import Path
>>>>>>> UPDATED
```

```python
aider/coders/base_coder.py
<<<<<<< ORIGINAL
class Coder:
    abs_fnames = None
    repo = None
    last_aider_commit_hash = None
    last_asked_for_commit_time = 0
    repo_map = None
    functions = None
    total_cost = 0.0
=======
class Coder:
    abs_fnames = None
    repo = None
    last_aider_commit_hash = None
    last_asked_for_commit_time = 0
    repo_map = None
    functions = None
    total_cost = 0.0
    chat_completion_call_hashes = []
>>>>>>> UPDATED
```

```python
aider/coders/base_coder.py
<<<<<<< ORIGINAL
    def send_with_retries(self, model, messages, functions):
        kwargs = dict(
            model=model,
            messages=messages,
            temperature=0,
            stream=self.stream,
        )
        if functions is not None:
            kwargs["functions"] = self.functions

        res = openai.ChatCompletion.create(**kwargs)
        return res
=======
    def send_with_retries(self, model, messages, functions):
        kwargs = dict(
            model=model,
            messages=messages,
            temperature=0,
            stream=self.stream,
        )
        if functions is not None:
            kwargs["functions"] = self.functions

        # Generate SHA1 hash of kwargs and append it to chat_completion_call_hashes
        hash_object = hashlib.sha1(json.dumps(kwargs, sort_keys=True).encode())
        self.chat_completion_call_hashes.append(hash_object.hexdigest())

        res = openai.ChatCompletion.create(**kwargs)
        return res
>>>>>>> UPDATED
```
2023-06-27 14:59:58 -07:00
Paul Gauthier
acc6be9e95 switched back to ``` as default fence 2023-06-26 16:42:29 -07:00
Paul Gauthier
23f96a28a0 use <source> fence by default 2023-06-26 16:34:46 -07:00
Paul Gauthier
58690da8b4 fences are obfuscated so aider can modify itself 2023-06-25 20:55:10 -07:00
Paul Gauthier
ef88cc6d55 refactor choose_fence 2023-06-25 20:34:32 -07:00
Paul Gauthier
96fda2aa9f abandon n-backticks, try some html fences 2023-06-25 20:23:36 -07:00
Paul Gauthier
9151cf03a1 quote with num_ticks 2023-06-25 19:58:17 -07:00
Paul Gauthier
a6d80e815e wip 2023-06-25 19:54:15 -07:00
Paul Gauthier
f625d52bec added self.fence_ticks 2023-06-25 17:03:20 -07:00
Paul Gauthier
59d99835b1 use a word for 3,4,5 backticks 2023-06-25 17:00:59 -07:00
Paul Gauthier
f005404ec0 Roughed in updated sys msg for whole format 2023-06-25 15:27:06 -07:00
Paul Gauthier
fe3f1c194d Added APIError 2023-06-24 20:04:49 -07:00
Paul Gauthier
8dcf819cb5 added ServiceUnavailableError for retries 2023-06-24 19:54:18 -07:00
Paul Gauthier
ac560c2877 Handle missing filenames by scanning for mentions in the text 2023-06-24 15:32:35 -07:00
Paul Gauthier
eaf02da46b stronger wholefile prompt about file listings; adopt allowed_to_edit in wholefile; tests 2023-06-24 14:45:43 -07:00
Paul Gauthier
467a9cb587 more verbose 2023-06-24 08:40:19 -07:00
Paul Gauthier
86457b8097 Limit retries on bad update replies 2023-06-24 08:38:52 -07:00
Paul Gauthier
a1909611d9 Raise ValueError if gpt makes an unknown function_call 2023-06-24 08:32:12 -07:00
Paul Gauthier
cee0f528ab better 2023-06-24 07:24:41 -07:00
Paul Gauthier
7d2fc1b2d9 fixed bug in show_send_output(), more robust error handling/reporting 2023-06-24 07:24:04 -07:00
Paul Gauthier
9e506cccb0 log with_message 2023-06-23 19:09:39 -07:00
Paul Gauthier
f23327ecf9 clearer repo-map initial message 2023-06-23 17:53:20 -07:00
Paul Gauthier
ae9ded4eaf No repo map if no repo 2023-06-23 16:10:48 -07:00
Paul Gauthier
50e715fb9a run pytest, cleanup 2023-06-23 15:40:14 -07:00
Paul Gauthier
200ff36848 Suppress Warning: no changes found in tracked files when no repo 2023-06-23 15:00:35 -07:00
Paul Gauthier
caf58cf313 fix support for --no-git 2023-06-23 14:49:30 -07:00
Paul Gauthier
1b41bbd0d9 Assume a default main_model 2023-06-23 14:21:25 -07:00
Paul Gauthier
b5b0c1cbc2 Added --no-git 2023-06-23 13:44:24 -07:00
Paul Gauthier
5c432592cd compute cost 2023-06-23 13:40:32 -07:00
Paul Gauthier
d2b9cb9e98 added --no-stream 2023-06-23 13:29:09 -07:00
Paul Gauthier
803423cc6a prettier /tokens output 2023-06-23 10:10:45 -07:00
Paul Gauthier
949a633e95 Handle complete context blowout more gracefully 2023-06-23 10:01:01 -07:00
Paul Gauthier
07ced21325 do not autocommit on dryrun 2023-06-22 19:22:53 -07:00
Paul Gauthier
15a0cdd6c9 aider: Added a --command,-c option to pass a string to coder.run().
# Context:
USER: add a --command,-c option which takes a string to pass to coder.run(with_message=args.command)
ASSISTANT: No changes are needed.
2023-06-22 19:02:22 -07:00
Paul Gauthier
cf3637dd5c roughed in run(with_message) 2023-06-22 18:55:23 -07:00
Paul Gauthier
22a5e493a7 update files on the happy path 2023-06-22 17:32:34 -07:00
Paul Gauthier
82813d4159 rename modify_incremental_response -> render_incremental_response 2023-06-22 17:29:47 -07:00
Paul Gauthier
63f1c17a76 noop 2023-06-22 12:03:12 -07:00
Paul Gauthier
1c264eef67 noop 2023-06-22 12:03:04 -07:00
Paul Gauthier
8517681f02 Log the explanation to the chat history file 2023-06-22 12:01:34 -07:00
Paul Gauthier
3702ea3aa2 cleanup 2023-06-22 11:57:23 -07:00
Paul Gauthier
5043397848 respect --dry-run 2023-06-22 11:38:39 -07:00
Paul Gauthier
08764215c3 refac 2023-06-22 11:29:59 -07:00
Paul Gauthier
985e362544 renamed func -> wholefile_func 2023-06-22 08:15:20 -07:00