Skip to content

Commit 7b20030

Browse files
committed
Convert json review to streaming and rewrite the casseets to fix an issue with CI
1 parent d8f09ca commit 7b20030

File tree

7 files changed

+732
-710
lines changed

7 files changed

+732
-710
lines changed

aicodebot/commands/review.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ def review(commit, output_format, response_token_size, files):
3939
lmm = LanguageModelManager()
4040

4141
if output_format == "json":
42-
chain = lmm.chain_factory(prompt=prompt, response_token_size=response_token_size)
42+
# We use streaming=True here so that VCR properly records the response instead of gzip
43+
# It doesn't make a difference
44+
chain = lmm.chain_factory(prompt=prompt, response_token_size=response_token_size, streaming=True)
4345
response = chain.run({"diff_context": diff_context, "languages": languages})
4446

4547
parsed_response = prompt.output_parser.parse(response)

test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hi

tests/cassettes/test_cli/test_alignment.yaml

Lines changed: 53 additions & 52 deletions
Large diffs are not rendered by default.

tests/cassettes/test_cli/test_commit.yaml

Lines changed: 99 additions & 185 deletions
Large diffs are not rendered by default.

tests/cassettes/test_cli/test_debug_failure.yaml

Lines changed: 319 additions & 293 deletions
Large diffs are not rendered by default.

tests/cassettes/test_cli/test_review.yaml

Lines changed: 228 additions & 150 deletions
Large diffs are not rendered by default.

tests/cassettes/test_cli/test_sidekick.yaml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,25 @@ interactions:
5151
[File] setup.py\n - [File] .gitignore\n - [File] CONTRIBUTING.md\n - [Directory]
5252
.github\n - [Directory] workflows\n - [File] linter.yml\n - [File]
5353
aicodebot.yml\n - [File] pypi_release.yml\n - [File] build.yml\n -
54-
[File] dependabot.yml\n - [Directory] build\n - [Directory] bdist.macosx-13-arm64\n -
55-
[Directory] lib\n - [Directory] aicodebot\n - [File] config.py\n -
56-
[File] __init__.py\n - [File] coder.py\n - [File] prompts.py\n -
57-
[File] cli.py\n - [File] learn.py\n - [File] helpers.py\n - [Directory]
58-
assets\n - [File] robot.png\n - [Directory] aicodebot\n - [File] patch.py\n -
59-
[File] config.py\n - [File] __init__.py\n - [File] coder.py\n - [File]
60-
prompts.py\n - [File] agents.py\n - [File] cli.py\n - [File] input.py\n -
61-
[File] lm.py\n - [Directory] commands\n - [File] configure.py\n -
62-
[File] alignment.py\n - [File] commit.py\n - [File] __init__.py\n -
63-
[File] review.py\n - [File] sidekick.py\n - [File] debug.py\n -
64-
[File] learn.py\n - [File] helpers.py\n - [File] output.py\nHere are the
65-
relevant files we are working with in this session, with line numbers:\n---
66-
START OF FILE: .gitignore unknown file, modified a month ago ---\n1: *.pyc\n2:
67-
*.swp\n3: .DS_Store\n4: .env\n5: .pytest_cache\n6: .vscode\n7: __pycache__\n8:
68-
aicodebot.egg-info/\n9: build/\n10: dist/\n11: \n--- END OF FILE: .gitignore
69-
---\n\n\n\nConversation with the human software engineer:\n\nSoftware Engineer:
70-
What is 3 + 2? Just give me the answer, nothing else. Use a number, not text\nAICodeBot:\n"}],
71-
"model": "gpt-4", "max_tokens": null, "stream": true, "n": 1, "temperature":
72-
0.05}'
54+
[File] dependabot.yml\n - [File] test.txt\n - [Directory] build\n - [Directory]
55+
bdist.macosx-13-arm64\n - [Directory] lib\n - [Directory] aicodebot\n -
56+
[File] config.py\n - [File] __init__.py\n - [File] coder.py\n -
57+
[File] prompts.py\n - [File] cli.py\n - [File] learn.py\n -
58+
[File] helpers.py\n - [Directory] assets\n - [File] robot.png\n - [Directory]
59+
aicodebot\n - [File] patch.py\n - [File] config.py\n - [File] __init__.py\n -
60+
[File] coder.py\n - [File] prompts.py\n - [File] agents.py\n - [File]
61+
cli.py\n - [File] input.py\n - [File] lm.py\n - [Directory] commands\n -
62+
[File] configure.py\n - [File] alignment.py\n - [File] commit.py\n -
63+
[File] __init__.py\n - [File] review.py\n - [File] sidekick.py\n -
64+
[File] debug.py\n - [File] learn.py\n - [File] helpers.py\n - [File]
65+
output.py\nHere are the relevant files we are working with in this session,
66+
with line numbers:\n--- START OF FILE: .gitignore unknown file, modified a month
67+
ago ---\n1: *.pyc\n2: *.swp\n3: .DS_Store\n4: .env\n5: .pytest_cache\n6: .vscode\n7:
68+
__pycache__\n8: aicodebot.egg-info/\n9: build/\n10: dist/\n11: \n--- END OF
69+
FILE: .gitignore ---\n\n\n\nConversation with the human software engineer:\n\nSoftware
70+
Engineer: What is 3 + 2? Just give me the answer, nothing else. Use a number,
71+
not text\nAICodeBot:\n"}], "model": "gpt-4", "max_tokens": null, "stream": true,
72+
"n": 1, "temperature": 0.05}'
7373
headers:
7474
Accept:
7575
- '*/*'
@@ -78,7 +78,7 @@ interactions:
7878
Connection:
7979
- keep-alive
8080
Content-Length:
81-
- '5669'
81+
- '5690'
8282
Content-Type:
8383
- application/json
8484
User-Agent:
@@ -92,13 +92,13 @@ interactions:
9292
uri: https://api.openai.com/v1/chat/completions
9393
response:
9494
body:
95-
string: 'data: {"id":"chatcmpl-7n9efFbzXgH52hhwn0Csyccsq6vXA","object":"chat.completion.chunk","created":1691949541,"model":"gpt-4-0613","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
95+
string: 'data: {"id":"chatcmpl-7nA2Brzq5M08d92KeCG4vzCj3mi4d","object":"chat.completion.chunk","created":1691950999,"model":"gpt-4-0613","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
9696
9797
98-
data: {"id":"chatcmpl-7n9efFbzXgH52hhwn0Csyccsq6vXA","object":"chat.completion.chunk","created":1691949541,"model":"gpt-4-0613","choices":[{"index":0,"delta":{"content":"5"},"finish_reason":null}]}
98+
data: {"id":"chatcmpl-7nA2Brzq5M08d92KeCG4vzCj3mi4d","object":"chat.completion.chunk","created":1691950999,"model":"gpt-4-0613","choices":[{"index":0,"delta":{"content":"5"},"finish_reason":null}]}
9999
100100
101-
data: {"id":"chatcmpl-7n9efFbzXgH52hhwn0Csyccsq6vXA","object":"chat.completion.chunk","created":1691949541,"model":"gpt-4-0613","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
101+
data: {"id":"chatcmpl-7nA2Brzq5M08d92KeCG4vzCj3mi4d","object":"chat.completion.chunk","created":1691950999,"model":"gpt-4-0613","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
102102
103103
104104
data: [DONE]
@@ -109,15 +109,15 @@ interactions:
109109
CF-Cache-Status:
110110
- DYNAMIC
111111
CF-RAY:
112-
- 7f62d97669c00420-MAD
112+
- 7f62fd13fea42160-MAD
113113
Cache-Control:
114114
- no-cache, must-revalidate
115115
Connection:
116116
- keep-alive
117117
Content-Type:
118118
- text/event-stream
119119
Date:
120-
- Sun, 13 Aug 2023 17:59:02 GMT
120+
- Sun, 13 Aug 2023 18:23:20 GMT
121121
Server:
122122
- cloudflare
123123
Transfer-Encoding:
@@ -127,7 +127,7 @@ interactions:
127127
alt-svc:
128128
- h3=":443"; ma=86400
129129
openai-organization:
130-
- user-5lnvpalii97slx3wvwmlvuvd
130+
- user-ajb4nhk52gcguoemw0t5dq45
131131
openai-processing-ms:
132132
- '12'
133133
openai-version:
@@ -141,13 +141,13 @@ interactions:
141141
x-ratelimit-remaining-requests:
142142
- '199'
143143
x-ratelimit-remaining-tokens:
144-
- '8644'
144+
- '8412'
145145
x-ratelimit-reset-requests:
146146
- 300ms
147147
x-ratelimit-reset-tokens:
148-
- 8.136s
148+
- 9.523s
149149
x-request-id:
150-
- 9a03cb1f1eddb46e8113ad7ef0213770
150+
- 606f4e4bb81b3296f67826598df593b4
151151
status:
152152
code: 200
153153
message: OK

0 commit comments

Comments
 (0)