mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-04-29 03:00:45 -04:00
Compare commits
451 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb9ad04362 | ||
|
|
4bb92bdd02 | ||
|
|
46c9c9d5c6 | ||
|
|
b004678345 | ||
|
|
93b9fd028d | ||
|
|
23493a2e36 | ||
|
|
8bfa61f3e4 | ||
|
|
fa6c12473e | ||
|
|
b5e4cddce3 | ||
|
|
ac27ded81f | ||
|
|
c555fb6840 | ||
|
|
452da5663d | ||
|
|
b60890c064 | ||
|
|
1761b88af5 | ||
|
|
ff6ddc831f | ||
|
|
d6642c26be | ||
|
|
3bff8cf88a | ||
|
|
bf39af895e | ||
|
|
de74c7a0a1 | ||
|
|
cf910dfa9d | ||
|
|
692fe21d60 | ||
|
|
9d41314d1a | ||
|
|
f70c5afb6e | ||
|
|
2250947919 | ||
|
|
5a5713009f | ||
|
|
728131ff1d | ||
|
|
135da0ea2b | ||
|
|
f689d5dcc3 | ||
|
|
f80ecec772 | ||
|
|
cf3d2298da | ||
|
|
b04c69858c | ||
|
|
5c438432d6 | ||
|
|
70b2238f5e | ||
|
|
f991069b00 | ||
|
|
a66ede2ee6 | ||
|
|
d97e92e714 | ||
|
|
9f12c77bac | ||
|
|
2c02ab9586 | ||
|
|
c897791024 | ||
|
|
01ce1e35b5 | ||
|
|
88d53e781f | ||
|
|
257698e89b | ||
|
|
7111e8ee14 | ||
|
|
2c982582d7 | ||
|
|
0b0952547d | ||
|
|
a2ec1ded26 | ||
|
|
dc45b14720 | ||
|
|
4b6a2ff3c4 | ||
|
|
f45a2ff04e | ||
|
|
f5a4fb80a3 | ||
|
|
59d05f3934 | ||
|
|
29483c0620 | ||
|
|
42abc727d7 | ||
|
|
1fd2e511f8 | ||
|
|
e3e437fcc2 | ||
|
|
8f76587e5c | ||
|
|
149dac8e5b | ||
|
|
ec2535c57c | ||
|
|
471703bea6 | ||
|
|
4b4fa1c390 | ||
|
|
3c0975d71d | ||
|
|
17b2eb58e4 | ||
|
|
7cd3431beb | ||
|
|
cf531518a5 | ||
|
|
8ea66a82c8 | ||
|
|
59042bb0a9 | ||
|
|
b501083425 | ||
|
|
653a3c0f11 | ||
|
|
b834b354e5 | ||
|
|
214f728d32 | ||
|
|
9d7adefe0c | ||
|
|
9b1f59a56e | ||
|
|
959d21c48f | ||
|
|
46edb4b15b | ||
|
|
91d46ccb8c | ||
|
|
64be2cb466 | ||
|
|
b2b6d2ac1e | ||
|
|
f249254ba4 | ||
|
|
7e68de746d | ||
|
|
e45ddeb2a2 | ||
|
|
2b7c4e5571 | ||
|
|
ebbc0e6803 | ||
|
|
96b5cb78fd | ||
|
|
ced7499f8d | ||
|
|
7cbf2d9f16 | ||
|
|
e45d46c993 | ||
|
|
43c3e904b7 | ||
|
|
ae2fbbf8af | ||
|
|
29ed1d744d | ||
|
|
217eed9dab | ||
|
|
6bef270526 | ||
|
|
1b54800a29 | ||
|
|
e793ca2261 | ||
|
|
5f61885e44 | ||
|
|
1d4f422638 | ||
|
|
456690818c | ||
|
|
de11b49a38 | ||
|
|
50f07aea44 | ||
|
|
008f288bb0 | ||
|
|
7938b454e4 | ||
|
|
45e40d68f6 | ||
|
|
c68478f470 | ||
|
|
23e2d01cf5 | ||
|
|
de47d8eecc | ||
|
|
4049c69590 | ||
|
|
792949aeb2 | ||
|
|
864ee465fe | ||
|
|
fbced43ff3 | ||
|
|
46b853e1b4 | ||
|
|
9198ea3fb1 | ||
|
|
f0bc231f3e | ||
|
|
8cfb1be5a3 | ||
|
|
f2e92b2db7 | ||
|
|
e2636f9ece | ||
|
|
351127db55 | ||
|
|
9fbfa0650e | ||
|
|
e6ebb4307e | ||
|
|
9b9b754965 | ||
|
|
648597c4f7 | ||
|
|
ff701f99e6 | ||
|
|
2df1d67007 | ||
|
|
c6aa50779d | ||
|
|
ba0f57c279 | ||
|
|
d37b2973b2 | ||
|
|
9dc2d2c80f | ||
|
|
e35c1ff74a | ||
|
|
34c765688b | ||
|
|
adf1a0d556 | ||
|
|
85a817304e | ||
|
|
d0384cafdd | ||
|
|
3a3694ca17 | ||
|
|
c8e5848add | ||
|
|
0973e31f00 | ||
|
|
82f256be96 | ||
|
|
d6570bd572 | ||
|
|
d22ff73905 | ||
|
|
9b0ff117ab | ||
|
|
f6dc89b41a | ||
|
|
a47713ecb0 | ||
|
|
99284da476 | ||
|
|
9ccc64fa7e | ||
|
|
eda582335a | ||
|
|
ed45a9e7b1 | ||
|
|
1bdfbedccc | ||
|
|
274464101f | ||
|
|
a081935fd8 | ||
|
|
038e8f8caa | ||
|
|
143f38d25a | ||
|
|
82f4860470 | ||
|
|
298956c78a | ||
|
|
0d3b3ffbf8 | ||
|
|
e6cdf18d3b | ||
|
|
0b8d357bef | ||
|
|
1b10e2b9d5 | ||
|
|
688bd2a8fc | ||
|
|
6853cbb4f6 | ||
|
|
14b4213acf | ||
|
|
d145dd78a3 | ||
|
|
c8270013ad | ||
|
|
dd1bd9caf3 | ||
|
|
c77480bb55 | ||
|
|
7291c320fc | ||
|
|
c2f557edde | ||
|
|
869997b941 | ||
|
|
d894347f9b | ||
|
|
90a68ca816 | ||
|
|
82ed0a07cb | ||
|
|
81226e63e9 | ||
|
|
8b01d16926 | ||
|
|
89a3752c8c | ||
|
|
b60a696296 | ||
|
|
018f45893b | ||
|
|
5123e1d8d1 | ||
|
|
94d68ca0b8 | ||
|
|
4dc01a7369 | ||
|
|
ffd3c7144c | ||
|
|
0d0e6db1e3 | ||
|
|
4d0c4f37d6 | ||
|
|
f293b33856 | ||
|
|
50efea5960 | ||
|
|
52ab4b4f18 | ||
|
|
8ff9332358 | ||
|
|
c052ea30cc | ||
|
|
4489c40106 | ||
|
|
cc8204e5c1 | ||
|
|
0689eef844 | ||
|
|
bfa1de4a6b | ||
|
|
5e6fb6131f | ||
|
|
41ddba84bd | ||
|
|
6a0ffc5c61 | ||
|
|
6246cb8e67 | ||
|
|
c224a6f3f6 | ||
|
|
82ea8b3556 | ||
|
|
c88b9f8f6d | ||
|
|
e83d1fe8b8 | ||
|
|
1cbbb10c56 | ||
|
|
51a71aaec9 | ||
|
|
58191e0af0 | ||
|
|
7fda69ff10 | ||
|
|
ea3c58dc8c | ||
|
|
1975689cd4 | ||
|
|
00542432bd | ||
|
|
8dae1f9307 | ||
|
|
e24c52d060 | ||
|
|
2d9bb56763 | ||
|
|
874b4c9075 | ||
|
|
15e0c524f4 | ||
|
|
4b1cc56682 | ||
|
|
b4f63ae076 | ||
|
|
e45b311c35 | ||
|
|
75f3181c08 | ||
|
|
79a3e81708 | ||
|
|
e8cb6803df | ||
|
|
7d31057904 | ||
|
|
b88898235e | ||
|
|
a9302b15df | ||
|
|
52c7019cb3 | ||
|
|
b05aaffd7e | ||
|
|
a918198f43 | ||
|
|
839c51ed3c | ||
|
|
105662a40c | ||
|
|
7766a3283e | ||
|
|
af9385322b | ||
|
|
917d96e06f | ||
|
|
cc9cb1bac0 | ||
|
|
fdef348365 | ||
|
|
1827579f4b | ||
|
|
c2969d422a | ||
|
|
badfb054f1 | ||
|
|
9919d8e448 | ||
|
|
58b06cced7 | ||
|
|
5835680292 | ||
|
|
877d9ae794 | ||
|
|
6099f72ae3 | ||
|
|
418cda23c5 | ||
|
|
3fb8206b72 | ||
|
|
7394c91c0e | ||
|
|
acee3e9d04 | ||
|
|
8fef94cac4 | ||
|
|
0e8d1e5fb8 | ||
|
|
10b7a1e9c5 | ||
|
|
5abe014218 | ||
|
|
163ee3abf6 | ||
|
|
ee86d8d25e | ||
|
|
cd91d45b44 | ||
|
|
94d24b71d7 | ||
|
|
fcbf1f8242 | ||
|
|
7ff746250e | ||
|
|
2b1d2104d9 | ||
|
|
406bb13caf | ||
|
|
c1009069ab | ||
|
|
7d413c288e | ||
|
|
781a6250f8 | ||
|
|
ffda754256 | ||
|
|
7ca7f803e1 | ||
|
|
dab9a60e00 | ||
|
|
c99b94dbe9 | ||
|
|
7e78fde48f | ||
|
|
e71b8d1464 | ||
|
|
4b35497b54 | ||
|
|
6042b226a0 | ||
|
|
1117dfebeb | ||
|
|
8bce806dce | ||
|
|
39d90c0b2a | ||
|
|
6de584d77d | ||
|
|
4d1ffa1aaf | ||
|
|
e1caf1db33 | ||
|
|
868b7460d4 | ||
|
|
63a3285b23 | ||
|
|
0c1d6f8b4e | ||
|
|
c455a09e43 | ||
|
|
cab7a288ca | ||
|
|
9af2a08eda | ||
|
|
6bf1b56f06 | ||
|
|
6312c21f8e | ||
|
|
57b56c0536 | ||
|
|
4c5e5a0b5a | ||
|
|
fa86e32231 | ||
|
|
45d7a53b91 | ||
|
|
7ad6ab1548 | ||
|
|
ec43e67ae0 | ||
|
|
c743320201 | ||
|
|
0845d475b8 | ||
|
|
5972498e23 | ||
|
|
4567dd60e4 | ||
|
|
13adfe5625 | ||
|
|
900743ee7a | ||
|
|
1076789c23 | ||
|
|
3f158d09e2 | ||
|
|
7e44c8f348 | ||
|
|
6879acdfe7 | ||
|
|
64c2a783d4 | ||
|
|
1ffaed48c4 | ||
|
|
01fa52d062 | ||
|
|
f3ba2f02d5 | ||
|
|
2df629f912 | ||
|
|
41564c2eac | ||
|
|
ff9f34bea2 | ||
|
|
bfa00932cc | ||
|
|
feabc97aba | ||
|
|
6dd2491944 | ||
|
|
0b742826ea | ||
|
|
eac05d71fa | ||
|
|
0c2882d552 | ||
|
|
35fc2177d0 | ||
|
|
8e22cd5f5e | ||
|
|
cac8159fd8 | ||
|
|
ff0a35451d | ||
|
|
373a700599 | ||
|
|
9ec5e4f3e2 | ||
|
|
833bb50fb0 | ||
|
|
26fc3c886a | ||
|
|
b569ba710d | ||
|
|
0a0f78f2fb | ||
|
|
c4ad3b8f47 | ||
|
|
dda435e5e8 | ||
|
|
8ee5cbc786 | ||
|
|
64fe3d4cba | ||
|
|
718e435bb8 | ||
|
|
13bd154b50 | ||
|
|
a67b79d9ea | ||
|
|
e1c6af865b | ||
|
|
d0bdae232f | ||
|
|
92a1eaa866 | ||
|
|
3ffcc7157d | ||
|
|
89cae8d6b8 | ||
|
|
3f869ae853 | ||
|
|
8f48d10442 | ||
|
|
80fe13f4be | ||
|
|
b2307db010 | ||
|
|
3d33bc6813 | ||
|
|
c2fa99b4a1 | ||
|
|
5e8ef23a53 | ||
|
|
1f379bebc2 | ||
|
|
1f72f4c401 | ||
|
|
07fa57ff69 | ||
|
|
9b9dae9463 | ||
|
|
1bc3ca20da | ||
|
|
e4d78153fe | ||
|
|
e001c6a9b8 | ||
|
|
f8607e0ccf | ||
|
|
f91fb3a839 | ||
|
|
1075f5abad | ||
|
|
75ab295aec | ||
|
|
5ae647f5c2 | ||
|
|
009f6f9ebc | ||
|
|
f4c917345f | ||
|
|
3142764104 | ||
|
|
d2509a19c8 | ||
|
|
798921cec3 | ||
|
|
823298e0d0 | ||
|
|
cb44c116cd | ||
|
|
85c0eae31d | ||
|
|
b5e6ba8239 | ||
|
|
2d824947f8 | ||
|
|
6f235937cf | ||
|
|
5e61a10627 | ||
|
|
b5b81d06a1 | ||
|
|
426e429b18 | ||
|
|
ac6ef8e59d | ||
|
|
c82666fea3 | ||
|
|
fd29b8faa8 | ||
|
|
0d5dc1faeb | ||
|
|
c272e2e851 | ||
|
|
1748d47437 | ||
|
|
bb4ea1e6cb | ||
|
|
dd1095cf6b | ||
|
|
1cc70be616 | ||
|
|
48a2f24bf4 | ||
|
|
b2dc177562 | ||
|
|
ce0034eeaa | ||
|
|
d42e02f286 | ||
|
|
0f26ff214a | ||
|
|
52719b5ded | ||
|
|
e04bde851e | ||
|
|
7f8c324d3a | ||
|
|
0c92144220 | ||
|
|
563bc41fd3 | ||
|
|
0bd5ab72ed | ||
|
|
4c774544ce | ||
|
|
d1eaf486bd | ||
|
|
7fcd14a055 | ||
|
|
90ec0095df | ||
|
|
a25fb4d21b | ||
|
|
11d7efb0e8 | ||
|
|
17e7a45c3c | ||
|
|
e14297fde9 | ||
|
|
35c4c9cb34 | ||
|
|
9893c06b2e | ||
|
|
c6951eb6c1 | ||
|
|
b3bdc44292 | ||
|
|
11a2d1682d | ||
|
|
e4145aef66 | ||
|
|
a6ba6c5277 | ||
|
|
9605106e72 | ||
|
|
a5f5bc30b4 | ||
|
|
f4cb192ebe | ||
|
|
c633d41091 | ||
|
|
e2512b43b6 | ||
|
|
090046b2e6 | ||
|
|
f29a2704f2 | ||
|
|
a3062ba4d0 | ||
|
|
f1760f3a67 | ||
|
|
f7491bd2fa | ||
|
|
7fc57650f3 | ||
|
|
91ddd93756 | ||
|
|
003b599dd0 | ||
|
|
41344f0dfe | ||
|
|
745ae42a72 | ||
|
|
a400e94971 | ||
|
|
e925cefeef | ||
|
|
221a4e83f1 | ||
|
|
bd00f0f049 | ||
|
|
fab8c9003b | ||
|
|
e0ad289483 | ||
|
|
a9a2f10170 | ||
|
|
c062468dcf | ||
|
|
a97d0767e9 | ||
|
|
1bdf8752e6 | ||
|
|
68d9ad61cf | ||
|
|
b5a17efc45 | ||
|
|
a8c6fd0d42 | ||
|
|
e8307608c2 | ||
|
|
06a6ffcb09 | ||
|
|
82d4d25b09 | ||
|
|
903381f16e | ||
|
|
c3c2b2d7b6 | ||
|
|
5e42f140cb | ||
|
|
705758ac36 | ||
|
|
f1fc2c3fea | ||
|
|
7e64df8332 | ||
|
|
dc94914ad7 | ||
|
|
b431fce938 | ||
|
|
6aba337416 | ||
|
|
4455260290 | ||
|
|
45ce09d70e | ||
|
|
001cc33664 | ||
|
|
1df9649c7e | ||
|
|
19788cbad8 | ||
|
|
dea9b5c258 | ||
|
|
07423c9277 | ||
|
|
bb757223a2 | ||
|
|
ac0c6efc82 | ||
|
|
1ce4d383d3 | ||
|
|
b0b19e6c25 | ||
|
|
08137d1968 | ||
|
|
beabcce16d | ||
|
|
1fa09e0414 | ||
|
|
48151bdbb0 | ||
|
|
99c6333e1a | ||
|
|
42d3dd8a2e |
6
.github/.codecov.yml
vendored
6
.github/.codecov.yml
vendored
@@ -1,6 +1,9 @@
|
||||
codecov:
|
||||
notify:
|
||||
wait_for_ci: true
|
||||
# our project is large, so 6 builds are typically uploaded. this waits till 5/6
|
||||
# See https://docs.codecov.com/docs/notifications#section-preventing-notifications-until-after-n-builds
|
||||
after_n_builds: 5
|
||||
|
||||
coverage:
|
||||
status:
|
||||
@@ -14,6 +17,3 @@ coverage:
|
||||
comment: false
|
||||
github_checks:
|
||||
annotations: false
|
||||
|
||||
ignore:
|
||||
- "agenthub/SWE_agent/**" # SWE agent is deprecated
|
||||
|
||||
4
.github/ISSUE_TEMPLATE/bug_template.yml
vendored
4
.github/ISSUE_TEMPLATE/bug_template.yml
vendored
@@ -12,7 +12,7 @@ body:
|
||||
label: Is there an existing issue for the same bug?
|
||||
description: Please check if an issue already exists for the bug you encountered.
|
||||
options:
|
||||
- label: I have checked the troubleshooting document at https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting
|
||||
- label: I have checked the troubleshooting document at https://docs.all-hands.dev/modules/usage/troubleshooting
|
||||
required: true
|
||||
- label: I have checked the existing issues.
|
||||
required: true
|
||||
@@ -72,4 +72,4 @@ body:
|
||||
id: additional-context
|
||||
attributes:
|
||||
label: Logs, Errors, Screenshots, and Additional Context
|
||||
description: LLM logs will be stored in the `logs/llm/default` folder. Please add any additional context about the problem here.
|
||||
description: If you want to share the chat history you can click the thumbs-down (👎) button above the input field and you will get a shareable link (you can also click thumbs up when things are going well of course!). LLM logs will be stored in the `logs/llm/default` folder. Please add any additional context about the problem here.
|
||||
|
||||
16
.github/ISSUE_TEMPLATE/question.md
vendored
16
.github/ISSUE_TEMPLATE/question.md
vendored
@@ -1,16 +0,0 @@
|
||||
---
|
||||
name: Question
|
||||
about: Use this template to ask a question regarding the project.
|
||||
title: ''
|
||||
labels: question
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Describe your question
|
||||
|
||||
<!--A clear and concise description of what you want to know.-->
|
||||
|
||||
## Additional context
|
||||
|
||||
<!--Add any other context about the question here, like what you've tried so far.-->
|
||||
7
.github/dependabot.yml
vendored
7
.github/dependabot.yml
vendored
@@ -9,7 +9,14 @@ updates:
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "daily"
|
||||
open-pull-requests-limit: 20
|
||||
- package-ecosystem: "npm" # See documentation for possible values
|
||||
directory: "/frontend" # Location of package manifests
|
||||
schedule:
|
||||
interval: "daily"
|
||||
open-pull-requests-limit: 20
|
||||
- package-ecosystem: "npm" # See documentation for possible values
|
||||
directory: "/docs" # Location of package manifests
|
||||
schedule:
|
||||
interval: "daily"
|
||||
open-pull-requests-limit: 20
|
||||
|
||||
8
.github/pull_request_template.md
vendored
Normal file
8
.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
**What is the problem that this fixes or functionality that this introduces? Does it fix any open issues?**
|
||||
|
||||
---
|
||||
|
||||
**Give a summary of what the PR does, explaining any non-trivial design decisions**
|
||||
|
||||
---
|
||||
**Other references**
|
||||
13
.github/workflows/dummy-agent-test.yml
vendored
13
.github/workflows/dummy-agent-test.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Run e2e test with dummy agent
|
||||
name: Run E2E test with dummy agent
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
@@ -30,4 +30,13 @@ jobs:
|
||||
wget https://huggingface.co/BAAI/bge-small-en-v1.5/raw/main/1_Pooling/config.json -P /tmp/llama_index/models--BAAI--bge-small-en-v1.5/snapshots/5c38ec7c405ec4b44b94cc5a9bb96e735b38267a/1_Pooling/
|
||||
- name: Run tests
|
||||
run: |
|
||||
poetry run python opendevin/core/main.py -t "do a flip" -m ollama/not-a-model -d ./workspace/ -c DummyAgent
|
||||
set -e
|
||||
poetry run python opendevin/core/main.py -t "do a flip" -d ./workspace/ -c DummyAgent
|
||||
- name: Check exit code
|
||||
run: |
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Test failed"
|
||||
exit 1
|
||||
else
|
||||
echo "Test passed"
|
||||
fi
|
||||
|
||||
219
.github/workflows/ghcr.yml
vendored
219
.github/workflows/ghcr.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Publish Docker Image
|
||||
name: Build Publish and Test Docker Image
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
@@ -7,7 +7,7 @@ concurrency:
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- main
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
@@ -19,19 +19,23 @@ on:
|
||||
default: ''
|
||||
|
||||
jobs:
|
||||
ghcr_build_and_push:
|
||||
ghcr_build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
tags: ${{ steps.capture-tags.outputs.tags }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
image: ["app", "sandbox"]
|
||||
image: ["sandbox", "opendevin"]
|
||||
platform: ["amd64", "arm64"]
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Free Disk Space (Ubuntu)
|
||||
@@ -40,7 +44,6 @@ jobs:
|
||||
# this might remove tools that are actually needed,
|
||||
# if set to "true" but frees about 6 GB
|
||||
tool-cache: true
|
||||
|
||||
# all of these default to true, but feel free to set to
|
||||
# "false" if necessary for your workflow
|
||||
android: true
|
||||
@@ -57,26 +60,204 @@ jobs:
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to ghcr
|
||||
uses: docker/login-action@v1
|
||||
- name: Build and export image
|
||||
id: build
|
||||
run: ./containers/build.sh ${{ matrix.image }} ${{ github.repository_owner }} ${{ matrix.platform }}
|
||||
|
||||
- name: Capture tags
|
||||
id: capture-tags
|
||||
run: |
|
||||
tags=$(cat tags.txt)
|
||||
echo "tags=$tags"
|
||||
echo "tags=$tags" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Upload Docker image as artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.image }}-docker-image-${{ matrix.platform }}
|
||||
path: /tmp/${{ matrix.image }}_image_${{ matrix.platform }}.tar
|
||||
|
||||
test-for-sandbox:
|
||||
name: Test for Sandbox
|
||||
runs-on: ubuntu-latest
|
||||
needs: ghcr_build
|
||||
env:
|
||||
PERSIST_SANDBOX: "false"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install poetry via pipx
|
||||
run: pipx install poetry
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
cache: "poetry"
|
||||
|
||||
- name: Install Python dependencies using Poetry
|
||||
run: make install-python-dependencies
|
||||
|
||||
- name: Download sandbox Docker image
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: sandbox-docker-image-amd64
|
||||
path: /tmp/
|
||||
|
||||
- name: Load sandbox image and run sandbox tests
|
||||
run: |
|
||||
# Load the Docker image and capture the output
|
||||
output=$(docker load -i /tmp/sandbox_image_amd64.tar)
|
||||
|
||||
# Extract the first image name from the output
|
||||
image_name=$(echo "$output" | grep -oP 'Loaded image: \K.*' | head -n 1)
|
||||
|
||||
# Print the full name of the image
|
||||
echo "Loaded Docker image: $image_name"
|
||||
|
||||
SANDBOX_CONTAINER_IMAGE=$image_name TEST_IN_CI=true poetry run pytest --cov=agenthub --cov=opendevin --cov-report=xml -s ./tests/unit/test_sandbox.py
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
integration-tests-on-linux:
|
||||
name: Integration Tests on Linux
|
||||
runs-on: ubuntu-latest
|
||||
needs: ghcr_build
|
||||
env:
|
||||
PERSIST_SANDBOX: "false"
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.11"]
|
||||
sandbox: ["ssh", "local"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install poetry via pipx
|
||||
run: pipx install poetry
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: 'poetry'
|
||||
|
||||
- name: Install Python dependencies using Poetry
|
||||
run: make install-python-dependencies
|
||||
|
||||
- name: Download sandbox Docker image
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: sandbox-docker-image-amd64
|
||||
path: /tmp/
|
||||
|
||||
- name: Load sandbox image and run integration tests
|
||||
env:
|
||||
SANDBOX_BOX_TYPE: ${{ matrix.sandbox }}
|
||||
run: |
|
||||
# Load the Docker image and capture the output
|
||||
output=$(docker load -i /tmp/sandbox_image_amd64.tar)
|
||||
|
||||
# Extract the first image name from the output
|
||||
image_name=$(echo "$output" | grep -oP 'Loaded image: \K.*' | head -n 1)
|
||||
|
||||
# Print the full name of the image
|
||||
echo "Loaded Docker image: $image_name"
|
||||
|
||||
SANDBOX_CONTAINER_IMAGE=$image_name TEST_IN_CI=true TEST_ONLY=true ./tests/integration/regenerate.sh
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
ghcr_push:
|
||||
runs-on: ubuntu-latest
|
||||
# don't push if integration tests or sandbox tests fail
|
||||
needs: [ghcr_build, integration-tests-on-linux, test-for-sandbox]
|
||||
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
|
||||
|
||||
env:
|
||||
tags: ${{ needs.ghcr_build.outputs.tags }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
image: ["sandbox", "opendevin"]
|
||||
platform: ["amd64", "arm64"]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push ${{ matrix.image }}
|
||||
if: "!github.event.pull_request.head.repo.fork"
|
||||
run: |
|
||||
./containers/build.sh ${{ matrix.image }} ${{ github.repository_owner }} --push
|
||||
- name: Download Docker images
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.image }}-docker-image-${{ matrix.platform }}
|
||||
path: /tmp/${{ matrix.platform }}
|
||||
|
||||
- name: Build ${{ matrix.image }}
|
||||
if: "github.event.pull_request.head.repo.fork"
|
||||
- name: Load images and push to registry
|
||||
run: |
|
||||
./containers/build.sh ${{ matrix.image }} ${{ github.repository_owner }}
|
||||
mv /tmp/${{ matrix.platform }}/${{ matrix.image }}_image_${{ matrix.platform }}.tar .
|
||||
loaded_image=$(docker load -i ${{ matrix.image }}_image_${{ matrix.platform }}.tar | grep "Loaded image:" | head -n 1 | awk '{print $3}')
|
||||
echo "loaded image = $loaded_image"
|
||||
tags=$(echo ${tags} | tr ' ' '\n')
|
||||
image_name=$(echo "ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}" | tr '[:upper:]' '[:lower:]')
|
||||
echo "image name = $image_name"
|
||||
for tag in $tags; do
|
||||
echo "tag = $tag"
|
||||
docker tag $loaded_image $image_name:${tag}_${{ matrix.platform }}
|
||||
docker push $image_name:${tag}_${{ matrix.platform }}
|
||||
done
|
||||
|
||||
docker_build_success:
|
||||
name: Docker Build Success
|
||||
create_manifest:
|
||||
runs-on: ubuntu-latest
|
||||
needs: ghcr_build_and_push
|
||||
needs: [ghcr_build, ghcr_push]
|
||||
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
|
||||
|
||||
env:
|
||||
tags: ${{ needs.ghcr_build.outputs.tags }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
image: ["sandbox", "opendevin"]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- run: echo Done!
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create and push multi-platform manifest
|
||||
run: |
|
||||
image_name=$(echo "ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}" | tr '[:upper:]' '[:lower:]')
|
||||
echo "image name = $image_name"
|
||||
tags=$(echo ${tags} | tr ' ' '\n')
|
||||
for tag in $tags; do
|
||||
echo 'tag = $tag'
|
||||
docker buildx imagetools create --tag $image_name:$tag \
|
||||
$image_name:${tag}_amd64 \
|
||||
$image_name:${tag}_arm64
|
||||
done
|
||||
|
||||
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@@ -47,4 +47,4 @@ jobs:
|
||||
- name: Install pre-commit
|
||||
run: pip install pre-commit==3.7.0
|
||||
- name: Run pre-commit hooks
|
||||
run: pre-commit run --files opendevin/**/* agenthub/**/* evaluation/**/* --show-diff-on-failure --config ./dev_config/python/.pre-commit-config.yaml
|
||||
run: pre-commit run --files opendevin/**/* agenthub/**/* evaluation/**/* tests/**/* --show-diff-on-failure --config ./dev_config/python/.pre-commit-config.yaml
|
||||
|
||||
26
.github/workflows/review-pr.yml
vendored
26
.github/workflows/review-pr.yml
vendored
@@ -12,15 +12,15 @@ jobs:
|
||||
dogfood:
|
||||
if: contains(github.event.pull_request.labels.*.name, 'review-this')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ghcr.io/opendevin/opendevin
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: install git, github cli
|
||||
run: |
|
||||
apt-get install -y git gh
|
||||
sudo apt-get install -y git gh
|
||||
git config --global --add safe.directory $PWD
|
||||
|
||||
- name: Checkout Repository
|
||||
@@ -34,7 +34,9 @@ jobs:
|
||||
|
||||
- name: Write Task File
|
||||
run: |
|
||||
echo "Your coworker wants to apply a pull request to this project. Read and review ${{ github.event.pull_request.number }}.diff file. Create a review-${{ github.event.pull_request.number }}.txt and write your concise comments and suggestions there." > task.txt
|
||||
echo "Your coworker wants to apply a pull request to this project." > task.txt
|
||||
echo "Read and review ${{ github.event.pull_request.number }}.diff file. Create a review-${{ github.event.pull_request.number }}.txt and write your concise comments and suggestions there." >> task.txt
|
||||
echo "Do not ask me for confirmation at any point." >> task.txt
|
||||
echo "" >> task.txt
|
||||
echo "Title" >> task.txt
|
||||
echo "${{ github.event.pull_request.title }}" >> task.txt
|
||||
@@ -53,15 +55,17 @@ jobs:
|
||||
|
||||
- name: Run OpenDevin
|
||||
env:
|
||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
SANDBOX_TYPE: exec
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_MODEL: ${{ vars.LLM_MODEL }}
|
||||
SANDBOX_BOX_TYPE: ssh
|
||||
run: |
|
||||
# Append path to launch poetry
|
||||
export PATH="/github/home/.local/bin:$PATH"
|
||||
# Append path to correctly import package, note: must set pwd at first
|
||||
export PYTHONPATH=$(pwd):$PYTHONPATH
|
||||
WORKSPACE_MOUNT_PATH=$GITHUB_WORKSPACE poetry run python ./opendevin/core/main.py -i 50 -f task.txt -d $GITHUB_WORKSPACE
|
||||
export WORKSPACE_MOUNT_PATH=$GITHUB_WORKSPACE
|
||||
export WORKSPACE_BASE=$GITHUB_WORKSPACE
|
||||
echo -e "/exit\n" | poetry run python opendevin/core/main.py -i 50 -f task.txt
|
||||
rm task.txt
|
||||
|
||||
- name: Check if review file is non-empty
|
||||
|
||||
104
.github/workflows/run-integration-tests.yml
vendored
104
.github/workflows/run-integration-tests.yml
vendored
@@ -1,104 +0,0 @@
|
||||
name: Run Integration Tests
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- 'frontend/**'
|
||||
- 'docs/**'
|
||||
- 'evaluation/**'
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
PERSIST_SANDBOX : "false"
|
||||
|
||||
jobs:
|
||||
integration-tests-on-linux:
|
||||
name: Integration Tests on Linux
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.11"]
|
||||
sandbox: ["ssh", "exec", "local"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install poetry via pipx
|
||||
run: pipx install poetry
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: 'poetry'
|
||||
|
||||
- name: Install Python dependencies using Poetry
|
||||
run: poetry install
|
||||
|
||||
- name: Build Environment
|
||||
run: make build
|
||||
|
||||
- name: Run Integration Tests
|
||||
env:
|
||||
SANDBOX_TYPE: ${{ matrix.sandbox }}
|
||||
run: |
|
||||
TEST_IN_CI=true TEST_ONLY=true ./tests/integration/regenerate.sh
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
integration-tests-on-mac:
|
||||
name: Integration Tests on MacOS
|
||||
runs-on: macos-13
|
||||
if: contains(github.event.pull_request.title, 'mac') || contains(github.event.pull_request.title, 'Mac')
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.11"]
|
||||
sandbox: ["ssh"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install poetry via pipx
|
||||
run: pipx install poetry
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: 'poetry'
|
||||
|
||||
- name: Install Python dependencies using Poetry
|
||||
run: poetry install
|
||||
|
||||
- name: Install & Start Docker
|
||||
run: |
|
||||
brew install colima docker
|
||||
colima start
|
||||
|
||||
# For testcontainers to find the Colima socket
|
||||
# https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
|
||||
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
|
||||
|
||||
- name: Build Environment
|
||||
run: make build
|
||||
|
||||
- name: Run Integration Tests
|
||||
env:
|
||||
SANDBOX_TYPE: ${{ matrix.sandbox }}
|
||||
run: |
|
||||
TEST_IN_CI=true TEST_ONLY=true ./tests/integration/regenerate.sh
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
64
.github/workflows/run-runtime-tests.yml
vendored
Normal file
64
.github/workflows/run-runtime-tests.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
name: Run Runtime Tests
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- 'frontend/**'
|
||||
- 'docs/**'
|
||||
- 'evaluation/**'
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
PERSIST_SANDBOX : "false"
|
||||
|
||||
jobs:
|
||||
test-for-runtime:
|
||||
name: Test for Runtime
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
PERSIST_SANDBOX: "false"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Free Disk Space (Ubuntu)
|
||||
uses: jlumbroso/free-disk-space@main
|
||||
with:
|
||||
# this might remove tools that are actually needed,
|
||||
# when set to "true" but frees about 6 GB
|
||||
tool-cache: true
|
||||
|
||||
# all of these default to true, but feel free to set to
|
||||
# "false" if necessary for your workflow
|
||||
android: true
|
||||
dotnet: true
|
||||
haskell: true
|
||||
large-packages: true
|
||||
swap-storage: true
|
||||
|
||||
- name: Install poetry via pipx
|
||||
run: pipx install poetry
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
cache: "poetry"
|
||||
|
||||
- name: Install Python dependencies using Poetry
|
||||
run: make install-python-dependencies
|
||||
|
||||
- name: Run runtime tests
|
||||
run: |
|
||||
TEST_IN_CI=true poetry run pytest --cov=agenthub --cov=opendevin --cov-report=xml -s ./tests/unit/test_runtime.py
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
105
.github/workflows/run-unit-tests.yml
vendored
105
.github/workflows/run-unit-tests.yml
vendored
@@ -19,11 +19,40 @@ env:
|
||||
PERSIST_SANDBOX : "false"
|
||||
|
||||
jobs:
|
||||
fe-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [20]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: ./frontend
|
||||
run: npm ci
|
||||
|
||||
- name: Run tests and collect coverage
|
||||
working-directory: ./frontend
|
||||
run: npm run test:coverage
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
test-on-macos:
|
||||
name: Test on macOS
|
||||
runs-on: macos-13
|
||||
runs-on: macos-12
|
||||
env:
|
||||
INSTALL_DOCKER: "0" # Set to '0' to skip Docker installation
|
||||
INSTALL_DOCKER: "1" # Set to '0' to skip Docker installation
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.11"]
|
||||
@@ -46,8 +75,42 @@ jobs:
|
||||
- name: Install & Start Docker
|
||||
if: env.INSTALL_DOCKER == '1'
|
||||
run: |
|
||||
brew install colima docker
|
||||
colima start
|
||||
# Uninstall colima to upgrade to the latest version
|
||||
if brew list colima &>/dev/null; then
|
||||
brew uninstall colima
|
||||
# unlinking colima dependency: go
|
||||
brew uninstall go@1.21
|
||||
fi
|
||||
rm -rf ~/.colima ~/.lima
|
||||
brew install --HEAD colima
|
||||
brew services start colima
|
||||
brew install docker
|
||||
colima delete
|
||||
# Attempt to start Colima
|
||||
ATTEMPT_LIMIT=3
|
||||
|
||||
start_colima() {
|
||||
colima start --network-address --arch x86_64 --cpu=1 --memory=1
|
||||
}
|
||||
|
||||
for ((i=1; i<=ATTEMPT_LIMIT; i++)); do
|
||||
if start_colima; then
|
||||
echo "Colima started successfully."
|
||||
break
|
||||
else
|
||||
echo "Failed to start Colima. Attempt $i/$ATTEMPT_LIMIT."
|
||||
if [ $i -eq $ATTEMPT_LIMIT ]; then
|
||||
colima delete
|
||||
else
|
||||
colima stop
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $i -gt $ATTEMPT_LIMIT ]; then
|
||||
echo "Failed to start Colima after $ATTEMPT_LIMIT attempts."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For testcontainers to find the Colima socket
|
||||
# https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
|
||||
@@ -57,7 +120,7 @@ jobs:
|
||||
run: make build
|
||||
|
||||
- name: Run Tests
|
||||
run: poetry run pytest --forked --cov=agenthub --cov=opendevin --cov-report=xml ./tests/unit -k "not test_sandbox"
|
||||
run: poetry run pytest --forked --cov=agenthub --cov=opendevin --cov-report=xml ./tests/unit -k "not test_sandbox and not test_runtime"
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
@@ -91,37 +154,7 @@ jobs:
|
||||
run: make build
|
||||
|
||||
- name: Run Tests
|
||||
run: poetry run pytest --forked --cov=agenthub --cov=opendevin --cov-report=xml ./tests/unit -k "not test_sandbox"
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
test-for-sandbox:
|
||||
name: Test for Sandbox
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install poetry via pipx
|
||||
run: pipx install poetry
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
cache: "poetry"
|
||||
|
||||
- name: Install Python dependencies using Poetry
|
||||
run: poetry install
|
||||
|
||||
- name: Build Environment
|
||||
run: make build
|
||||
|
||||
- name: Run Integration Test for Sandbox
|
||||
run: |
|
||||
poetry run pytest --cov=agenthub --cov=opendevin --cov-report=xml -s ./tests/unit/test_sandbox.py
|
||||
run: poetry run pytest --forked --cov=agenthub --cov=opendevin --cov-report=xml ./tests/unit -k "not test_sandbox and not test_runtime"
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
|
||||
17
.github/workflows/solve-issue.yml
vendored
17
.github/workflows/solve-issue.yml
vendored
@@ -36,14 +36,27 @@ jobs:
|
||||
echo "BODY:" >> task.txt
|
||||
echo "${ISSUE_BODY}" >> task.txt
|
||||
|
||||
- name: Set up environment
|
||||
run: |
|
||||
curl -sSL https://install.python-poetry.org | python3 -
|
||||
export PATH="/github/home/.local/bin:$PATH"
|
||||
poetry install --without evaluation
|
||||
poetry run playwright install --with-deps chromium
|
||||
|
||||
|
||||
- name: Run OpenDevin
|
||||
env:
|
||||
ISSUE_TITLE: ${{ github.event.issue.title }}
|
||||
ISSUE_BODY: ${{ github.event.issue.body }}
|
||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
SANDBOX_TYPE: exec
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
SANDBOX_BOX_TYPE: ssh
|
||||
run: |
|
||||
WORKSPACE_MOUNT_PATH=$GITHUB_WORKSPACE python ./opendevin/core/main.py -i 50 -f task.txt -d $GITHUB_WORKSPACE
|
||||
# Append path to launch poetry
|
||||
export PATH="/github/home/.local/bin:$PATH"
|
||||
# Append path to correctly import package, note: must set pwd at first
|
||||
export PYTHONPATH=$(pwd):$PYTHONPATH
|
||||
WORKSPACE_MOUNT_PATH=$GITHUB_WORKSPACE poetry run python ./opendevin/core/main.py -i 50 -f task.txt -d $GITHUB_WORKSPACE
|
||||
rm task.txt
|
||||
|
||||
- name: Setup Git, Create Branch, and Commit Changes
|
||||
|
||||
48
.github/workflows/update-pyproject-version.yml
vendored
Normal file
48
.github/workflows/update-pyproject-version.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
name: Update pyproject.toml Version and Tags
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
jobs:
|
||||
update-pyproject-and-tags:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Fetch all history for all branches and tags
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install toml
|
||||
|
||||
- name: Get release tag
|
||||
id: get_release_tag
|
||||
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Update pyproject.toml with release tag
|
||||
run: |
|
||||
python -c "
|
||||
import toml
|
||||
with open('pyproject.toml', 'r') as f:
|
||||
data = toml.load(f)
|
||||
data['tool']['poetry']['version'] = '${{ env.RELEASE_TAG }}'
|
||||
with open('pyproject.toml', 'w') as f:
|
||||
toml.dump(data, f)
|
||||
"
|
||||
|
||||
- name: Commit and push pyproject.toml changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "Update pyproject.toml version to ${{ env.RELEASE_TAG }}"
|
||||
branch: main
|
||||
file_pattern: pyproject.toml
|
||||
18
.gitignore
vendored
18
.gitignore
vendored
@@ -161,9 +161,14 @@ cython_debug/
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
.idea/
|
||||
.vscode/
|
||||
.cursorignore
|
||||
|
||||
# evaluation
|
||||
evaluation/evaluation_outputs
|
||||
evaluation/outputs
|
||||
evaluation/swe_bench/eval_workspace*
|
||||
evaluation/SWE-bench/data
|
||||
evaluation/webarena/scripts/webarena_env.sh
|
||||
|
||||
# frontend
|
||||
|
||||
@@ -176,6 +181,8 @@ frontend/yarn.lock
|
||||
|
||||
# testing
|
||||
frontend/coverage
|
||||
test_results*
|
||||
/_test_files_tmp/
|
||||
|
||||
# production
|
||||
frontend/build
|
||||
@@ -204,8 +211,9 @@ cache
|
||||
# configuration
|
||||
config.toml
|
||||
config.toml.bak
|
||||
evaluation/swe_bench/eval_workspace*
|
||||
evaluation/outputs
|
||||
evaluation/evaluation_outputs
|
||||
test_results*
|
||||
/_test_files_tmp/
|
||||
|
||||
containers/agnostic_sandbox
|
||||
|
||||
# swe-bench-eval
|
||||
image_build_logs
|
||||
run_instance_logs
|
||||
|
||||
@@ -61,7 +61,7 @@ representative at an online or offline event.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
contact@rbren.io
|
||||
contact@all-hands.dev
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
|
||||
@@ -1,13 +1,32 @@
|
||||
# Contributing
|
||||
|
||||
Thanks for your interest in contributing to OpenDevin! We welcome and appreciate contributions.
|
||||
To report bugs, create a [GitHub issue](https://github.com/OpenDevin/OpenDevin/issues/new/choose).
|
||||
|
||||
## Contribution Guide
|
||||
## How Can I Contribute?
|
||||
|
||||
There are many ways that you can contribute:
|
||||
|
||||
1. **Download and use** OpenDevin, and send [issues](https://github.com/OpenDevin/OpenDevin/issues) when you encounter something that isn't working or a feature that you'd like to see.
|
||||
2. **Send feedback** after each session by [clicking the thumbs-up thumbs-down buttons](https://docs.all-hands.dev/modules/usage/feedback), so we can see where things are working and failing, and also build an open dataset for training code agents.
|
||||
3. **Improve the Codebase** by sending PRs (see details below). In particular, we have some [good first issue](https://github.com/OpenDevin/OpenDevin/labels/good%20first%20issue) issues that may be ones to start on.
|
||||
|
||||
## Understanding OpenDevin's CodeBase
|
||||
|
||||
To understand the codebase, please refer to the README in each module:
|
||||
- [frontend](./frontend/README.md)
|
||||
- [agenthub](./agenthub/README.md)
|
||||
- [evaluation](./evaluation/README.md)
|
||||
- [opendevin](./opendevin/README.md)
|
||||
- [server](./opendevin/server/README.md)
|
||||
|
||||
When you write code, it is also good to write tests. Please navigate to the `tests` folder to see existing test suites.
|
||||
At the moment, we have two kinds of tests: `unit` and `integration`. Please refer to the README for each test suite. These tests also run on GitHub's continuous integration to ensure quality of the project.
|
||||
|
||||
## Sending Pull Requests to OpenDevin
|
||||
|
||||
### 1. Fork the Official Repository
|
||||
|
||||
Fork [OpenDevin repository](https://github.com/OpenDevin/OpenDevin) into your own account.
|
||||
Clone your own forked repository into your local environment.
|
||||
Fork the [OpenDevin repository](https://github.com/OpenDevin/OpenDevin) into your own account.
|
||||
Clone your own forked repository into your local environment:
|
||||
|
||||
```shell
|
||||
git clone git@github.com:<YOUR-USERNAME>/OpenDevin.git
|
||||
@@ -16,21 +35,23 @@ git clone git@github.com:<YOUR-USERNAME>/OpenDevin.git
|
||||
### 2. Configure Git
|
||||
|
||||
Set the official repository as your [upstream](https://www.atlassian.com/git/tutorials/git-forks-and-upstreams) to synchronize with the latest update in the official repository.
|
||||
Add the original repository as upstream
|
||||
Add the original repository as upstream:
|
||||
|
||||
```shell
|
||||
cd OpenDevin
|
||||
git remote add upstream git@github.com:OpenDevin/OpenDevin.git
|
||||
```
|
||||
|
||||
Verify that the remote is set.
|
||||
Verify that the remote is set:
|
||||
|
||||
```shell
|
||||
git remote -v
|
||||
```
|
||||
|
||||
You should see both `origin` and `upstream` in the output.
|
||||
|
||||
### 3. Synchronize with Official Repository
|
||||
Synchronize latest commit with official repository before coding.
|
||||
Synchronize latest commit with official repository before coding:
|
||||
|
||||
```shell
|
||||
git fetch upstream
|
||||
@@ -39,25 +60,48 @@ git merge upstream/main
|
||||
git push origin main
|
||||
```
|
||||
|
||||
### 4. Create a New Branch And Open a Pull Request
|
||||
After you finish implementation, open forked repository. The source branch is your new branch, and the target branch is `OpenDevin/OpenDevin` `main` branch. Then PR should appears in [OpenDevin PRs](https://github.com/OpenDevin/OpenDevin/pulls).
|
||||
### 4. Set up the Development Environment
|
||||
|
||||
Then OpenDevin team will review your code.
|
||||
We have a separate doc [Development.md](https://github.com/OpenDevin/OpenDevin/blob/main/Development.md) that tells you how to set up a development workflow.
|
||||
|
||||
### 5. Write Code and Commit It
|
||||
|
||||
Once you have done this, you can write code, test it, and commit it to a branch (replace `my_branch` with an appropriate name):
|
||||
|
||||
```shell
|
||||
git checkout -b my_branch
|
||||
git add .
|
||||
git commit
|
||||
git push origin my_branch
|
||||
```
|
||||
|
||||
### 6. Open a Pull Request
|
||||
|
||||
* On GitHub, go to the page of your forked repository, and create a Pull Request:
|
||||
- Click on `Branches`
|
||||
- Click on the `...` beside your branch and click on `New pull request`
|
||||
- Set `base repository` to `OpenDevin/OpenDevin`
|
||||
- Set `base` to `main`
|
||||
- Click `Create pull request`
|
||||
|
||||
The PR should appear in [OpenDevin PRs](https://github.com/OpenDevin/OpenDevin/pulls).
|
||||
|
||||
Then the OpenDevin team will review your code.
|
||||
|
||||
## PR Rules
|
||||
|
||||
### 1. Pull Request title
|
||||
|
||||
As described in [here](https://github.com/commitizen/conventional-commit-types/blob/master/index.json), a valid PR title should begin with one of the following prefixes:
|
||||
As described [here](https://github.com/commitizen/conventional-commit-types/blob/master/index.json), a valid PR title should begin with one of the following prefixes:
|
||||
|
||||
- `feat`: A new feature
|
||||
- `fix`: A bug fix
|
||||
- `doc`: Documentation only changes
|
||||
- `docs`: Documentation only changes
|
||||
- `style`: Changes that do not affect the meaning of the code (white space, formatting, missing semicolons, etc.)
|
||||
- `refactor`: A code change that neither fixes a bug nor adds a feature
|
||||
- `style`: A refactoring that improves code style
|
||||
- `perf`: A code change that improves performance
|
||||
- `test`: Adding missing tests or correcting existing tests
|
||||
- `ci`: Changes to CI configuration files and scripts (example scopes: `.github`, `ci` (Buildkite))
|
||||
- `build`: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
||||
- `ci`: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||
- `chore`: Other changes that don't modify src or test files
|
||||
- `revert`: Reverts a previous commit
|
||||
|
||||
@@ -67,24 +111,6 @@ For example, a PR title could be:
|
||||
|
||||
You may also check out previous PRs in the [PR list](https://github.com/OpenDevin/OpenDevin/pulls).
|
||||
|
||||
As described in [here](https://github.com/OpenDevin/OpenDevin/labels), we create several labels. Every PR should be tagged with the corresponding labels.
|
||||
|
||||
### 2. Pull Request description
|
||||
|
||||
- If your PR is small (such as a typo fix), you can go brief.
|
||||
- If it is large and you have changed a lot, it's better to write more details.
|
||||
|
||||
|
||||
## How to begin
|
||||
Please refer to the README in each module:
|
||||
- [frontend](./frontend/README.md)
|
||||
- [agenthub](./agenthub/README.md)
|
||||
- [evaluation](./evaluation/README.md)
|
||||
- [opendevin](./opendevin/README.md)
|
||||
- [server](./opendevin/server/README.md)
|
||||
- [mock server](./opendevin/mock/README.md)
|
||||
|
||||
## Tests
|
||||
Please navigate to `tests` folder to see existing test suites.
|
||||
At the moment, we have two kinds of tests: `unit` and `integration`. Please refer to the README for each test suite. These tests also run on CI to ensure quality of
|
||||
the project.
|
||||
- If it contains a lot of changes, it's better to write more details.
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
# Development Guide
|
||||
This guide is for people working on OpenDevin and editing the source code.
|
||||
If you wish to contribute your changes, check out the [CONTRIBUTING.md](https://github.com/OpenDevin/OpenDevin/blob/main/CONTRIBUTING.md) on how to clone and setup the project initially before moving on.
|
||||
Otherwise, you can clone the OpenDevin project directly.
|
||||
|
||||
## Start the server for development
|
||||
|
||||
### 1. Requirements
|
||||
* Linux, Mac OS, or [WSL on Windows](https://learn.microsoft.com/en-us/windows/wsl/install)
|
||||
* Linux, Mac OS, or [WSL on Windows](https://learn.microsoft.com/en-us/windows/wsl/install) [ Ubuntu <= 22.04]
|
||||
* [Docker](https://docs.docker.com/engine/install/) (For those on MacOS, make sure to allow the default Docker socket to be used from advanced settings!)
|
||||
* [Python](https://www.python.org/downloads/) = 3.11
|
||||
* [NodeJS](https://nodejs.org/en/download/package-manager) >= 18.17.1
|
||||
* [Poetry](https://python-poetry.org/docs/#installing-with-the-official-installer) >= 1.8
|
||||
* netcat => sudo apt-get install netcat
|
||||
|
||||
Make sure you have all these dependencies installed before moving on to `make build`.
|
||||
|
||||
@@ -27,42 +29,40 @@ mamba install conda-forge::poetry
|
||||
```
|
||||
|
||||
### 2. Build and Setup The Environment
|
||||
Begin by building the project which includes setting up the environment and installing dependencies. This step ensures that OpenDevin is ready to run on your system:
|
||||
|
||||
- **Build the Project:** Begin by building the project, which includes setting up the environment and installing dependencies. This step ensures that OpenDevin is ready to run smoothly on your system.
|
||||
```bash
|
||||
make build
|
||||
```
|
||||
```bash
|
||||
make build
|
||||
```
|
||||
|
||||
### 3. Configuring the Language Model
|
||||
|
||||
OpenDevin supports a diverse array of Language Models (LMs) through the powerful [litellm](https://docs.litellm.ai) library. By default, we've chosen the mighty GPT-4 from OpenAI as our go-to model, but the world is your oyster! You can unleash the potential of Anthropic's suave Claude, the enigmatic Llama, or any other LM that piques your interest.
|
||||
|
||||
To configure the LM of your choice, follow these steps:
|
||||
To configure the LM of your choice, run:
|
||||
|
||||
1. **Using the Makefile: The Effortless Approach**
|
||||
With a single command, you can have a smooth LM setup for your OpenDevin experience. Simply run:
|
||||
```bash
|
||||
make setup-config
|
||||
```
|
||||
|
||||
This command will prompt you to enter the LLM API key, model name, and other variables ensuring that OpenDevin is tailored to your specific needs. Note that the model name will apply only when you run headless. If you use the UI, please set the model in the UI.
|
||||
Set `persist_sandbox` to false if you want to use clean sandbox for each task. If `persist_sandbox` is set to true, you will need to set the `ssh_password` as well.
|
||||
|
||||
Note: If you have previously run OpenDevin using the docker command, you may have already set some environmental variables in your terminal. The final configurations are set from highest to lowest priority:
|
||||
Environment variables > config.toml variables > default variables
|
||||
|
||||
**Note on Alternative Models:**
|
||||
Some alternative models may prove more challenging to tame than others. Fear not, brave adventurer! We shall soon unveil LLM-specific documentation to guide you on your quest. And if you've already mastered the art of wielding a model other than OpenAI's GPT, we encourage you to [share your setup instructions with us](https://github.com/OpenDevin/OpenDevin/issues/417).
|
||||
Some alternative models may prove more challenging to tame than others. Fear not, brave adventurer! We shall soon unveil LLM-specific documentation to guide you on your quest.
|
||||
And if you've already mastered the art of wielding a model other than OpenAI's GPT, we encourage you to share your setup instructions with us by creating instructions and adding it [to our documentation](https://github.com/OpenDevin/OpenDevin/tree/main/docs/modules/usage/llms).
|
||||
|
||||
For a full list of the LM providers and models available, please consult the [litellm documentation](https://docs.litellm.ai/docs/providers).
|
||||
|
||||
There is also [documentation for running with local models using ollama](./docs/documentation/LOCAL_LLM_GUIDE.md).
|
||||
|
||||
### 4. Run the Application
|
||||
|
||||
- **Run the Application:** Once the setup is complete, launching OpenDevin is as simple as running a single command. This command starts both the backend and frontend servers seamlessly, allowing you to interact with OpenDevin without any hassle.
|
||||
```bash
|
||||
make run
|
||||
```
|
||||
|
||||
### 5. Individual Server Startup
|
||||
### 4. Running the application
|
||||
#### Option A: Run the Full Application
|
||||
Once the setup is complete, launching OpenDevin is as simple as running a single command. This command starts both the backend and frontend servers seamlessly, allowing you to interact with OpenDevin:
|
||||
```bash
|
||||
make run
|
||||
```
|
||||
|
||||
#### Option B: Individual Server Startup
|
||||
- **Start the Backend Server:** If you prefer, you can start the backend server independently to focus on backend-related tasks or configurations.
|
||||
```bash
|
||||
make start-backend
|
||||
@@ -74,29 +74,26 @@ There is also [documentation for running with local models using ollama](./docs/
|
||||
```
|
||||
|
||||
### 6. LLM Debugging
|
||||
|
||||
If you encounter any issues with the Language Model (LM) or you're simply curious, you can inspect the actual LLM prompts and responses. To do so, export DEBUG=1 in the environment and restart the backend. OpenDevin will then log the prompts and responses in the logs/llm/CURRENT_DATE directory, allowing you to identify the causes.
|
||||
If you encounter any issues with the Language Model (LM) or you're simply curious, you can inspect the actual LLM prompts and responses. To do so, export DEBUG=1 in the environment and restart the backend.
|
||||
OpenDevin will then log the prompts and responses in the logs/llm/CURRENT_DATE directory, allowing you to identify the causes.
|
||||
|
||||
### 7. Help
|
||||
|
||||
- **Get Some Help:** Need assistance or information on available targets and commands? The help command provides all the necessary guidance to ensure a smooth experience with OpenDevin.
|
||||
```bash
|
||||
make help
|
||||
```
|
||||
Need assistance or information on available targets and commands? The help command provides all the necessary guidance to ensure a smooth experience with OpenDevin.
|
||||
```bash
|
||||
make help
|
||||
```
|
||||
|
||||
### 8. Testing
|
||||
|
||||
To run tests, refer to the following:
|
||||
#### Unit tests
|
||||
|
||||
```bash
|
||||
poetry run pytest ./tests/unit/test_sandbox.py
|
||||
poetry run pytest ./tests/unit/test_*.py
|
||||
```
|
||||
|
||||
#### Integration tests
|
||||
|
||||
Please refer to [this README](./tests/integration/README.md) for details.
|
||||
|
||||
### 9. Add or update dependency
|
||||
|
||||
1. Add your dependency in `pyproject.toml` or use `poetry add xxx`
|
||||
2. Update the poetry.lock file via `poetry lock --no-update`
|
||||
|
||||
25
ISSUE_TRIAGE.md
Normal file
25
ISSUE_TRIAGE.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Issue Triage
|
||||
These are the procedures and guidelines on how issues are triaged in this repo by the maintainers.
|
||||
|
||||
## General
|
||||
* Most issues must be tagged with **enhancement** or **bug**
|
||||
* Issues may be tagged with what it relates to (**backend**, **frontend**, **agent quality**, etc.)
|
||||
|
||||
## Severity
|
||||
* **Low**: Minor issues, single user report
|
||||
* **Medium**: Affecting multiple users
|
||||
* **Critical**: Affecting all users or potential security issues
|
||||
|
||||
## Effort
|
||||
* Issues may be estimated with effort required (**small effort**, **medium effort**, **large effort**)
|
||||
|
||||
## Difficulty
|
||||
* Issues with low implementation difficulty may be tagged with **good first issue**
|
||||
|
||||
## Not Enough Information
|
||||
* User is asked to provide more information (logs, how to reproduce, etc.) when the issue is not clear
|
||||
* If an issue is unclear and the author does not provide more information or respond to a request, the issue may be closed as **not planned** (Usually after a week)
|
||||
|
||||
## Multiple Requests/Fixes in One Issue
|
||||
* These issues will be narrowed down to one request/fix so the issue is more easily tracked and fixed
|
||||
* Issues may be broken down into multiple issues if required
|
||||
64
Makefile
64
Makefile
@@ -2,14 +2,15 @@ SHELL=/bin/bash
|
||||
# Makefile for OpenDevin project
|
||||
|
||||
# Variables
|
||||
DOCKER_IMAGE = ghcr.io/opendevin/sandbox
|
||||
DOCKER_IMAGE = ghcr.io/opendevin/sandbox:main
|
||||
BACKEND_PORT = 3000
|
||||
BACKEND_HOST = "127.0.0.1:$(BACKEND_PORT)"
|
||||
FRONTEND_PORT = 3001
|
||||
DEFAULT_WORKSPACE_DIR = "./workspace"
|
||||
DEFAULT_MODEL = "gpt-4o"
|
||||
CONFIG_FILE = config.toml
|
||||
PRECOMMIT_CONFIG_PATH = "./dev_config/python/.pre-commit-config.yaml"
|
||||
PRE_COMMIT_CONFIG_PATH = "./dev_config/python/.pre-commit-config.yaml"
|
||||
PYTHON_VERSION = 3.11
|
||||
|
||||
# ANSI color codes
|
||||
GREEN=$(shell tput -Txterm setaf 2)
|
||||
@@ -27,7 +28,7 @@ ifeq ($(INSTALL_DOCKER),)
|
||||
endif
|
||||
@$(MAKE) -s install-python-dependencies
|
||||
@$(MAKE) -s install-frontend-dependencies
|
||||
@$(MAKE) -s install-precommit-hooks
|
||||
@$(MAKE) -s install-pre-commit-hooks
|
||||
@$(MAKE) -s build-frontend
|
||||
@echo "$(GREEN)Build completed successfully.$(RESET)"
|
||||
|
||||
@@ -62,10 +63,10 @@ check-system:
|
||||
|
||||
check-python:
|
||||
@echo "$(YELLOW)Checking Python installation...$(RESET)"
|
||||
@if command -v python3.11 > /dev/null; then \
|
||||
echo "$(BLUE)$(shell python3.11 --version) is already installed.$(RESET)"; \
|
||||
@if command -v python$(PYTHON_VERSION) > /dev/null; then \
|
||||
echo "$(BLUE)$(shell python$(PYTHON_VERSION) --version) is already installed.$(RESET)"; \
|
||||
else \
|
||||
echo "$(RED)Python 3.11 is not installed. Please install Python 3.11 to continue.$(RESET)"; \
|
||||
echo "$(RED)Python $(PYTHON_VERSION) is not installed. Please install Python $(PYTHON_VERSION) to continue.$(RESET)"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
@@ -112,13 +113,13 @@ check-poetry:
|
||||
echo "$(BLUE)$(shell poetry --version) is already installed.$(RESET)"; \
|
||||
else \
|
||||
echo "$(RED)Poetry 1.8 or later is required. You can install poetry by running the following command, then adding Poetry to your PATH:"; \
|
||||
echo "$(RED) curl -sSL https://install.python-poetry.org | python3 -$(RESET)"; \
|
||||
echo "$(RED) curl -sSL https://install.python-poetry.org | python$(PYTHON_VERSION) -$(RESET)"; \
|
||||
echo "$(RED)More detail here: https://python-poetry.org/docs/#installing-with-the-official-installer$(RESET)"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
else \
|
||||
echo "$(RED)Poetry is not installed. You can install poetry by running the following command, then adding Poetry to your PATH:"; \
|
||||
echo "$(RED) curl -sSL https://install.python-poetry.org | python3.11 -$(RESET)"; \
|
||||
echo "$(RED) curl -sSL https://install.python-poetry.org | python$(PYTHON_VERSION) -$(RESET)"; \
|
||||
echo "$(RED)More detail here: https://python-poetry.org/docs/#installing-with-the-official-installer$(RESET)"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@@ -130,7 +131,11 @@ pull-docker-image:
|
||||
|
||||
install-python-dependencies:
|
||||
@echo "$(GREEN)Installing Python dependencies...$(RESET)"
|
||||
poetry env use python3.11
|
||||
@if [ -z "${TZ}" ]; then \
|
||||
echo "Defaulting TZ (timezone) to UTC"; \
|
||||
export TZ="UTC"; \
|
||||
fi
|
||||
poetry env use python$(PYTHON_VERSION)
|
||||
@if [ "$(shell uname)" = "Darwin" ]; then \
|
||||
echo "$(BLUE)Installing chroma-hnswlib...$(RESET)"; \
|
||||
export HNSWLIB_NO_NATIVE=1; \
|
||||
@@ -157,22 +162,19 @@ install-frontend-dependencies:
|
||||
@echo "$(YELLOW)Setting up frontend environment...$(RESET)"
|
||||
@echo "$(YELLOW)Detect Node.js version...$(RESET)"
|
||||
@cd frontend && node ./scripts/detect-node-version.js
|
||||
@cd frontend && \
|
||||
echo "$(BLUE)Installing frontend dependencies with npm...$(RESET)" && \
|
||||
npm install && \
|
||||
echo "$(BLUE)Running make-i18n with npm...$(RESET)" && \
|
||||
npm run make-i18n
|
||||
echo "$(BLUE)Installing frontend dependencies with npm...$(RESET)"
|
||||
@cd frontend && npm install
|
||||
@echo "$(GREEN)Frontend dependencies installed successfully.$(RESET)"
|
||||
|
||||
install-precommit-hooks:
|
||||
install-pre-commit-hooks:
|
||||
@echo "$(YELLOW)Installing pre-commit hooks...$(RESET)"
|
||||
@git config --unset-all core.hooksPath || true
|
||||
@poetry run pre-commit install --config $(PRECOMMIT_CONFIG_PATH)
|
||||
@poetry run pre-commit install --config $(PRE_COMMIT_CONFIG_PATH)
|
||||
@echo "$(GREEN)Pre-commit hooks installed successfully.$(RESET)"
|
||||
|
||||
lint-backend:
|
||||
@echo "$(YELLOW)Running linters...$(RESET)"
|
||||
@poetry run pre-commit run --files opendevin/**/* agenthub/**/* evaluation/**/* --show-diff-on-failure --config $(PRECOMMIT_CONFIG_PATH)
|
||||
@poetry run pre-commit run --files opendevin/**/* agenthub/**/* evaluation/**/* --show-diff-on-failure --config $(PRE_COMMIT_CONFIG_PATH)
|
||||
|
||||
lint-frontend:
|
||||
@echo "$(YELLOW)Running linters for frontend...$(RESET)"
|
||||
@@ -203,11 +205,10 @@ start-frontend:
|
||||
@echo "$(YELLOW)Starting frontend...$(RESET)"
|
||||
@cd frontend && VITE_BACKEND_HOST=$(BACKEND_HOST) VITE_FRONTEND_PORT=$(FRONTEND_PORT) npm run start
|
||||
|
||||
# Run the app
|
||||
run:
|
||||
@echo "$(YELLOW)Running the app...$(RESET)"
|
||||
# Common setup for running the app (non-callable)
|
||||
_run_setup:
|
||||
@if [ "$(OS)" = "Windows_NT" ]; then \
|
||||
echo "$(RED)`make run` is not supported on Windows. Please run `make start-frontend` and `make start-backend` separately.$(RESET)"; \
|
||||
echo "$(RED) Windows is not supported, use WSL instead!$(RESET)"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@mkdir -p logs
|
||||
@@ -216,9 +217,21 @@ run:
|
||||
@echo "$(YELLOW)Waiting for the backend to start...$(RESET)"
|
||||
@until nc -z localhost $(BACKEND_PORT); do sleep 0.1; done
|
||||
@echo "$(GREEN)Backend started successfully.$(RESET)"
|
||||
|
||||
# Run the app (standard mode)
|
||||
run:
|
||||
@echo "$(YELLOW)Running the app...$(RESET)"
|
||||
@$(MAKE) -s _run_setup
|
||||
@cd frontend && echo "$(BLUE)Starting frontend with npm...$(RESET)" && npm run start -- --port $(FRONTEND_PORT)
|
||||
@echo "$(GREEN)Application started successfully.$(RESET)"
|
||||
|
||||
# Run the app (WSL mode)
|
||||
run-wsl:
|
||||
@echo "$(YELLOW)Running the app in WSL mode...$(RESET)"
|
||||
@$(MAKE) -s _run_setup
|
||||
@cd frontend && echo "$(BLUE)Starting frontend with npm (WSL mode)...$(RESET)" && npm run dev_wsl -- --port $(FRONTEND_PORT)
|
||||
@echo "$(GREEN)Application started successfully in WSL mode.$(RESET)"
|
||||
|
||||
# Setup config.toml
|
||||
setup-config:
|
||||
@echo "$(YELLOW)Setting up config.toml...$(RESET)"
|
||||
@@ -229,15 +242,16 @@ setup-config:
|
||||
setup-config-prompts:
|
||||
@echo "[core]" > $(CONFIG_FILE).tmp
|
||||
|
||||
@read -p "Enter your workspace directory [default: $(DEFAULT_WORKSPACE_DIR)]: " workspace_dir; \
|
||||
@read -p "Enter your workspace directory (as absolute path) [default: $(DEFAULT_WORKSPACE_DIR)]: " workspace_dir; \
|
||||
workspace_dir=$${workspace_dir:-$(DEFAULT_WORKSPACE_DIR)}; \
|
||||
echo "workspace_base=\"$$workspace_dir\"" >> $(CONFIG_FILE).tmp
|
||||
|
||||
@read -p "Do you want to persist the sandbox container? [true/false] [default: true]: " persist_sandbox; \
|
||||
persist_sandbox=$${persist_sandbox:-true}; \
|
||||
@read -p "Do you want to persist the sandbox container? [true/false] [default: false]: " persist_sandbox; \
|
||||
persist_sandbox=$${persist_sandbox:-false}; \
|
||||
if [ "$$persist_sandbox" = "true" ]; then \
|
||||
read -p "Enter a password for the sandbox container: " ssh_password; \
|
||||
echo "ssh_password=\"$$ssh_password\"" >> $(CONFIG_FILE).tmp; \
|
||||
echo "persist_sandbox=$$persist_sandbox" >> $(CONFIG_FILE).tmp; \
|
||||
else \
|
||||
echo "persist_sandbox=$$persist_sandbox" >> $(CONFIG_FILE).tmp; \
|
||||
fi
|
||||
@@ -302,4 +316,4 @@ help:
|
||||
@echo " $(GREEN)help$(RESET) - Display this help message, providing information on available targets."
|
||||
|
||||
# Phony targets
|
||||
.PHONY: build check-dependencies check-python check-npm check-docker check-poetry pull-docker-image install-python-dependencies install-frontend-dependencies install-precommit-hooks lint start-backend start-frontend run setup-config setup-config-prompts help
|
||||
.PHONY: build check-dependencies check-python check-npm check-docker check-poetry pull-docker-image install-python-dependencies install-frontend-dependencies install-pre-commit-hooks lint start-backend start-frontend run run-wsl setup-config setup-config-prompts help
|
||||
|
||||
52
README.md
52
README.md
@@ -26,8 +26,6 @@
|
||||
<br/>
|
||||
<a href="https://join.slack.com/t/opendevin/shared_invite/zt-2i1iqdag6-bVmvamiPA9EZUu7oCO6KhA"><img src="https://img.shields.io/badge/Slack-Join%20Us-red?logo=slack&logoColor=white&style=for-the-badge" alt="Join our Slack community"></a>
|
||||
<a href="https://discord.gg/ESHStjSjD4"><img src="https://img.shields.io/badge/Discord-Join%20Us-purple?logo=discord&logoColor=white&style=for-the-badge" alt="Join our Discord community"></a>
|
||||
<br/>
|
||||
<a href="https://huggingface.co/spaces/OpenDevin/evaluation"><img src="https://img.shields.io/badge/SWE--bench%20Lite-25.0%25-green?style=for-the-badge" alt="SWE-bench "></a>
|
||||
<a href="https://codecov.io/github/opendevin/opendevin?branch=main"><img alt="CodeCov" src="https://img.shields.io/codecov/c/github/opendevin/opendevin?style=for-the-badge"></a>
|
||||
</div>
|
||||
|
||||
@@ -35,7 +33,8 @@
|
||||
<div align="center">
|
||||
<img src="./docs/static/img/logo.png" alt="Logo" width="200" height="200">
|
||||
<h1 align="center">OpenDevin: Code Less, Make More</h1>
|
||||
<a href="https://opendevin.github.io/OpenDevin/"><img src="https://img.shields.io/badge/Documentation-OpenDevin-blue?logo=googledocs&logoColor=white&style=for-the-badge" alt="Check out the documentation"></a>
|
||||
<a href="https://docs.all-hands.dev/modules/usage/intro"><img src="https://img.shields.io/badge/Documentation-OpenDevin-blue?logo=googledocs&logoColor=white&style=for-the-badge" alt="Check out the documentation"></a>
|
||||
<a href="https://huggingface.co/spaces/OpenDevin/evaluation"><img src="https://img.shields.io/badge/Evaluation-Benchmark%20on%20HF%20Space-green?style=for-the-badge" alt="Evaluation Benchmark"></a>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
@@ -46,7 +45,7 @@ OpenDevin agents collaborate with human developers to write code, fix bugs, and
|
||||

|
||||
|
||||
## ⚡ Getting Started
|
||||
The easiest way to run OpenDevin is inside a Docker container. It works best with the most recent version of Docker, `26.0.0`.
|
||||
OpenDevin works best with Docker version 26.0.0+ (Docker Desktop 4.31.0+).
|
||||
You must be using Linux, Mac OS, or WSL on Windows.
|
||||
|
||||
To start OpenDevin in a docker container, run the following commands in your terminal:
|
||||
@@ -55,29 +54,40 @@ To start OpenDevin in a docker container, run the following commands in your ter
|
||||
> When you run the following command, files in `./workspace` may be modified or deleted.
|
||||
|
||||
```bash
|
||||
OPENDEVIN_WORKSPACE=$(pwd)/workspace
|
||||
WORKSPACE_BASE=$(pwd)/workspace
|
||||
docker run -it \
|
||||
--pull=always \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e PERSIST_SANDBOX="true" \
|
||||
-e SSH_PASSWORD="make something up here" \
|
||||
-e WORKSPACE_MOUNT_PATH=$OPENDEVIN_WORKSPACE \
|
||||
-v $OPENDEVIN_WORKSPACE:/opt/workspace_base \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-p 3000:3000 \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
--name opendevin-app-$(date +%Y%m%d%H%M%S) \
|
||||
ghcr.io/opendevin/opendevin:0.6
|
||||
ghcr.io/opendevin/opendevin
|
||||
```
|
||||
|
||||
You'll find OpenDevin running at [http://localhost:3000](http://localhost:3000) with access to `./workspace`. To have OpenDevin operate on your code, place it in `./workspace`.
|
||||
> [!NOTE]
|
||||
> By default, this command pulls the `latest` tag, which represents the most recent release of OpenDevin. You have other options as well:
|
||||
> - For a specific release version, use `ghcr.io/opendevin/opendevin:<OpenDevin_version>` (replace <OpenDevin_version> with the desired version number).
|
||||
> - For the most up-to-date development version, use `ghcr.io/opendevin/opendevin:main`. This version may be **(unstable!)** and is recommended for testing or development purposes only.
|
||||
>
|
||||
> Choose the tag that best suits your needs based on stability requirements and desired features.
|
||||
|
||||
You'll find OpenDevin running at [http://localhost:3000](http://localhost:3000) with access to `./workspace`. To have OpenDevin operate on your code, place it in `./workspace`.
|
||||
OpenDevin will only have access to this workspace folder. The rest of your system will not be affected as it runs in a secured docker sandbox.
|
||||
|
||||
Upon opening OpenDevin, you must select the appropriate `Model` and enter the `API Key` within the settings that should pop up automatically. These can be set at any time by selecting
|
||||
the `Settings` button (gear icon) in the UI. If the required `Model` does not exist in the list, you can manually enter it in the text box.
|
||||
|
||||
For the development workflow, see [Development.md](https://github.com/OpenDevin/OpenDevin/blob/main/Development.md).
|
||||
|
||||
Are you having trouble? Check out our [Troubleshooting Guide](https://docs.all-hands.dev/modules/usage/troubleshooting).
|
||||
|
||||
## 🚀 Documentation
|
||||
|
||||
To learn more about the project, and for tips on using OpenDevin,
|
||||
**check out our [documentation](https://opendevin.github.io/OpenDevin/)**.
|
||||
**check out our [documentation](https://docs.all-hands.dev/modules/usage/intro)**.
|
||||
|
||||
There you'll find resources on how to use different LLM providers (like ollama and Anthropic's Claude),
|
||||
troubleshooting resources, and advanced configuration options.
|
||||
@@ -103,11 +113,6 @@ Let's make software engineering better together!
|
||||
- [Discord server](https://discord.gg/ESHStjSjD4) - This is a community-run server for general discussion, questions, and feedback.
|
||||
|
||||
## 📈 Progress
|
||||
<p align="center">
|
||||
<a href="https://www.swebench.com/lite.html">
|
||||
<img src="/docs/static/img/results.png" alt="SWE-Bench Lite Score" width="500" height="auto">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://star-history.com/#OpenDevin/OpenDevin&Date">
|
||||
@@ -129,3 +134,16 @@ Distributed under the MIT License. See [`LICENSE`](./LICENSE) for more informati
|
||||
[issues-url]: https://github.com/OpenDevin/OpenDevin/issues
|
||||
[license-shield]: https://img.shields.io/github/license/opendevin/opendevin?style=for-the-badge
|
||||
[license-url]: https://github.com/OpenDevin/OpenDevin/blob/main/LICENSE
|
||||
|
||||
## 📚 Cite
|
||||
|
||||
```
|
||||
@misc{opendevin2024,
|
||||
author = {{OpenDevin Team}},
|
||||
title = {{OpenDevin: An Open Platform for AI Software Developers as Generalist Agents}},
|
||||
year = {2024},
|
||||
version = {v1.0},
|
||||
howpublished = {\url{https://github.com/OpenDevin/OpenDevin}},
|
||||
note = {Accessed: ENTER THE DATE YOU ACCESSED THE PROJECT}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
In this folder, there may exist multiple implementations of `Agent` that will be used by the framework.
|
||||
|
||||
For example, `agenthub/monologue_agent`, `agenthub/metagpt_agent`, `agenthub/codeact_agent`, etc.
|
||||
For example, `agenthub/codeact_agent`, etc.
|
||||
Contributors from different backgrounds and interests can choose to contribute to any (or all!) of these directions.
|
||||
|
||||
## Constructing an Agent
|
||||
|
||||
The abstraction for an agent can be found [here](../opendevin/agent.py).
|
||||
The abstraction for an agent can be found [here](../opendevin/controller/agent.py).
|
||||
|
||||
Agents are run inside of a loop. At each iteration, `agent.step()` is called with a
|
||||
[State](../opendevin/state.py) input, and the agent must output an [Action](../opendevin/action).
|
||||
[State](../opendevin/controller/state/state.py) input, and the agent must output an [Action](../opendevin/events/action).
|
||||
|
||||
Every agent also has a `self.llm` which it can use to interact with the LLM configured by the user.
|
||||
See the [LiteLLM docs for `self.llm.completion`](https://docs.litellm.ai/docs/completion).
|
||||
@@ -28,39 +28,33 @@ The `state` contains:
|
||||
|
||||
Here is a list of available Actions, which can be returned by `agent.step()`:
|
||||
|
||||
- [`CmdRunAction`](../opendevin/action/bash.py) - Runs a command inside a sandboxed terminal
|
||||
- [`CmdKillAction`](../opendevin/action/bash.py) - Kills a background command
|
||||
- [`IPythonRunCellAction`](../opendevin/action/bash.py) - Execute a block of Python code interactively (in Jupyter notebook) and receives `CmdOutputObservation`. Requires setting up `jupyter` [plugin](../opendevin/sandbox/plugins) as a requirement.
|
||||
- [`FileReadAction`](../opendevin/action/fileop.py) - Reads the content of a file
|
||||
- [`FileWriteAction`](../opendevin/action/fileop.py) - Writes new content to a file
|
||||
- [`BrowseURLAction`](../opendevin/action/browse.py) - Gets the content of a URL
|
||||
- [`AgentRecallAction`](../opendevin/action/agent.py) - Searches memory (e.g. a vector database)
|
||||
- [`AddTaskAction`](../opendevin/action/tasks.py) - Adds a subtask to the plan
|
||||
- [`ModifyTaskAction`](../opendevin/action/tasks.py) - Changes the state of a subtask
|
||||
- [`AgentThinkAction`](../opendevin/action/agent.py) - A no-op that allows the agent to add plaintext to the history (as well as the chat log)
|
||||
- [`AgentTalkAction`](../opendevin/action/agent.py) - A no-op that allows the agent to add plaintext to the history and talk to the user.
|
||||
- [`AgentFinishAction`](../opendevin/action/agent.py) - Stops the control loop, allowing the user/delegator agent to enter a new task
|
||||
- [`AgentRejectAction`](../opendevin/action/agent.py) - Stops the control loop, allowing the user/delegator agent to enter a new task
|
||||
- [`AgentFinishAction`](../opendevin/action/agent.py) - Stops the control loop, allowing the user to enter a new task
|
||||
- [`MessageAction`](../opendevin/action/message.py) - Represents a message from an agent or the user
|
||||
- [`CmdRunAction`](../opendevin/events/action/commands.py) - Runs a command inside a sandboxed terminal
|
||||
- [`IPythonRunCellAction`](../opendevin/events/action/commands.py) - Execute a block of Python code interactively (in Jupyter notebook) and receives `CmdOutputObservation`. Requires setting up `jupyter` [plugin](../opendevin/runtime/plugins) as a requirement.
|
||||
- [`FileReadAction`](../opendevin/events/action/files.py) - Reads the content of a file
|
||||
- [`FileWriteAction`](../opendevin/events/action/files.py) - Writes new content to a file
|
||||
- [`BrowseURLAction`](../opendevin/events/action/browse.py) - Gets the content of a URL
|
||||
- [`AddTaskAction`](../opendevin/events/action/tasks.py) - Adds a subtask to the plan
|
||||
- [`ModifyTaskAction`](../opendevin/events/action/tasks.py) - Changes the state of a subtask.
|
||||
- [`AgentFinishAction`](../opendevin/events/action/agent.py) - Stops the control loop, allowing the user/delegator agent to enter a new task
|
||||
- [`AgentRejectAction`](../opendevin/events/action/agent.py) - Stops the control loop, allowing the user/delegator agent to enter a new task
|
||||
- [`AgentFinishAction`](../opendevin/events/action/agent.py) - Stops the control loop, allowing the user to enter a new task
|
||||
- [`MessageAction`](../opendevin/events/action/message.py) - Represents a message from an agent or the user
|
||||
|
||||
You can use `action.to_dict()` and `action_from_dict` to serialize and deserialize actions.
|
||||
|
||||
## Observations
|
||||
|
||||
There are also several types of Observations. These are typically available in the step following the corresponding Action.
|
||||
But they may also appear as a result of asynchronous events (e.g. a message from the user, logs from a command running
|
||||
in the background).
|
||||
But they may also appear as a result of asynchronous events (e.g. a message from the user).
|
||||
|
||||
Here is a list of available Observations:
|
||||
|
||||
- [`CmdOutputObservation`](../opendevin/observation/run.py)
|
||||
- [`BrowserOutputObservation`](../opendevin/observation/browse.py)
|
||||
- [`FileReadObservation`](../opendevin/observation/files.py)
|
||||
- [`FileWriteObservation`](../opendevin/observation/files.py)
|
||||
- [`AgentRecallObservation`](../opendevin/observation/recall.py)
|
||||
- [`ErrorObservation`](../opendevin/observation/error.py)
|
||||
- [`SuccessObservation`](../opendevin/observation/success.py)
|
||||
- [`CmdOutputObservation`](../opendevin/events/observation/commands.py)
|
||||
- [`BrowserOutputObservation`](../opendevin/events/observation/browse.py)
|
||||
- [`FileReadObservation`](../opendevin/events/observation/files.py)
|
||||
- [`FileWriteObservation`](../opendevin/events/observation/files.py)
|
||||
- [`ErrorObservation`](../opendevin/events/observation/error.py)
|
||||
- [`SuccessObservation`](../opendevin/events/observation/success.py)
|
||||
|
||||
You can use `observation.to_dict()` and `observation_from_dict` to serialize and deserialize observations.
|
||||
|
||||
@@ -76,14 +70,3 @@ def step(self, state: "State") -> "Action"
|
||||
|
||||
`step` moves the agent forward one step towards its goal. This probably means
|
||||
sending a prompt to the LLM, then parsing the response into an `Action`.
|
||||
|
||||
### `search_memory`
|
||||
|
||||
```
|
||||
def search_memory(self, query: str) -> list[str]:
|
||||
```
|
||||
|
||||
`search_memory` should return a list of events that match the query. This will be used
|
||||
for the `recall` action.
|
||||
|
||||
You can optionally just return `[]` for this method, meaning the agent has no long-term memory.
|
||||
|
||||
@@ -1,405 +0,0 @@
|
||||
# GPT-4 Examples:
|
||||
|
||||
### Notes:
|
||||
- The final result is not completed as I only gave it 10 steps, but shows very promising use of the tools.
|
||||
- This whole run costs: $0.35 using gpt-4-turbo
|
||||
- Input Tokens: 29,734
|
||||
- Completion Tokens: 1,636
|
||||
|
||||
Interesting things:
|
||||
1. Using comments as an initial placeholder for the next move and then having that output in memory is a very cool behavior.
|
||||
2. It makes very small iterative changes due to the prompting.
|
||||
3. A lot of the logic for the game is present but not put together well
|
||||
4. There are a lot of odd quirks with the code that it has written.
|
||||
5. Some odd agent behavior with putting random lines of code in random places?
|
||||
6. The structure of the feedback loop needs some improvement so the agent can see the changes it has made better in context.
|
||||
7. Might be beneficial to add in some line numbers so the model knows what lines it is looking at.
|
||||
|
||||
|
||||
```
|
||||
==============
|
||||
STEP 0
|
||||
|
||||
PLAN:
|
||||
Please make conway's game of life in python using the pygame library. Be sure to use the tools in your workspace to help you out.
|
||||
Usage(completion_tokens=91, prompt_tokens=2047, total_tokens=2138)
|
||||
|
||||
==== RAW OUTPUT ====
|
||||
Thoughts:
|
||||
To start implementing Conway's Game of Life in Python using the pygame library, I first need to set up a Python script file where I can write the code. I'll create a new Python file named `game_of_life.py`. This file will serve as the base for writing the game logic and using pygame functionalities.
|
||||
|
||||
Action:
|
||||
"""
|
||||
write game_of_life.py # This is a placeholder for the game of life implementation using pygame.
|
||||
"""
|
||||
|
||||
==== END RAW ====
|
||||
|
||||
|
||||
ACTION:
|
||||
FileWriteAction(path='game_of_life.py', content='# This is a placeholder for the game of life implementation using pygame.', start=0, end=-1, thoughts="Thoughts:\nTo start implementing Conway's Game of Life in Python using the pygame library, I first need to set up a Python script file where I can write the code. I'll create a new Python file named `game_of_life.py`. This file will serve as the base for writing the game logic and using pygame functionalities.\n\nAction:", action=<ActionType.WRITE: 'write'>)
|
||||
|
||||
OBSERVATION:
|
||||
WRITE OPERATION:
|
||||
You have written to "game_of_life.py" on these lines: 0:-1.
|
||||
|
||||
|
||||
==============
|
||||
STEP 1
|
||||
|
||||
PLAN:
|
||||
Please make conway's game of life in python using the pygame library. Be sure to use the tools in your workspace to help you out.
|
||||
Usage(completion_tokens=101, prompt_tokens=2351, total_tokens=2452)
|
||||
|
||||
==== RAW OUTPUT ====
|
||||
Thoughts:
|
||||
The placeholder for the game of life implementation using pygame has been set up in the file `game_of_life.py`. The next step is to start implementing the basic structure of the game. This includes importing necessary libraries, initializing the pygame module, setting up the display window, and defining the main game loop. I will begin by importing pygame and initializing it, which are the foundational steps for any pygame application.
|
||||
|
||||
Action:
|
||||
"""
|
||||
edit 0 0 import pygame
|
||||
|
||||
pygame.init()
|
||||
"""
|
||||
|
||||
==== END RAW ====
|
||||
|
||||
|
||||
ACTION:
|
||||
FileWriteAction(path='game_of_life.py', content='import pygame\n\npygame.init()', start=0, end=0, thoughts='Thoughts:\nThe placeholder for the game of life implementation using pygame has been set up in the file `game_of_life.py`. The next step is to start implementing the basic structure of the game. This includes importing necessary libraries, initializing the pygame module, setting up the display window, and defining the main game loop. I will begin by importing pygame and initializing it, which are the foundational steps for any pygame application.\n\nAction:', action=<ActionType.WRITE: 'write'>)
|
||||
|
||||
OBSERVATION:
|
||||
WRITE OPERATION:
|
||||
You have written to "game_of_life.py" on these lines: 0:0.
|
||||
|
||||
|
||||
==============
|
||||
STEP 2
|
||||
|
||||
PLAN:
|
||||
Please make conway's game of life in python using the pygame library. Be sure to use the tools in your workspace to help you out.
|
||||
Usage(completion_tokens=123, prompt_tokens=2552, total_tokens=2675)
|
||||
|
||||
==== RAW OUTPUT ====
|
||||
Thoughts:
|
||||
Previously, I initialized pygame in the `game_of_life.py` file. The next step is to set up the display window for the game. This involves defining the size of the window and setting the title. This is crucial as it provides the visual interface for the game. I will also add a comment to indicate that this is the setup for the display window.
|
||||
|
||||
Action:
|
||||
"""
|
||||
edit 2 2
|
||||
# Setup the display window
|
||||
screen_size = (800, 600)
|
||||
screen = pygame.display.set_mode(screen_size)
|
||||
pygame.display.set_caption("Conway's Game of Life")
|
||||
"""
|
||||
==== END RAW ====
|
||||
|
||||
|
||||
ACTION:
|
||||
FileWriteAction(path='game_of_life.py', content='# Setup the display window\nscreen_size = (800, 600)\nscreen = pygame.display.set_mode(screen_size)\npygame.display.set_caption("Conway\'s Game of Life")', start=2, end=2, thoughts='Thoughts:\nPreviously, I initialized pygame in the `game_of_life.py` file. The next step is to set up the display window for the game. This involves defining the size of the window and setting the title. This is crucial as it provides the visual interface for the game. I will also add a comment to indicate that this is the setup for the display window.\n\nAction:', action=<ActionType.WRITE: 'write'>)
|
||||
|
||||
OBSERVATION:
|
||||
WRITE OPERATION:
|
||||
You have written to "game_of_life.py" on these lines: 2:2.
|
||||
|
||||
|
||||
==============
|
||||
STEP 3
|
||||
|
||||
PLAN:
|
||||
Please make conway's game of life in python using the pygame library. Be sure to use the tools in your workspace to help you out.
|
||||
Usage(completion_tokens=144, prompt_tokens=2777, total_tokens=2921)
|
||||
|
||||
==== RAW OUTPUT ====
|
||||
Thoughts:
|
||||
So far, I have set up the basic structure for Conway's Game of Life using pygame, including initializing pygame and setting up the display window. The next step is to define the main game loop where the game's logic will be continuously updated and rendered. This loop will handle events, update the game state, and redraw the screen. I will start by defining the main loop structure and a basic event handling mechanism to allow for quitting the game when the user presses the close button.
|
||||
|
||||
Action:
|
||||
"""
|
||||
edit 5 5 # Main game loop
|
||||
running = True
|
||||
while running:
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
running = False
|
||||
"""
|
||||
|
||||
==== END RAW ====
|
||||
|
||||
|
||||
ACTION:
|
||||
FileWriteAction(path='game_of_life.py', content='# Main game loop\nrunning = True\nwhile running:\n for event in pygame.event.get():\n if event.type == pygame.QUIT:\n running = False', start=5, end=5, thoughts="Thoughts:\nSo far, I have set up the basic structure for Conway's Game of Life using pygame, including initializing pygame and setting up the display window. The next step is to define the main game loop where the game's logic will be continuously updated and rendered. This loop will handle events, update the game state, and redraw the screen. I will start by defining the main loop structure and a basic event handling mechanism to allow for quitting the game when the user presses the close button.\n\nAction:", action=<ActionType.WRITE: 'write'>)
|
||||
|
||||
OBSERVATION:
|
||||
WRITE OPERATION:
|
||||
You have written to "game_of_life.py" on these lines: 5:5.
|
||||
|
||||
|
||||
==============
|
||||
STEP 4
|
||||
|
||||
PLAN:
|
||||
Please make conway's game of life in python using the pygame library. Be sure to use the tools in your workspace to help you out.
|
||||
Usage(completion_tokens=222, prompt_tokens=3022, total_tokens=3244)
|
||||
|
||||
==== RAW OUTPUT ====
|
||||
Thoughts:
|
||||
So far, I have set up the basic structure for Conway's Game of Life using pygame, including initializing pygame, setting up the display window, and defining the main game loop. The next step is to implement the logic for Conway's Game of Life. This involves creating a grid to represent the game state, initializing it with a random pattern, and defining the rules for cell survival, birth, and death. I will start by defining the grid size and initializing the grid with random states.
|
||||
|
||||
Action:
|
||||
"""
|
||||
edit 7 7 # Define grid size and initialize grid
|
||||
grid_size = (50, 50) # Grid size as a tuple (rows, columns)
|
||||
grid = [[0 for x in range(grid_size[1])] for y in range(grid_size[0])] # Initialize grid with zeros
|
||||
import random
|
||||
for y in range(grid_size[0]):
|
||||
for x in range(grid_size[1]):
|
||||
grid[y][x] = random.randint(0, 1) # Randomly assign cells as alive (1) or dead (0)
|
||||
"""
|
||||
==== END RAW ====
|
||||
|
||||
|
||||
ACTION:
|
||||
FileWriteAction(path='game_of_life.py', content='# Define grid size and initialize grid\ngrid_size = (50, 50) # Grid size as a tuple (rows, columns)\ngrid = [[0 for x in range(grid_size[1])] for y in range(grid_size[0])] # Initialize grid with zeros\nimport random\nfor y in range(grid_size[0]):\n for x in range(grid_size[1]):\n grid[y][x] = random.randint(0, 1) # Randomly assign cells as alive (1) or dead (0)', start=7, end=7, thoughts="Thoughts:\nSo far, I have set up the basic structure for Conway's Game of Life using pygame, including initializing pygame, setting up the display window, and defining the main game loop. The next step is to implement the logic for Conway's Game of Life. This involves creating a grid to represent the game state, initializing it with a random pattern, and defining the rules for cell survival, birth, and death. I will start by defining the grid size and initializing the grid with random states.\n\nAction:", action=<ActionType.WRITE: 'write'>)
|
||||
|
||||
OBSERVATION:
|
||||
WRITE OPERATION:
|
||||
You have written to "game_of_life.py" on these lines: 7:7.
|
||||
|
||||
|
||||
==============
|
||||
STEP 5
|
||||
|
||||
PLAN:
|
||||
Please make conway's game of life in python using the pygame library. Be sure to use the tools in your workspace to help you out.
|
||||
Usage(completion_tokens=234, prompt_tokens=3158, total_tokens=3392)
|
||||
|
||||
==== RAW OUTPUT ====
|
||||
Thoughts:
|
||||
So far, I have set up the basic structure for Conway's Game of Life using pygame, including initializing pygame, setting up the display window, defining the main game loop, and initializing the grid with random states. The next step is to implement the rules for Conway's Game of Life. This involves checking each cell's neighbors to determine its next state based on the number of alive neighbors. I will start by defining a function to count the alive neighbors for a given cell.
|
||||
|
||||
Action:
|
||||
"""
|
||||
edit 9 9 def count_alive_neighbors(grid, x, y):
|
||||
directions = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
|
||||
count = 0
|
||||
for dx, dy in directions:
|
||||
nx, ny = x + dx, y + dy
|
||||
if 0 <= nx < grid_size[1] and 0 <= ny < grid_size[0]:
|
||||
count += grid[ny][nx]
|
||||
return count
|
||||
"""
|
||||
|
||||
==== END RAW ====
|
||||
|
||||
|
||||
ACTION:
|
||||
FileWriteAction(path='game_of_life.py', content='def count_alive_neighbors(grid, x, y):\n directions = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]\n count = 0\n for dx, dy in directions:\n nx, ny = x + dx, y + dy\n if 0 <= nx < grid_size[1] and 0 <= ny < grid_size[0]:\n count += grid[ny][nx]\n return count', start=9, end=9, thoughts="Thoughts:\nSo far, I have set up the basic structure for Conway's Game of Life using pygame, including initializing pygame, setting up the display window, defining the main game loop, and initializing the grid with random states. The next step is to implement the rules for Conway's Game of Life. This involves checking each cell's neighbors to determine its next state based on the number of alive neighbors. I will start by defining a function to count the alive neighbors for a given cell.\n\nAction:", action=<ActionType.WRITE: 'write'>)
|
||||
|
||||
OBSERVATION:
|
||||
WRITE OPERATION:
|
||||
You have written to "game_of_life.py" on these lines: 9:9.
|
||||
|
||||
|
||||
==============
|
||||
STEP 6
|
||||
|
||||
PLAN:
|
||||
Please make conway's game of life in python using the pygame library. Be sure to use the tools in your workspace to help you out.
|
||||
Usage(completion_tokens=257, prompt_tokens=3290, total_tokens=3547)
|
||||
|
||||
==== RAW OUTPUT ====
|
||||
Thoughts:
|
||||
So far, I have set up the basic structure for Conway's Game of Life using pygame, including initializing pygame, setting up the display window, defining the main game loop, initializing the grid with random states, and creating a function to count alive neighbors. The next step is to implement the rules for Conway's Game of Life. This involves updating the grid state based on the number of alive neighbors each cell has. I will define a function `update_grid` that applies the rules of the game to update the grid for the next generation.
|
||||
|
||||
Action:
|
||||
"""
|
||||
write game_of_life.py def update_grid(grid):
|
||||
new_grid = [[0 for x in range(grid_size[1])] for y in range(grid_size[0])]
|
||||
for y in range(grid_size[0]):
|
||||
for x in range(grid_size[1]):
|
||||
alive_neighbors = count_alive_neighbors(grid, x, y)
|
||||
if grid[y][x] == 1 and (alive_neighbors == 2 or alive_neighbors == 3):
|
||||
new_grid[y][x] = 1
|
||||
elif grid[y][x] == 0 and alive_neighbors == 3:
|
||||
new_grid[y][x] = 1
|
||||
return new_grid
|
||||
11
|
||||
11
|
||||
"""
|
||||
==== END RAW ====
|
||||
|
||||
|
||||
ACTION:
|
||||
FileWriteAction(path='game_of_life.py', content='def update_grid(grid):\n new_grid = [[0 for x in range(grid_size[1])] for y in range(grid_size[0])]\n for y in range(grid_size[0]):\n for x in range(grid_size[1]):\n alive_neighbors = count_alive_neighbors(grid, x, y)\n if grid[y][x] == 1 and (alive_neighbors == 2 or alive_neighbors == 3):\n new_grid[y][x] = 1\n elif grid[y][x] == 0 and alive_neighbors == 3:\n new_grid[y][x] = 1\n return new_grid', start=11, end=11, thoughts="Thoughts:\nSo far, I have set up the basic structure for Conway's Game of Life using pygame, including initializing pygame, setting up the display window, defining the main game loop, initializing the grid with random states, and creating a function to count alive neighbors. The next step is to implement the rules for Conway's Game of Life. This involves updating the grid state based on the number of alive neighbors each cell has. I will define a function `update_grid` that applies the rules of the game to update the grid for the next generation.\n\nAction:", action=<ActionType.WRITE: 'write'>)
|
||||
|
||||
OBSERVATION:
|
||||
WRITE OPERATION:
|
||||
You have written to "game_of_life.py" on these lines: 11:11.
|
||||
|
||||
|
||||
==============
|
||||
STEP 7
|
||||
|
||||
PLAN:
|
||||
Please make conway's game of life in python using the pygame library. Be sure to use the tools in your workspace to help you out.
|
||||
Usage(completion_tokens=124, prompt_tokens=3416, total_tokens=3540)
|
||||
|
||||
==== RAW OUTPUT ====
|
||||
Thoughts:
|
||||
So far, I have set up the basic structure for Conway's Game of Life using pygame, including initializing pygame, setting up the display window, defining the main game loop, initializing the grid with random states, and creating functions to count alive neighbors and update the grid. The next step is to integrate the `update_grid` function into the main game loop to continuously update the state of the grid based on the game rules. This will allow the game to evolve over time, showing different generations of the cell population.
|
||||
|
||||
Action:
|
||||
"""
|
||||
edit 6 6
|
||||
grid = update_grid(grid)
|
||||
"""
|
||||
==== END RAW ====
|
||||
|
||||
|
||||
ACTION:
|
||||
FileWriteAction(path='game_of_life.py', content='grid = update_grid(grid)', start=6, end=6, thoughts="Thoughts:\nSo far, I have set up the basic structure for Conway's Game of Life using pygame, including initializing pygame, setting up the display window, defining the main game loop, initializing the grid with random states, and creating functions to count alive neighbors and update the grid. The next step is to integrate the `update_grid` function into the main game loop to continuously update the state of the grid based on the game rules. This will allow the game to evolve over time, showing different generations of the cell population.\n\nAction:", action=<ActionType.WRITE: 'write'>)
|
||||
|
||||
OBSERVATION:
|
||||
WRITE OPERATION:
|
||||
You have written to "game_of_life.py" on these lines: 6:6.
|
||||
|
||||
|
||||
==============
|
||||
STEP 8
|
||||
|
||||
PLAN:
|
||||
Please make conway's game of life in python using the pygame library. Be sure to use the tools in your workspace to help you out.
|
||||
Usage(completion_tokens=166, prompt_tokens=3393, total_tokens=3559)
|
||||
|
||||
==== RAW OUTPUT ====
|
||||
Thoughts:
|
||||
So far, I have set up the basic structure for Conway's Game of Life using pygame, including initializing pygame, setting up the display window, defining the main game loop, initializing the grid with random states, and creating functions to count alive neighbors and update the grid. The next step is to integrate the `update_grid` function into the main game loop to continuously update the state of the grid based on the game rules. This will allow the game to evolve over time, showing different generations of the cell population. I need to ensure that the `update_grid` function is called within the main game loop and that the display is updated accordingly. I will start by checking the current content of the main game loop to see where to integrate the `update_grid` function.
|
||||
|
||||
Action:
|
||||
"""
|
||||
goto 6
|
||||
"""
|
||||
==== END RAW ====
|
||||
|
||||
|
||||
ACTION:
|
||||
FileReadAction(path='game_of_life.py', start=6, end=106, thoughts="Thoughts:\nSo far, I have set up the basic structure for Conway's Game of Life using pygame, including initializing pygame, setting up the display window, defining the main game loop, initializing the grid with random states, and creating functions to count alive neighbors and update the grid. The next step is to integrate the `update_grid` function into the main game loop to continuously update the state of the grid based on the game rules. This will allow the game to evolve over time, showing different generations of the cell population. I need to ensure that the `update_grid` function is called within the main game loop and that the display is updated accordingly. I will start by checking the current content of the main game loop to see where to integrate the `update_grid` function.\n\nAction:", action=<ActionType.READ: 'read'>)
|
||||
|
||||
OBSERVATION:
|
||||
grid = update_grid(grid)
|
||||
running = True
|
||||
# Define grid size and initialize grid
|
||||
grid_size = (50, 50) # Grid size as a tuple (rows, columns)
|
||||
def count_alive_neighbors(grid, x, y):
|
||||
directions = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
|
||||
def update_grid(grid):
|
||||
new_grid = [[0 for x in range(grid_size[1])] for y in range(grid_size[0])]
|
||||
for y in range(grid_size[0]):
|
||||
for x in range(grid_size[1]):
|
||||
alive_neighbors = count_alive_neighbors(grid, x, y)
|
||||
if grid[y][x] == 1 and (alive_neighbors == 2 or alive_neighbors == 3):
|
||||
new_grid[y][x] = 1
|
||||
elif grid[y][x] == 0 and alive_neighbors == 3:
|
||||
new_grid[y][x] = 1
|
||||
return new_grid
|
||||
count = 0
|
||||
for dx, dy in directions:
|
||||
nx, ny = x + dx, y + dy
|
||||
if 0 <= nx < grid_size[1] and 0 <= ny < grid_size[0]:
|
||||
count += grid[ny][nx]
|
||||
return count
|
||||
grid = [[0 for x in range(grid_size[1])] for y in range(grid_size[0])] # Initialize grid with zeros
|
||||
import random
|
||||
for y in range(grid_size[0]):
|
||||
for x in range(grid_size[1]):
|
||||
grid[y][x] = random.randint(0, 1) # Randomly assign cells as alive (1) or dead (0)
|
||||
while running:
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
running = False
|
||||
pygame.display.set_caption("Conway's Game of Life")
|
||||
pygame.init()
|
||||
|
||||
|
||||
|
||||
==============
|
||||
STEP 9
|
||||
|
||||
PLAN:
|
||||
Please make conway's game of life in python using the pygame library. Be sure to use the tools in your workspace to help you out.
|
||||
Usage(completion_tokens=174, prompt_tokens=3728, total_tokens=3902)
|
||||
|
||||
==== RAW OUTPUT ====
|
||||
Thoughts:
|
||||
From the previous actions, it seems that the basic structure for Conway's Game of Life using pygame has been set up, including initializing pygame, setting up the display window, defining the main game loop, initializing the grid with random states, and creating functions to count alive neighbors and update the grid. The next step is to ensure that the game loop properly updates the grid and refreshes the display to show the new state of the grid in each iteration. This involves calling `pygame.display.update()` to update the entire screen and using `pygame.time.Clock()` to control the frame rate. I will start by adding these necessary updates to the game loop.
|
||||
|
||||
Action:
|
||||
"""
|
||||
edit 95 95
|
||||
pygame.display.update()
|
||||
clock = pygame.time.Clock()
|
||||
clock.tick(10) # Control the frame rate (10 frames per second)
|
||||
"""
|
||||
|
||||
==== END RAW ====
|
||||
|
||||
|
||||
ACTION:
|
||||
FileWriteAction(path='game_of_life.py', content='pygame.display.update()\n clock = pygame.time.Clock()\n clock.tick(10) # Control the frame rate (10 frames per second)', start=95, end=95, thoughts="Thoughts:\nFrom the previous actions, it seems that the basic structure for Conway's Game of Life using pygame has been set up, including initializing pygame, setting up the display window, defining the main game loop, initializing the grid with random states, and creating functions to count alive neighbors and update the grid. The next step is to ensure that the game loop properly updates the grid and refreshes the display to show the new state of the grid in each iteration. This involves calling `pygame.display.update()` to update the entire screen and using `pygame.time.Clock()` to control the frame rate. I will start by adding these necessary updates to the game loop.\n\nAction:", action=<ActionType.WRITE: 'write'>)
|
||||
|
||||
OBSERVATION:
|
||||
WRITE OPERATION:
|
||||
You have written to "game_of_life.py" on these lines: 95:95.
|
||||
16:43:55 - opendevin:INFO: agent_controller.py:125 - Exited before finishing the task.
|
||||
|
||||
|
||||
```
|
||||
|
||||
## Result:
|
||||
|
||||
```
|
||||
import pygame
|
||||
|
||||
# Setup the display window
|
||||
screen_size = (800, 600)
|
||||
screen = pygame.display.set_mode(screen_size)
|
||||
# Main game loop
|
||||
grid = update_grid(grid)
|
||||
running = True
|
||||
# Define grid size and initialize grid
|
||||
grid_size = (50, 50) # Grid size as a tuple (rows, columns)
|
||||
def count_alive_neighbors(grid, x, y):
|
||||
directions = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
|
||||
def update_grid(grid):
|
||||
new_grid = [[0 for x in range(grid_size[1])] for y in range(grid_size[0])]
|
||||
for y in range(grid_size[0]):
|
||||
for x in range(grid_size[1]):
|
||||
alive_neighbors = count_alive_neighbors(grid, x, y)
|
||||
if grid[y][x] == 1 and (alive_neighbors == 2 or alive_neighbors == 3):
|
||||
new_grid[y][x] = 1
|
||||
elif grid[y][x] == 0 and alive_neighbors == 3:
|
||||
new_grid[y][x] = 1
|
||||
return new_grid
|
||||
count = 0
|
||||
for dx, dy in directions:
|
||||
nx, ny = x + dx, y + dy
|
||||
if 0 <= nx < grid_size[1] and 0 <= ny < grid_size[0]:
|
||||
count += grid[ny][nx]
|
||||
return count
|
||||
grid = [[0 for x in range(grid_size[1])] for y in range(grid_size[0])] # Initialize grid with zeros
|
||||
import random
|
||||
for y in range(grid_size[0]):
|
||||
for x in range(grid_size[1]):
|
||||
grid[y][x] = random.randint(0, 1) # Randomly assign cells as alive (1) or dead (0)
|
||||
while running:
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
running = False
|
||||
pygame.display.set_caption("Conway's Game of Life")
|
||||
pygame.init()
|
||||
# This is a placeholder for the game of life implementation using pygame.pygame.display.update()
|
||||
clock = pygame.time.Clock()
|
||||
clock.tick(10) # Control the frame rate (10 frames per second)
|
||||
|
||||
```
|
||||
@@ -1,5 +0,0 @@
|
||||
from opendevin.controller.agent import Agent
|
||||
|
||||
from .agent import SWEAgent
|
||||
|
||||
Agent.register('SWEAgent', SWEAgent)
|
||||
@@ -1,117 +0,0 @@
|
||||
from opendevin.controller.agent import Agent
|
||||
from opendevin.controller.state.state import State
|
||||
from opendevin.events.action import (
|
||||
Action,
|
||||
FileReadAction,
|
||||
FileWriteAction,
|
||||
MessageAction,
|
||||
)
|
||||
from opendevin.events.serialization.event import event_to_memory
|
||||
from opendevin.llm.llm import LLM
|
||||
from opendevin.runtime.tools import RuntimeTool
|
||||
|
||||
from .parser import parse_command
|
||||
from .prompts import (
|
||||
CONTEXT_PROMPT,
|
||||
MEMORY_FORMAT,
|
||||
NO_ACTION,
|
||||
STEP_PROMPT,
|
||||
SYSTEM_MESSAGE,
|
||||
)
|
||||
|
||||
|
||||
class SWEAgent(Agent):
|
||||
VERSION = '1.0'
|
||||
DEPRECATED = True
|
||||
"""
|
||||
An attempt to recreate swe_agent with output parsing, prompting style, and Application Computer Interface (ACI).
|
||||
|
||||
SWE-agent includes ACI functions like 'goto', 'search_for', 'edit', 'scroll', 'run'
|
||||
"""
|
||||
runtime_tools: list[RuntimeTool] = [RuntimeTool.BROWSER]
|
||||
|
||||
def __init__(self, llm: LLM):
|
||||
super().__init__(llm)
|
||||
self.memory_window = 4
|
||||
self.max_retries = 2
|
||||
self.cur_file: str = ''
|
||||
self.cur_line: int = 0
|
||||
|
||||
def _think_act(self, messages: list[dict]) -> tuple[Action, str]:
|
||||
resp = self.llm.do_completion(
|
||||
messages=messages,
|
||||
temperature=0.05,
|
||||
)
|
||||
action_resp = resp['choices'][0]['message']['content']
|
||||
print(f"\033[1m\033[91m{resp['usage']}\033[0m")
|
||||
print(
|
||||
'\n==== RAW OUTPUT ====',
|
||||
f'\033[96m{action_resp}\033[0m',
|
||||
'==== END RAW ====\n',
|
||||
sep='\n',
|
||||
)
|
||||
return parse_command(action_resp, self.cur_file, self.cur_line)
|
||||
|
||||
def _update(self, action: Action) -> None:
|
||||
if isinstance(action, (FileReadAction, FileWriteAction)):
|
||||
self.cur_file = action.path
|
||||
self.cur_line = action.start
|
||||
|
||||
def step(self, state: State) -> Action:
|
||||
"""
|
||||
SWE-Agent step:
|
||||
1. Get context - past actions, custom commands, current step
|
||||
2. Perform think-act - prompt model for action and reasoning
|
||||
3. Catch errors - ensure model takes action (5 attempts max)
|
||||
"""
|
||||
# retrieve short term memories from state.history, up to memory_window
|
||||
memory_window = min(self.memory_window, len(state.history))
|
||||
running_memory: list[str] = []
|
||||
for prev_action, obs in state.history[-memory_window:]:
|
||||
running_memory.append(
|
||||
MEMORY_FORMAT(event_to_memory(prev_action), event_to_memory(obs))
|
||||
)
|
||||
|
||||
goal = state.get_current_user_intent()
|
||||
|
||||
# always in the prompt if they exist: file and line
|
||||
prompt = STEP_PROMPT(goal, self.cur_file, self.cur_line)
|
||||
|
||||
# prepare messages
|
||||
msgs = [
|
||||
{'content': SYSTEM_MESSAGE, 'role': 'system'},
|
||||
{'content': prompt, 'role': 'user'},
|
||||
]
|
||||
|
||||
# insert memories
|
||||
if len(running_memory) > 0:
|
||||
context = CONTEXT_PROMPT(running_memory, self.memory_window)
|
||||
msgs.insert(1, {'content': context, 'role': 'user'})
|
||||
# clrs = [''] * (len(msgs)-2) + ['\033[0;36m', '\033[0;35m']
|
||||
# print('\n\n'.join([c+m['content']+'\033[0m' for c, m in zip(clrs, msgs)]))
|
||||
|
||||
# send it over
|
||||
action, thought = self._think_act(messages=msgs)
|
||||
|
||||
# be robust with malformed responses
|
||||
start_msg_len = len(msgs)
|
||||
while not action and len(msgs) < self.max_retries + start_msg_len:
|
||||
error = NO_ACTION(thought)
|
||||
error_msg = {'content': error, 'role': 'user'}
|
||||
msgs.append(error_msg)
|
||||
action, thought = self._think_act(messages=msgs)
|
||||
|
||||
if not action:
|
||||
action = MessageAction(thought)
|
||||
|
||||
self._update(action)
|
||||
self.latest_action = action
|
||||
return action
|
||||
|
||||
def search_memory(self, query: str) -> list[str]:
|
||||
# return [item for item in self.running_memory if query in item]
|
||||
raise NotImplementedError('Search_memory not implemented currently')
|
||||
|
||||
def reset(self) -> None:
|
||||
"""Used to reset the agent"""
|
||||
super().reset()
|
||||
@@ -1,167 +0,0 @@
|
||||
import re
|
||||
|
||||
from opendevin.events.action import (
|
||||
Action,
|
||||
AgentFinishAction,
|
||||
BrowseURLAction,
|
||||
CmdRunAction,
|
||||
FileReadAction,
|
||||
FileWriteAction,
|
||||
MessageAction,
|
||||
)
|
||||
|
||||
from .prompts import COMMAND_USAGE, CUSTOM_DOCS
|
||||
|
||||
# commands: exit, read, write, browse, kill, search_file, search_dir
|
||||
|
||||
no_open_file_error = MessageAction(
|
||||
'You are not currently in a file. You can use the read command to open a file and then use goto to navigate through it.'
|
||||
)
|
||||
|
||||
|
||||
def invalid_error(cmd, docs):
|
||||
return f"""ERROR:
|
||||
Invalid command structure for
|
||||
```
|
||||
{cmd}
|
||||
```
|
||||
You may have caused this error by having multiple commands within your command block.
|
||||
If so, try again by running only one of the commands:
|
||||
|
||||
Try again using this format:
|
||||
{COMMAND_USAGE[docs]}
|
||||
"""
|
||||
|
||||
|
||||
def get_action_from_string(
|
||||
command_string: str, path: str, line: int, thoughts: str = ''
|
||||
) -> Action | None:
|
||||
"""
|
||||
Parses the command string to find which command the agent wants to run
|
||||
Converts the command into a proper Action and returns
|
||||
"""
|
||||
vars = command_string.split(' ')
|
||||
cmd = vars[0]
|
||||
args = [] if len(vars) == 1 else vars[1:]
|
||||
|
||||
if 'exit' == cmd:
|
||||
return AgentFinishAction()
|
||||
|
||||
elif 'think' == cmd:
|
||||
return MessageAction(' '.join(args))
|
||||
|
||||
elif 'scroll_up' == cmd:
|
||||
if not path:
|
||||
return no_open_file_error
|
||||
return FileReadAction(path, line + 100, line + 200, thoughts)
|
||||
|
||||
elif 'scroll_down' == cmd:
|
||||
if not path:
|
||||
return no_open_file_error
|
||||
return FileReadAction(path, line - 100, line, thoughts)
|
||||
|
||||
elif 'goto' == cmd:
|
||||
if not path:
|
||||
return no_open_file_error
|
||||
rex = r'^goto\s+(\d+)$'
|
||||
valid = re.match(rex, command_string)
|
||||
if valid:
|
||||
start = int(valid.group(1))
|
||||
end = start + 100
|
||||
return FileReadAction(path, start, end, thoughts)
|
||||
else:
|
||||
return MessageAction(invalid_error(command_string, 'goto'))
|
||||
|
||||
elif 'edit' == cmd:
|
||||
if not path:
|
||||
return no_open_file_error
|
||||
rex = r'^edit\s+(\d+)\s+(-?\d+)\s+(\S.*)$'
|
||||
valid = re.match(rex, command_string, re.DOTALL)
|
||||
if valid:
|
||||
start = int(valid.group(1))
|
||||
end = int(valid.group(2))
|
||||
change = valid.group(3)
|
||||
if '"' == change[-1] and '"' == change[0]:
|
||||
change = change[1:-1]
|
||||
return FileWriteAction(path, change, start, end, thoughts)
|
||||
else:
|
||||
return MessageAction(invalid_error(command_string, 'edit'))
|
||||
|
||||
elif 'read' == cmd:
|
||||
rex = r'^read\s+(\S+)(?:\s+(\d+))?(?:\s+(-?\d+))?$'
|
||||
valid = re.match(rex, command_string, re.DOTALL)
|
||||
if valid:
|
||||
file = valid.group(1)
|
||||
start_str = valid.group(2)
|
||||
end_str = valid.group(3)
|
||||
|
||||
start = 0 if not start_str else int(start_str)
|
||||
end = -1 if not end_str else int(end_str)
|
||||
|
||||
return FileReadAction(file, start, end, thoughts)
|
||||
else:
|
||||
return MessageAction(invalid_error(command_string, 'read'))
|
||||
|
||||
elif 'write' == cmd:
|
||||
rex = r'^write\s+(\S+)\s+(.*?)\s*(\d+)?\s*(-?\d+)?$'
|
||||
valid = re.match(rex, command_string, re.DOTALL)
|
||||
|
||||
if valid:
|
||||
file = valid.group(1)
|
||||
content = valid.group(2)
|
||||
start_str = valid.group(3)
|
||||
end_str = valid.group(4)
|
||||
|
||||
start = 0 if not start_str else int(start_str)
|
||||
end = -1 if not end_str else int(end_str)
|
||||
|
||||
if '"' == content[-1] and '"' == content[0]:
|
||||
content = content[1:-1]
|
||||
|
||||
return FileWriteAction(file, content, start, end, thoughts)
|
||||
else:
|
||||
return MessageAction(invalid_error(command_string, 'write'))
|
||||
|
||||
elif 'browse' == cmd:
|
||||
return BrowseURLAction(args[0].strip())
|
||||
|
||||
elif cmd in ['search_file', 'search_dir', 'find_file']:
|
||||
rex = r'^(search_file|search_dir|find_file)\s+(\S+)(?:\s+(\S+))?$'
|
||||
valid = re.match(rex, command_string, re.DOTALL)
|
||||
if valid:
|
||||
return CmdRunAction(command_string)
|
||||
else:
|
||||
return MessageAction(
|
||||
f'Invalid command structure for\n ```\n{command_string}\n```.\nTry again using this format:\n{CUSTOM_DOCS}'
|
||||
)
|
||||
else:
|
||||
# check bash command
|
||||
obs = str(CmdRunAction(f'type {cmd}'))
|
||||
if obs.split(':')[-1].strip() == 'not found':
|
||||
# echo not found error for llm
|
||||
return MessageAction(content=obs)
|
||||
else:
|
||||
# run valid command
|
||||
return CmdRunAction(command_string)
|
||||
|
||||
|
||||
def parse_command(input_str: str, path: str, line: int):
|
||||
"""
|
||||
Parses a given string and separates the command (enclosed in triple backticks) from any accompanying text.
|
||||
|
||||
Args:
|
||||
input_str (str): The input string to be parsed.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing the command and the accompanying text (if any).
|
||||
"""
|
||||
input_str = input_str.strip()
|
||||
if '```' in input_str:
|
||||
parts = input_str.split('```')
|
||||
command_str = parts[1].strip()
|
||||
ind = 2 if len(parts) > 2 else 1
|
||||
accompanying_text = ''.join(parts[:-ind]).strip()
|
||||
action = get_action_from_string(command_str, path, line, accompanying_text)
|
||||
if action:
|
||||
return action, accompanying_text
|
||||
return None, input_str # used for retry
|
||||
@@ -1,208 +0,0 @@
|
||||
DEFAULT_COMMANDS_DICT = {
|
||||
'exit': 'Executed when task is complete',
|
||||
'read <file_name> [<start_line>] [<end_line>]': "Shows a given file's contents starting from <start_line> up to <end_line>. Default: start_line = 0, end_line = -1. By default the whole file will be read.",
|
||||
'write <file> <changes> [<start_line>] [<end_line>]': 'Modifies a <file> by replacing the current lines between <start_line> and <end_line> with <changes>. Default start_line = 0 and end_line = -1. Calling this with no line args will replace the whole file.',
|
||||
'browse <url>': 'Returns the text version of any url, this can be useful to look up documentation or finding issues on github',
|
||||
'scroll_up': 'Takes no arguments. This will scroll up and show you the 100 lines above your current lines',
|
||||
'scroll_down': 'Takes no arguments. This will scroll down and show you the 100 lines below your current lines',
|
||||
'edit <start_line> <end_line> <changes>': 'This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes. Set end_line to -1 to denote the end of the file',
|
||||
'goto <line_num>': 'This will take you directly to a line and show you the 100 lines below it.',
|
||||
'<bash_command> <args>': 'You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included',
|
||||
'pip install <package>': 'You can use this to import python packages. Make sure you include the correct package name when using this command.',
|
||||
'ls': 'Use the ls command to view all the files in your current directory, this is a good starting point.',
|
||||
'NOT ALLOWED': 'You cannot use interactive commands like python or node',
|
||||
}
|
||||
|
||||
COMMAND_USAGE = {
|
||||
'exit': 'Usage:\n```\nexit\n```\nExecuted when task is complete',
|
||||
'read': "Args:\n<file_name> [<start_line>] [<end_line>]\nUsage:\n```\nread file.py\n```\nor\n```\nread example.py <start_line> <end_line>\n```\nShows a given file's contents starting from <start_line> up to <end_line>. Default: start_line = 0, end_line = -1. by default the whole file will be read.",
|
||||
'write': 'Args:\n<file> <changes> [<start_line>] [<end_line>]\nUsage:\n```\nwrite "def main():\n print("This is line one")" 0 2\n```\nModifies a <file> by replacing the current lines between <start_line> and <end_line> with <changes>. Default start_line = 0 and end_line = -1. Calling this with no line args will replace the whole file.',
|
||||
'edit': 'Args:\n<start_line> <end_line> <changes>\nUsage:\n```\nedit 0 1 import pandas as pd\n```\nThis will modify the current file you are in with the changes you make between the line numbers you designate',
|
||||
'goto': 'Args:\n<line_num>\nUsage:\n```\ngoto <line_num>\n```\nThis will show you the 100 lines below and including the line you specify within your current file.',
|
||||
'scroll_up': 'Usage:\n```\nscroll_up\n```\nThis will return the 100 lines above where you are currently at',
|
||||
'scroll_down': 'Usage:\n```\nscroll_down\n```\nThis will return the 100 line below where you are currently at',
|
||||
'browse': 'Args:\n<url>\nUsage:\n```\nbrowse https://github.com/OpenDevin/OpenDevin\n```\nThis will fetch the Text elements from the given url and show them to you.',
|
||||
}
|
||||
|
||||
DEFAULT_COMMANDS = '\n'.join([k + ' - ' + v for k, v in DEFAULT_COMMANDS_DICT.items()])
|
||||
|
||||
# from opendevin.parse_commands import parse_command_file
|
||||
# USE parse_command_file(filepath) to get the custom commands
|
||||
CUSTOM_DOCS = None
|
||||
|
||||
CUSTOM_COMMANDS = f"""Custom bash commands:
|
||||
{CUSTOM_DOCS}
|
||||
"""
|
||||
|
||||
DOCUMENTATION = f"""DOCUMENTATION:
|
||||
It is recommend that you use the commands provided for interacting with files and your directory because they have been specially built for you.
|
||||
They will make it much easier for you to look at files and make changes. Using these commands will help you be better at your task.
|
||||
You can open an file by using either the read or write operations.
|
||||
- If a file already exists you should read it before making any changes. Use the `edit` command to make changes once you have read it.
|
||||
- If you are creating a new file use the write command. Use the `edit` command to make changes once you have created the new file.
|
||||
|
||||
Commands:
|
||||
{DEFAULT_COMMANDS}
|
||||
{CUSTOM_COMMANDS}
|
||||
|
||||
The following commands require an open file to be used: edit, scroll_up, scroll_down, goto
|
||||
To modify the current file use 'edit'. To move through the current file use 'goto' or 'scroll_up'/'scroll_down'
|
||||
when using write and edit do not surround the code with any "" just write the code.
|
||||
"""
|
||||
|
||||
GENERAL_GUIDELINES = """INSTRUCTIONS:
|
||||
Now, you're going to solve this issue on your own. You can use any bash commands or custom commands you wish to complete your task. Edit all the files you need to and run any checks or tests that you want.
|
||||
Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.
|
||||
When you're satisfied with all of the changes you've made, you can indicate that you are done by running the exit command.
|
||||
Note however that you cannot use any interactive session commands (e.g. python, vim, node) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.
|
||||
|
||||
NOTE ABOUT THE write COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!
|
||||
|
||||
IMPORTANT TIPS:
|
||||
1. Reproduce the bug: Always start by trying to replicate the bug that the issue discusses. If the issue includes code for reproducing the bug, we recommend that you re-implement that in your environment and run it to ensure you can reproduce the bug. Then, start trying to fix it. When you think you've fixed the bug, re-run the bug reproduction script to make sure that the issue has indeed been resolved.
|
||||
If the bug reproduction script does not print anything when it successfully runs, we recommend adding a print("Script completed successfully, no errors.") command at the end of the file, so that you can be sure the script ran fine all the way through.
|
||||
2. Try different commands: If you run a command and it doesn't work, try running a different command. A command that did not work once will not work the second time unless you modify it.
|
||||
3. Navigate large files: If you open a file and need to get to an area around a specific line that is not in the first 100 lines, say line 583, you would use the 'read' command like this: 'read <file> 583'. This is a much faster way to read through the file.
|
||||
4. Handle input files: If the bug reproduction script requires inputting/reading a specific file, such as 'buggy-input.png', and you'd like to understand how to input that file, conduct a search in the existing repository code to see whether someone else has already done that. Do this by running the command: 'search_dir "buggy-input.png"'. If that doesn't work, use the Linux 'find' command.
|
||||
5. Understand your context: Always make sure to look at the currently open file and the current working directory. The currently open file might be in a different directory than the working directory.
|
||||
6. Verify your edits: When editing files, it is easy to accidentally specify a wrong line number or to write code with incorrect indentation. Always check the code after you issue an edit to make sure that it reflects what you wanted to accomplish. If it didn't, issue another command to fix it.
|
||||
7. Thoroughly test your solution: After making any changes to fix a bug, be sure to thoroughly test your solution to ensure the bug has been resolved. Re-run the bug reproduction script and verify that the issue has been addressed.
|
||||
"""
|
||||
|
||||
RESPONSE_FORMAT = """RESPONSE FORMAT:
|
||||
This is the format of the response you will make in order to solve the current issue.
|
||||
You will be given multiple iterations to complete this task so break it into steps and solve them one by one.
|
||||
|
||||
Your output must contain the following:
|
||||
- First, thoughts about what your next action should be and plan it out.
|
||||
- You will have a memory of your thoughts so you can use this to remember things for the next step.
|
||||
- Use your thoughts to think about what you are currently doing, what you have done on prior steps and how that relates to solving the problem.
|
||||
- Second, create a piece of code that will execute your next action based on the thoughts you have.
|
||||
- Remember that you can only have one action for each thought, do not include multiple actions.
|
||||
|
||||
Your code MUST be surrounded in triple back ticks EXACTLY like this:
|
||||
```
|
||||
<code>
|
||||
```
|
||||
|
||||
Notes:
|
||||
- Adhere to the format so that the program loop continues smoothly, it is very important to only give one command per output.
|
||||
- DO NOT give more than one command within the triple backticks. This will just throw an error and nothing will happen as a result.
|
||||
- Do not give multiple code blocks, if you do only the second one will be captured and run, this might give an error if the first one was necessary.
|
||||
- To execute multiple commands you should write them down in your thoughts section so you can remember it on the next step and execute them then.
|
||||
- The only commands you are not capable of executing are interactive commands like `python` or `node` by themselves.
|
||||
- If you think that you have completed the task that has been given to you based on your previous actions and outputs then use ``` exit ``` as the command to let the system know that you are done.
|
||||
- DO NOT make any copies of your previous memories, those will be provided to you at each step, making copies just wastes time and energy. Think smarter not harder.
|
||||
- The write and edit commands requires proper indentation in the content section ex. `write hw.py def hello():\n print(\'Hello World\')` this is how you would have to format your write command.
|
||||
- The white spaces matter as the code changes will be added to the code so they must have proper syntax.
|
||||
|
||||
This is a template using the format described above
|
||||
Items in <> are suggestions for you, fill them out based on the context of the problem you are solving.
|
||||
|
||||
[ FORMAT ]
|
||||
Thoughts:
|
||||
<Provide clear and concise thoughts on the next step to take, highlighting any important details or context that should be remembered.>
|
||||
<You can use multiple lines to express your thoughts>
|
||||
|
||||
Action:
|
||||
```
|
||||
<command> <params>
|
||||
```
|
||||
[ END FORMAT ]
|
||||
|
||||
Do not provide anything extra just your thought and action.
|
||||
"""
|
||||
|
||||
SYSTEM_MESSAGE = f"""SYSTEM INFO:
|
||||
You are an autonomous coding agent, here to provide solutions for coding issues.
|
||||
You have been designed to assist with a wide range of programming tasks, from code editing and debugging to testing and deployment.
|
||||
You have access to a variety of tools and commands that you can use to help you solve problems efficiently.
|
||||
|
||||
{GENERAL_GUIDELINES}
|
||||
|
||||
{DOCUMENTATION}
|
||||
""".strip()
|
||||
|
||||
|
||||
def NO_ACTION(latest):
|
||||
return f"""
|
||||
You did not include any action to take in your most recent output:
|
||||
|
||||
===== Output ======
|
||||
{latest}
|
||||
==== End Output ===
|
||||
|
||||
Remember these are the custom commands you can use:
|
||||
{DOCUMENTATION}
|
||||
|
||||
Lets try that again, it is very important that you adhere to the output format
|
||||
This time, be sure to use the exact format below, replacing anything in <> with the appropriate value(s):
|
||||
{RESPONSE_FORMAT}
|
||||
|
||||
It is crucial you use the format provided as the output will be parsed automatically.
|
||||
"""
|
||||
|
||||
|
||||
def file_info(file: str, line: int):
|
||||
if file:
|
||||
return f"""CURRENT WORKSPACE:
|
||||
Open File: {file} on line {line}
|
||||
You can use these commands with the current file:
|
||||
Navigation: `scroll_up`, `scroll_down`, and `goto <line>`
|
||||
Modification: `edit <start_line> <end_line> <changes>`
|
||||
"""
|
||||
|
||||
|
||||
def STEP_PROMPT(task, file, line_num):
|
||||
return f"""
|
||||
{RESPONSE_FORMAT}
|
||||
You are currently trying to complete this task:
|
||||
{task}
|
||||
|
||||
{file_info(file, line_num)}
|
||||
|
||||
Keep all of the guidelines above in mind when you are thinking and making code.
|
||||
Please come up with a thought and action based on your current task and latest steps.
|
||||
Make sure that you do not repeat the same actions, there will not be any changes in result if you do not changes anything.
|
||||
Be very strict about the formatting that you use and make sure you follow the guidelines.
|
||||
NEVER output multiple commands. ONLY take ONE STEP at a time.
|
||||
When you have completed your task run the "exit" command.
|
||||
Begin with your thought about the next step and then come up with an action to perform your thought.
|
||||
""".strip()
|
||||
|
||||
|
||||
def unpack_dict(data: dict, restrict: list[str] | None = None):
|
||||
lines = []
|
||||
restrict = [] if restrict is None else restrict
|
||||
for key, value in data.items():
|
||||
if key in restrict:
|
||||
continue
|
||||
elif isinstance(value, dict):
|
||||
nested_str = unpack_dict(value, restrict).replace('\n', '\n ')
|
||||
val = f'{key}:' + '\n ' + f'{nested_str}'
|
||||
lines.append(val)
|
||||
else:
|
||||
lines.append(f'{key}: {value}')
|
||||
return '\n'.join(lines)
|
||||
|
||||
|
||||
def MEMORY_FORMAT(act, obs):
|
||||
return f"""
|
||||
Previous Action:
|
||||
{unpack_dict(act, ["content"])}
|
||||
|
||||
Output from Action:
|
||||
{unpack_dict(obs)}
|
||||
""".strip()
|
||||
|
||||
|
||||
def CONTEXT_PROMPT(memory, window):
|
||||
res = f'These are your past {window} actions:\n'
|
||||
window_size = window if len(memory) > window else len(memory)
|
||||
cur_mems = memory[-window_size:]
|
||||
res += '===== Previous Actions =====\n'
|
||||
for idx, mem in enumerate(cur_mems):
|
||||
res += f'\nMemory {idx}:\n{mem}\n'
|
||||
res += '======= End Actions =======\n'
|
||||
res += 'Use these memories to provide additional context to the problem you are solving.\nRemember that you have already completed these steps so you do not need to perform them again.'
|
||||
return res
|
||||
@@ -9,7 +9,6 @@ load_dotenv()
|
||||
|
||||
|
||||
from . import ( # noqa: E402
|
||||
SWE_agent,
|
||||
browsing_agent,
|
||||
codeact_agent,
|
||||
codeact_swe_agent,
|
||||
@@ -24,7 +23,6 @@ __all__ = [
|
||||
'codeact_agent',
|
||||
'codeact_swe_agent',
|
||||
'planner_agent',
|
||||
'SWE_agent',
|
||||
'delegator_agent',
|
||||
'dummy_agent',
|
||||
'browsing_agent',
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import ast
|
||||
import os
|
||||
|
||||
from browsergym.core.action.highlevel import HighLevelActionSet
|
||||
from browsergym.utils.obs import flatten_axtree_to_str
|
||||
|
||||
from agenthub.browsing_agent.response_parser import BrowsingResponseParser
|
||||
from opendevin.controller.agent import Agent
|
||||
from opendevin.controller.state.state import State
|
||||
from opendevin.core.logger import opendevin_logger as logger
|
||||
@@ -12,28 +13,76 @@ from opendevin.events.action import (
|
||||
BrowseInteractiveAction,
|
||||
MessageAction,
|
||||
)
|
||||
from opendevin.events.event import EventSource
|
||||
from opendevin.events.observation import BrowserOutputObservation
|
||||
from opendevin.events.observation.observation import Observation
|
||||
from opendevin.llm.llm import LLM
|
||||
from opendevin.runtime.plugins import (
|
||||
PluginRequirement,
|
||||
)
|
||||
from opendevin.runtime.tools import RuntimeTool
|
||||
|
||||
USE_NAV = (
|
||||
os.environ.get('USE_NAV', 'true') == 'true'
|
||||
) # only disable NAV actions when running webarena and miniwob benchmarks
|
||||
USE_CONCISE_ANSWER = (
|
||||
os.environ.get('USE_CONCISE_ANSWER', 'false') == 'true'
|
||||
) # only return concise answer when running webarena and miniwob benchmarks
|
||||
|
||||
def parse_response(response: str) -> Action:
|
||||
if '```' not in response:
|
||||
# unexpected response format, message back to user
|
||||
return MessageAction(response)
|
||||
thought = response.split('```')[0].strip()
|
||||
action_str = response.split('```')[1].strip()
|
||||
# handle send message to user function call in BrowserGym
|
||||
for sub_action in action_str.split('\n'):
|
||||
if 'send_msg_to_user(' in sub_action:
|
||||
tree = ast.parse(sub_action)
|
||||
args = tree.body[0].value.args # type: ignore
|
||||
return MessageAction(args[0].value)
|
||||
if not USE_NAV and USE_CONCISE_ANSWER:
|
||||
EVAL_MODE = True # disabled NAV actions and only return concise answer, for webarena and miniwob benchmarks\
|
||||
else:
|
||||
EVAL_MODE = False
|
||||
|
||||
return BrowseInteractiveAction(browser_actions=action_str, thought=thought)
|
||||
|
||||
def get_error_prefix(last_browser_action: str) -> str:
|
||||
return f'IMPORTANT! Last action is incorrect:\n{last_browser_action}\nThink again with the current observation of the page.\n'
|
||||
|
||||
|
||||
def get_system_message(goal: str, action_space: str) -> str:
|
||||
return f"""\
|
||||
# Instructions
|
||||
Review the current state of the page and all other information to find the best
|
||||
possible next action to accomplish your goal. Your answer will be interpreted
|
||||
and executed by a program, make sure to follow the formatting instructions.
|
||||
|
||||
# Goal:
|
||||
{goal}
|
||||
|
||||
# Action Space
|
||||
{action_space}
|
||||
"""
|
||||
|
||||
|
||||
CONCISE_INSTRUCTION = """\
|
||||
|
||||
Here is another example with chain of thought of a valid action when providing a concise answer to user:
|
||||
"
|
||||
In order to accomplish my goal I need to send the information asked back to the user. This page list the information of HP Inkjet Fax Machine, which is the product identified in the objective. Its price is $279.49. I will send a message back to user with the answer.
|
||||
```send_msg_to_user("$279.49")```
|
||||
"
|
||||
"""
|
||||
|
||||
|
||||
def get_prompt(error_prefix: str, cur_axtree_txt: str, prev_action_str: str) -> str:
|
||||
prompt = f"""\
|
||||
{error_prefix}
|
||||
|
||||
# Current Accessibility Tree:
|
||||
{cur_axtree_txt}
|
||||
|
||||
# Previous Actions
|
||||
{prev_action_str}
|
||||
|
||||
Here is an example with chain of thought of a valid action when clicking on a button:
|
||||
"
|
||||
In order to accomplish my goal I need to click on the button with bid 12
|
||||
```click("12")```
|
||||
"
|
||||
""".strip()
|
||||
if USE_CONCISE_ANSWER:
|
||||
prompt += CONCISE_INSTRUCTION
|
||||
return prompt
|
||||
|
||||
|
||||
class BrowsingAgent(Agent):
|
||||
@@ -44,25 +93,25 @@ class BrowsingAgent(Agent):
|
||||
|
||||
sandbox_plugins: list[PluginRequirement] = []
|
||||
runtime_tools: list[RuntimeTool] = [RuntimeTool.BROWSER]
|
||||
response_parser = BrowsingResponseParser()
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
llm: LLM,
|
||||
) -> None:
|
||||
"""
|
||||
Initializes a new instance of the BrowsingAgent class.
|
||||
"""Initializes a new instance of the BrowsingAgent class.
|
||||
|
||||
Parameters:
|
||||
- llm (LLM): The llm to be used by this agent
|
||||
"""
|
||||
super().__init__(llm)
|
||||
# define a configurable action space, with chat functionality, web navigation, and webpage grounding using accessibility tree and HTML.
|
||||
# see https://github.com/ServiceNow/BrowserGym/blob/main/core/src/browsergym/core/action/highlevel.py for more details
|
||||
action_subsets = ['chat', 'bid']
|
||||
if USE_NAV:
|
||||
action_subsets.append('nav')
|
||||
self.action_space = HighLevelActionSet(
|
||||
# see https://github.com/ServiceNow/BrowserGym/blob/main/core/src/browsergym/core/action/highlevel.py for more details
|
||||
subsets=[
|
||||
'chat',
|
||||
'bid',
|
||||
'nav',
|
||||
], # define a configurable action space, with chat functionality, web navigation, and webpage grounding using accessibility tree and HTML.
|
||||
subsets=action_subsets,
|
||||
strict=False, # less strict on the parsing of the actions
|
||||
multiaction=True, # enable to agent to take multiple actions at once
|
||||
)
|
||||
@@ -70,15 +119,13 @@ class BrowsingAgent(Agent):
|
||||
self.reset()
|
||||
|
||||
def reset(self) -> None:
|
||||
"""
|
||||
Resets the Browsing Agent.
|
||||
"""
|
||||
"""Resets the Browsing Agent."""
|
||||
super().reset()
|
||||
self.cost_accumulator = 0
|
||||
self.error_accumulator = 0
|
||||
|
||||
def step(self, state: State) -> Action:
|
||||
"""
|
||||
Performs one step using the Browsing Agent.
|
||||
"""Performs one step using the Browsing Agent.
|
||||
This includes gathering information on previous steps and prompting the model to make a browsing command to execute.
|
||||
|
||||
Parameters:
|
||||
@@ -89,81 +136,76 @@ class BrowsingAgent(Agent):
|
||||
- MessageAction(content) - Message action to run (e.g. ask for clarification)
|
||||
- AgentFinishAction() - end the interaction
|
||||
"""
|
||||
goal = state.get_current_user_intent()
|
||||
messages = []
|
||||
prev_actions = ''
|
||||
prev_actions = []
|
||||
cur_axtree_txt = ''
|
||||
error_prefix = ''
|
||||
last_obs = None
|
||||
for prev_action, obs in state.history:
|
||||
if isinstance(prev_action, BrowseInteractiveAction):
|
||||
prev_actions += f'{prev_action.browser_actions}\n'
|
||||
last_obs = obs
|
||||
elif (
|
||||
isinstance(prev_action, MessageAction) and prev_action.source != 'user'
|
||||
):
|
||||
# agent has responded, task finish.
|
||||
return AgentFinishAction()
|
||||
last_action = None
|
||||
|
||||
if EVAL_MODE and len(state.history.get_events_as_list()) == 1:
|
||||
# for webarena and miniwob++ eval, we need to retrieve the initial observation already in browser env
|
||||
# initialize and retrieve the first observation by issuing an noop OP
|
||||
# For non-benchmark browsing, the browser env starts with a blank page, and the agent is expected to first navigate to desired websites
|
||||
return BrowseInteractiveAction(browser_actions='noop()')
|
||||
|
||||
for event in state.history.get_events():
|
||||
if isinstance(event, BrowseInteractiveAction):
|
||||
prev_actions.append(event.browser_actions)
|
||||
last_action = event
|
||||
elif isinstance(event, MessageAction) and event.source == EventSource.AGENT:
|
||||
# agent has responded, task finished.
|
||||
return AgentFinishAction(outputs={'content': event.content})
|
||||
elif isinstance(event, Observation):
|
||||
last_obs = event
|
||||
|
||||
if EVAL_MODE:
|
||||
prev_actions = prev_actions[1:] # remove the first noop action
|
||||
|
||||
prev_action_str = '\n'.join(prev_actions)
|
||||
# if the final BrowserInteractiveAction exec BrowserGym's send_msg_to_user,
|
||||
# we should also send a message back to the user in OpenDevin and call it a day
|
||||
if (
|
||||
isinstance(last_action, BrowseInteractiveAction)
|
||||
and last_action.browsergym_send_msg_to_user
|
||||
):
|
||||
return MessageAction(last_action.browsergym_send_msg_to_user)
|
||||
|
||||
if isinstance(last_obs, BrowserOutputObservation):
|
||||
if last_obs.error:
|
||||
# add error recovery prompt prefix
|
||||
error_prefix = f'IMPORTANT! Last action is incorrect:\n{last_obs.last_browser_action}\nThink again with the current observation of the page.\n'
|
||||
cur_axtree_txt = flatten_axtree_to_str(last_obs.axtree_object)
|
||||
error_prefix = get_error_prefix(last_obs.last_browser_action)
|
||||
self.error_accumulator += 1
|
||||
if self.error_accumulator > 5:
|
||||
return MessageAction('Too many errors encountered. Task failed.')
|
||||
try:
|
||||
cur_axtree_txt = flatten_axtree_to_str(
|
||||
last_obs.axtree_object,
|
||||
extra_properties=last_obs.extra_element_properties,
|
||||
with_clickable=True,
|
||||
filter_visible_only=True,
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
'Error when trying to process the accessibility tree: %s', e
|
||||
)
|
||||
return MessageAction('Error encountered when browsing.')
|
||||
|
||||
system_msg = f"""\
|
||||
# Instructions
|
||||
Review the current state of the page and all other information to find the best
|
||||
possible next action to accomplish your goal. Your answer will be interpreted
|
||||
and executed by a program, make sure to follow the formatting instructions.
|
||||
|
||||
# Goal:
|
||||
{goal}
|
||||
|
||||
# Action Space
|
||||
{self.action_space.describe(with_long_description=False, with_examples=True)}
|
||||
"""
|
||||
if (goal := state.get_current_user_intent()) is None:
|
||||
goal = state.inputs['task']
|
||||
system_msg = get_system_message(
|
||||
goal,
|
||||
self.action_space.describe(with_long_description=False, with_examples=True),
|
||||
)
|
||||
|
||||
messages.append({'role': 'system', 'content': system_msg})
|
||||
|
||||
prompt = f"""\
|
||||
{error_prefix}
|
||||
|
||||
# Current Accessibility Tree:
|
||||
{cur_axtree_txt}
|
||||
|
||||
# Previous Actions
|
||||
{prev_actions}
|
||||
|
||||
Here is an example with chain of thought of a valid action when clicking on a button:
|
||||
"
|
||||
In order to accomplish my goal I need to click on the button with bid 12
|
||||
```click("12")```
|
||||
"
|
||||
""".strip()
|
||||
prompt = get_prompt(error_prefix, cur_axtree_txt, prev_action_str)
|
||||
messages.append({'role': 'user', 'content': prompt})
|
||||
logger.debug(prompt)
|
||||
response = self.llm.completion(
|
||||
messages=messages,
|
||||
temperature=0.0,
|
||||
stop=[')```', ')\n```'],
|
||||
)
|
||||
self.log_cost(response)
|
||||
action_resp = response['choices'][0]['message']['content']
|
||||
logger.info(prompt)
|
||||
logger.info(action_resp)
|
||||
return parse_response(action_resp)
|
||||
|
||||
def search_memory(self, query: str) -> list[str]:
|
||||
raise NotImplementedError('Implement this abstract method')
|
||||
|
||||
def log_cost(self, response):
|
||||
# TODO: refactor to unified cost tracking
|
||||
try:
|
||||
cur_cost = self.llm.completion_cost(response)
|
||||
except Exception:
|
||||
cur_cost = 0
|
||||
self.cost_accumulator += cur_cost
|
||||
logger.info(
|
||||
'Cost: %.2f USD | Accumulated Cost: %.2f USD',
|
||||
cur_cost,
|
||||
self.cost_accumulator,
|
||||
)
|
||||
return self.response_parser.parse(response)
|
||||
|
||||
@@ -75,7 +75,8 @@ class PromptElement:
|
||||
Prompt elements are used to build the prompt. Use flags to control which
|
||||
prompt elements are visible. We use class attributes as a convenient way
|
||||
to implement static prompts, but feel free to override them with instance
|
||||
attributes or @property decorator."""
|
||||
attributes or @property decorator.
|
||||
"""
|
||||
|
||||
_prompt = ''
|
||||
_abstract_ex = ''
|
||||
@@ -200,11 +201,10 @@ def fit_tokens(
|
||||
model_name : str, optional
|
||||
The name of the model used when tokenizing.
|
||||
|
||||
Returns
|
||||
Returns:
|
||||
-------
|
||||
str : the prompt after shrinking.
|
||||
"""
|
||||
|
||||
if max_prompt_chars is None:
|
||||
return shrinkable.prompt
|
||||
|
||||
@@ -579,8 +579,8 @@ the form is not visible yet or some fields are disabled. I need to replan.
|
||||
def diff(previous, new):
|
||||
"""Return a string showing the difference between original and new.
|
||||
|
||||
If the difference is above diff_threshold, return the diff string."""
|
||||
|
||||
If the difference is above diff_threshold, return the diff string.
|
||||
"""
|
||||
if previous == new:
|
||||
return 'Identical', []
|
||||
|
||||
|
||||
88
agenthub/browsing_agent/response_parser.py
Normal file
88
agenthub/browsing_agent/response_parser.py
Normal file
@@ -0,0 +1,88 @@
|
||||
import ast
|
||||
|
||||
from opendevin.controller.action_parser import ActionParser, ResponseParser
|
||||
from opendevin.core.logger import opendevin_logger as logger
|
||||
from opendevin.events.action import (
|
||||
Action,
|
||||
BrowseInteractiveAction,
|
||||
)
|
||||
|
||||
|
||||
class BrowsingResponseParser(ResponseParser):
|
||||
def __init__(self):
|
||||
# Need to pay attention to the item order in self.action_parsers
|
||||
super().__init__()
|
||||
self.action_parsers = [BrowsingActionParserMessage()]
|
||||
self.default_parser = BrowsingActionParserBrowseInteractive()
|
||||
|
||||
def parse(self, response: str) -> Action:
|
||||
action_str = self.parse_response(response)
|
||||
return self.parse_action(action_str)
|
||||
|
||||
def parse_response(self, response) -> str:
|
||||
action_str = response['choices'][0]['message']['content']
|
||||
if action_str is None:
|
||||
return ''
|
||||
action_str = action_str.strip()
|
||||
if not action_str.endswith('```'):
|
||||
action_str = action_str + ')```'
|
||||
logger.info(action_str)
|
||||
return action_str
|
||||
|
||||
def parse_action(self, action_str: str) -> Action:
|
||||
for action_parser in self.action_parsers:
|
||||
if action_parser.check_condition(action_str):
|
||||
return action_parser.parse(action_str)
|
||||
return self.default_parser.parse(action_str)
|
||||
|
||||
|
||||
class BrowsingActionParserMessage(ActionParser):
|
||||
"""Parser action:
|
||||
- BrowseInteractiveAction(browser_actions) - unexpected response format, message back to user
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
pass
|
||||
|
||||
def check_condition(self, action_str: str) -> bool:
|
||||
return '```' not in action_str
|
||||
|
||||
def parse(self, action_str: str) -> Action:
|
||||
msg = f'send_msg_to_user("""{action_str}""")'
|
||||
return BrowseInteractiveAction(
|
||||
browser_actions=msg,
|
||||
thought=action_str,
|
||||
browsergym_send_msg_to_user=action_str,
|
||||
)
|
||||
|
||||
|
||||
class BrowsingActionParserBrowseInteractive(ActionParser):
|
||||
"""Parser action:
|
||||
- BrowseInteractiveAction(browser_actions) - handle send message to user function call in BrowserGym
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
pass
|
||||
|
||||
def check_condition(self, action_str: str) -> bool:
|
||||
return True
|
||||
|
||||
def parse(self, action_str: str) -> Action:
|
||||
thought = action_str.split('```')[0].strip()
|
||||
action_str = action_str.split('```')[1].strip()
|
||||
msg_content = ''
|
||||
for sub_action in action_str.split('\n'):
|
||||
if 'send_msg_to_user(' in sub_action:
|
||||
tree = ast.parse(sub_action)
|
||||
args = tree.body[0].value.args # type: ignore
|
||||
msg_content = args[0].value
|
||||
|
||||
return BrowseInteractiveAction(
|
||||
browser_actions=action_str,
|
||||
thought=thought,
|
||||
browsergym_send_msg_to_user=msg_content,
|
||||
)
|
||||
@@ -7,7 +7,6 @@ import yaml
|
||||
|
||||
def yaml_parser(message):
|
||||
"""Parse a yaml message for the retry function."""
|
||||
|
||||
# saves gpt-3.5 from some yaml parsing errors
|
||||
message = re.sub(r':\s*\n(?=\S|\n)', ': ', message)
|
||||
|
||||
@@ -47,7 +46,6 @@ def _compress_chunks(text, identifier, skip_list, split_regex='\n\n+'):
|
||||
|
||||
def compress_string(text):
|
||||
"""Compress a string by replacing redundant paragraphs and lines with identifiers."""
|
||||
|
||||
# Perform paragraph-level compression
|
||||
def_dict, compressed_text = _compress_chunks(
|
||||
text, identifier='§', skip_list=[], split_regex='\n\n+'
|
||||
@@ -79,12 +77,12 @@ def extract_html_tags(text, keys):
|
||||
keys : list of str
|
||||
The HTML tags to extract the content from.
|
||||
|
||||
Returns
|
||||
Returns:
|
||||
-------
|
||||
dict
|
||||
A dictionary mapping each key to a list of subset in `text` that match the key.
|
||||
|
||||
Notes
|
||||
Notes:
|
||||
-----
|
||||
All text and keys will be converted to lowercase before matching.
|
||||
|
||||
@@ -126,7 +124,7 @@ def parse_html_tags(text, keys=(), optional_keys=(), merge_multiple=False):
|
||||
optional_keys : list of str
|
||||
The HTML tags to extract the content from, but are optional.
|
||||
|
||||
Returns
|
||||
Returns:
|
||||
-------
|
||||
dict
|
||||
A dictionary mapping each key to subset of `text` that match the key.
|
||||
|
||||
177
agenthub/codeact_agent/action_parser.py
Normal file
177
agenthub/codeact_agent/action_parser.py
Normal file
@@ -0,0 +1,177 @@
|
||||
import re
|
||||
|
||||
from opendevin.controller.action_parser import ActionParser, ResponseParser
|
||||
from opendevin.events.action import (
|
||||
Action,
|
||||
AgentDelegateAction,
|
||||
AgentFinishAction,
|
||||
CmdRunAction,
|
||||
IPythonRunCellAction,
|
||||
MessageAction,
|
||||
)
|
||||
|
||||
|
||||
class CodeActResponseParser(ResponseParser):
|
||||
"""Parser action:
|
||||
- CmdRunAction(command) - bash command to run
|
||||
- IPythonRunCellAction(code) - IPython code to run
|
||||
- AgentDelegateAction(agent, inputs) - delegate action for (sub)task
|
||||
- MessageAction(content) - Message action to run (e.g. ask for clarification)
|
||||
- AgentFinishAction() - end the interaction
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
# Need pay attention to the item order in self.action_parsers
|
||||
super().__init__()
|
||||
self.action_parsers = [
|
||||
CodeActActionParserFinish(),
|
||||
CodeActActionParserCmdRun(),
|
||||
CodeActActionParserIPythonRunCell(),
|
||||
CodeActActionParserAgentDelegate(),
|
||||
]
|
||||
self.default_parser = CodeActActionParserMessage()
|
||||
|
||||
def parse(self, response) -> Action:
|
||||
action_str = self.parse_response(response)
|
||||
return self.parse_action(action_str)
|
||||
|
||||
def parse_response(self, response) -> str:
|
||||
action = response.choices[0].message.content
|
||||
if action is None:
|
||||
return ''
|
||||
for lang in ['bash', 'ipython', 'browse']:
|
||||
if f'<execute_{lang}>' in action and f'</execute_{lang}>' not in action:
|
||||
action += f'</execute_{lang}>'
|
||||
return action
|
||||
|
||||
def parse_action(self, action_str: str) -> Action:
|
||||
for action_parser in self.action_parsers:
|
||||
if action_parser.check_condition(action_str):
|
||||
return action_parser.parse(action_str)
|
||||
return self.default_parser.parse(action_str)
|
||||
|
||||
|
||||
class CodeActActionParserFinish(ActionParser):
|
||||
"""Parser action:
|
||||
- AgentFinishAction() - end the interaction
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
self.finish_command = None
|
||||
|
||||
def check_condition(self, action_str: str) -> bool:
|
||||
self.finish_command = re.search(r'<finish>.*</finish>', action_str, re.DOTALL)
|
||||
return self.finish_command is not None
|
||||
|
||||
def parse(self, action_str: str) -> Action:
|
||||
assert (
|
||||
self.finish_command is not None
|
||||
), 'self.finish_command should not be None when parse is called'
|
||||
thought = action_str.replace(self.finish_command.group(0), '').strip()
|
||||
return AgentFinishAction(thought=thought)
|
||||
|
||||
|
||||
class CodeActActionParserCmdRun(ActionParser):
|
||||
"""Parser action:
|
||||
- CmdRunAction(command) - bash command to run
|
||||
- AgentFinishAction() - end the interaction
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
self.bash_command = None
|
||||
|
||||
def check_condition(self, action_str: str) -> bool:
|
||||
self.bash_command = re.search(
|
||||
r'<execute_bash>(.*?)</execute_bash>', action_str, re.DOTALL
|
||||
)
|
||||
return self.bash_command is not None
|
||||
|
||||
def parse(self, action_str: str) -> Action:
|
||||
assert (
|
||||
self.bash_command is not None
|
||||
), 'self.bash_command should not be None when parse is called'
|
||||
thought = action_str.replace(self.bash_command.group(0), '').strip()
|
||||
# a command was found
|
||||
command_group = self.bash_command.group(1).strip()
|
||||
if command_group.strip() == 'exit':
|
||||
return AgentFinishAction()
|
||||
return CmdRunAction(command=command_group, thought=thought)
|
||||
|
||||
|
||||
class CodeActActionParserIPythonRunCell(ActionParser):
|
||||
"""Parser action:
|
||||
- IPythonRunCellAction(code) - IPython code to run
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
self.python_code = None
|
||||
self.jupyter_kernel_init_code: str = 'from agentskills import *'
|
||||
|
||||
def check_condition(self, action_str: str) -> bool:
|
||||
self.python_code = re.search(
|
||||
r'<execute_ipython>(.*?)</execute_ipython>', action_str, re.DOTALL
|
||||
)
|
||||
return self.python_code is not None
|
||||
|
||||
def parse(self, action_str: str) -> Action:
|
||||
assert (
|
||||
self.python_code is not None
|
||||
), 'self.python_code should not be None when parse is called'
|
||||
code_group = self.python_code.group(1).strip()
|
||||
thought = action_str.replace(self.python_code.group(0), '').strip()
|
||||
return IPythonRunCellAction(
|
||||
code=code_group,
|
||||
thought=thought,
|
||||
kernel_init_code=self.jupyter_kernel_init_code,
|
||||
)
|
||||
|
||||
|
||||
class CodeActActionParserAgentDelegate(ActionParser):
|
||||
"""Parser action:
|
||||
- AgentDelegateAction(agent, inputs) - delegate action for (sub)task
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
self.agent_delegate = None
|
||||
|
||||
def check_condition(self, action_str: str) -> bool:
|
||||
self.agent_delegate = re.search(
|
||||
r'<execute_browse>(.*)</execute_browse>', action_str, re.DOTALL
|
||||
)
|
||||
return self.agent_delegate is not None
|
||||
|
||||
def parse(self, action_str: str) -> Action:
|
||||
assert (
|
||||
self.agent_delegate is not None
|
||||
), 'self.agent_delegate should not be None when parse is called'
|
||||
thought = action_str.replace(self.agent_delegate.group(0), '').strip()
|
||||
browse_actions = self.agent_delegate.group(1).strip()
|
||||
task = f'{thought}. I should start with: {browse_actions}'
|
||||
return AgentDelegateAction(agent='BrowsingAgent', inputs={'task': task})
|
||||
|
||||
|
||||
class CodeActActionParserMessage(ActionParser):
|
||||
"""Parser action:
|
||||
- MessageAction(content) - Message action to run (e.g. ask for clarification)
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
pass
|
||||
|
||||
def check_condition(self, action_str: str) -> bool:
|
||||
# We assume the LLM is GOOD enough that when it returns pure natural language
|
||||
# it wants to talk to the user
|
||||
return True
|
||||
|
||||
def parse(self, action_str: str) -> Action:
|
||||
return MessageAction(content=action_str, wait_for_response=True)
|
||||
@@ -1,5 +1,4 @@
|
||||
import re
|
||||
|
||||
from agenthub.codeact_agent.action_parser import CodeActResponseParser
|
||||
from agenthub.codeact_agent.prompt import (
|
||||
COMMAND_DOCS,
|
||||
EXAMPLES,
|
||||
@@ -11,17 +10,19 @@ from opendevin.controller.agent import Agent
|
||||
from opendevin.controller.state.state import State
|
||||
from opendevin.events.action import (
|
||||
Action,
|
||||
AgentDelegateAction,
|
||||
AgentFinishAction,
|
||||
BrowseInteractiveAction,
|
||||
CmdRunAction,
|
||||
IPythonRunCellAction,
|
||||
MessageAction,
|
||||
)
|
||||
from opendevin.events.observation import (
|
||||
BrowserOutputObservation,
|
||||
AgentDelegateObservation,
|
||||
CmdOutputObservation,
|
||||
IPythonRunCellObservation,
|
||||
)
|
||||
from opendevin.events.observation.observation import Observation
|
||||
from opendevin.events.serialization.event import truncate_content
|
||||
from opendevin.llm.llm import LLM
|
||||
from opendevin.runtime.plugins import (
|
||||
AgentSkillsRequirement,
|
||||
@@ -33,79 +34,6 @@ from opendevin.runtime.tools import RuntimeTool
|
||||
ENABLE_GITHUB = True
|
||||
|
||||
|
||||
def parse_response(response) -> str:
|
||||
action = response.choices[0].message.content
|
||||
for lang in ['bash', 'ipython', 'browse']:
|
||||
if f'<execute_{lang}>' in action and f'</execute_{lang}>' not in action:
|
||||
action += f'</execute_{lang}>'
|
||||
return action
|
||||
|
||||
|
||||
def action_to_str(action: Action) -> str:
|
||||
if isinstance(action, CmdRunAction):
|
||||
return f'{action.thought}\n<execute_bash>\n{action.command}\n</execute_bash>'
|
||||
elif isinstance(action, IPythonRunCellAction):
|
||||
return f'{action.thought}\n<execute_ipython>\n{action.code}\n</execute_ipython>'
|
||||
elif isinstance(action, BrowseInteractiveAction):
|
||||
return f'{action.thought}\n<execute_browse>\n{action.browser_actions}\n</execute_browse>'
|
||||
elif isinstance(action, MessageAction):
|
||||
return action.content
|
||||
return ''
|
||||
|
||||
|
||||
def get_action_message(action: Action) -> dict[str, str] | None:
|
||||
if (
|
||||
isinstance(action, BrowseInteractiveAction)
|
||||
or isinstance(action, CmdRunAction)
|
||||
or isinstance(action, IPythonRunCellAction)
|
||||
or isinstance(action, MessageAction)
|
||||
):
|
||||
return {
|
||||
'role': 'user' if action.source == 'user' else 'assistant',
|
||||
'content': action_to_str(action),
|
||||
}
|
||||
return None
|
||||
|
||||
|
||||
def get_observation_message(obs) -> dict[str, str] | None:
|
||||
if isinstance(obs, CmdOutputObservation):
|
||||
content = 'OBSERVATION:\n' + truncate_observation(obs.content)
|
||||
content += (
|
||||
f'\n[Command {obs.command_id} finished with exit code {obs.exit_code}]]'
|
||||
)
|
||||
return {'role': 'user', 'content': content}
|
||||
elif isinstance(obs, IPythonRunCellObservation):
|
||||
content = 'OBSERVATION:\n' + obs.content
|
||||
# replace base64 images with a placeholder
|
||||
splitted = content.split('\n')
|
||||
for i, line in enumerate(splitted):
|
||||
if ' already displayed to user'
|
||||
)
|
||||
content = '\n'.join(splitted)
|
||||
content = truncate_observation(content)
|
||||
return {'role': 'user', 'content': content}
|
||||
elif isinstance(obs, BrowserOutputObservation):
|
||||
content = 'OBSERVATION:\n' + truncate_observation(obs.content)
|
||||
return {'role': 'user', 'content': content}
|
||||
return None
|
||||
|
||||
|
||||
def truncate_observation(observation: str, max_chars: int = 10_000) -> str:
|
||||
"""
|
||||
Truncate the middle of the observation if it is too long.
|
||||
"""
|
||||
if len(observation) <= max_chars:
|
||||
return observation
|
||||
half = max_chars // 2
|
||||
return (
|
||||
observation[:half]
|
||||
+ '\n[... Observation truncated due to length ...]\n'
|
||||
+ observation[-half:]
|
||||
)
|
||||
|
||||
|
||||
# FIXME: We can tweak these two settings to create MicroAgents specialized toward different area
|
||||
def get_system_message() -> str:
|
||||
if ENABLE_GITHUB:
|
||||
@@ -119,7 +47,7 @@ def get_in_context_example() -> str:
|
||||
|
||||
|
||||
class CodeActAgent(Agent):
|
||||
VERSION = '1.5'
|
||||
VERSION = '1.8'
|
||||
"""
|
||||
The Code Act Agent is a minimalist agent.
|
||||
The agent works by passing the model a list of action-observation pairs and prompting the model to take the next step.
|
||||
@@ -158,23 +86,23 @@ class CodeActAgent(Agent):
|
||||
|
||||
sandbox_plugins: list[PluginRequirement] = [
|
||||
# NOTE: AgentSkillsRequirement need to go before JupyterRequirement, since
|
||||
# AgentSkillsRequirement provides a lot of Python functions
|
||||
# and it need to be initialized before Jupyter for Jupyter to use those functions.
|
||||
# AgentSkillsRequirement provides a lot of Python functions,
|
||||
# and it needs to be initialized before Jupyter for Jupyter to use those functions.
|
||||
AgentSkillsRequirement(),
|
||||
JupyterRequirement(),
|
||||
]
|
||||
runtime_tools: list[RuntimeTool] = [RuntimeTool.BROWSER]
|
||||
jupyter_kernel_init_code: str = 'from agentskills import *'
|
||||
|
||||
system_message: str = get_system_message()
|
||||
in_context_example: str = f"Here is an example of how you can interact with the environment for task solving:\n{get_in_context_example()}\n\nNOW, LET'S START!"
|
||||
|
||||
action_parser = CodeActResponseParser()
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
llm: LLM,
|
||||
) -> None:
|
||||
"""
|
||||
Initializes a new instance of the CodeActAgent class.
|
||||
"""Initializes a new instance of the CodeActAgent class.
|
||||
|
||||
Parameters:
|
||||
- llm (LLM): The llm to be used by this agent
|
||||
@@ -182,50 +110,88 @@ class CodeActAgent(Agent):
|
||||
super().__init__(llm)
|
||||
self.reset()
|
||||
|
||||
def action_to_str(self, action: Action) -> str:
|
||||
if isinstance(action, CmdRunAction):
|
||||
return (
|
||||
f'{action.thought}\n<execute_bash>\n{action.command}\n</execute_bash>'
|
||||
)
|
||||
elif isinstance(action, IPythonRunCellAction):
|
||||
return f'{action.thought}\n<execute_ipython>\n{action.code}\n</execute_ipython>'
|
||||
elif isinstance(action, AgentDelegateAction):
|
||||
return f'{action.thought}\n<execute_browse>\n{action.inputs["task"]}\n</execute_browse>'
|
||||
elif isinstance(action, MessageAction):
|
||||
return action.content
|
||||
return ''
|
||||
|
||||
def get_action_message(self, action: Action) -> dict[str, str] | None:
|
||||
if (
|
||||
isinstance(action, AgentDelegateAction)
|
||||
or isinstance(action, CmdRunAction)
|
||||
or isinstance(action, IPythonRunCellAction)
|
||||
or isinstance(action, MessageAction)
|
||||
):
|
||||
return {
|
||||
'role': 'user' if action.source == 'user' else 'assistant',
|
||||
'content': self.action_to_str(action),
|
||||
}
|
||||
return None
|
||||
|
||||
def get_observation_message(self, obs: Observation) -> dict[str, str] | None:
|
||||
max_message_chars = self.llm.config.max_message_chars
|
||||
if isinstance(obs, CmdOutputObservation):
|
||||
content = 'OBSERVATION:\n' + truncate_content(
|
||||
obs.content, max_message_chars
|
||||
)
|
||||
content += (
|
||||
f'\n[Command {obs.command_id} finished with exit code {obs.exit_code}]'
|
||||
)
|
||||
return {'role': 'user', 'content': content}
|
||||
elif isinstance(obs, IPythonRunCellObservation):
|
||||
content = 'OBSERVATION:\n' + obs.content
|
||||
# replace base64 images with a placeholder
|
||||
splitted = content.split('\n')
|
||||
for i, line in enumerate(splitted):
|
||||
if ' already displayed to user'
|
||||
)
|
||||
content = '\n'.join(splitted)
|
||||
content = truncate_content(content, max_message_chars)
|
||||
return {'role': 'user', 'content': content}
|
||||
elif isinstance(obs, AgentDelegateObservation):
|
||||
content = 'OBSERVATION:\n' + truncate_content(
|
||||
str(obs.outputs), max_message_chars
|
||||
)
|
||||
return {'role': 'user', 'content': content}
|
||||
return None
|
||||
|
||||
def reset(self) -> None:
|
||||
"""
|
||||
Resets the CodeAct Agent.
|
||||
"""
|
||||
"""Resets the CodeAct Agent."""
|
||||
super().reset()
|
||||
|
||||
def step(self, state: State) -> Action:
|
||||
"""
|
||||
Performs one step using the CodeAct Agent.
|
||||
"""Performs one step using the CodeAct Agent.
|
||||
This includes gathering info on previous steps and prompting the model to make a command to execute.
|
||||
|
||||
Parameters:
|
||||
- state (State): used to get updated info and background commands
|
||||
- state (State): used to get updated info
|
||||
|
||||
Returns:
|
||||
- CmdRunAction(command) - bash command to run
|
||||
- IPythonRunCellAction(code) - IPython code to run
|
||||
- BrowseInteractiveAction(browsergym_command) - BrowserGym commands to run
|
||||
- AgentDelegateAction(agent, inputs) - delegate action for (sub)task
|
||||
- MessageAction(content) - Message action to run (e.g. ask for clarification)
|
||||
- AgentFinishAction() - end the interaction
|
||||
"""
|
||||
messages: list[dict[str, str]] = [
|
||||
{'role': 'system', 'content': self.system_message},
|
||||
{'role': 'user', 'content': self.in_context_example},
|
||||
]
|
||||
# if we're done, go back
|
||||
latest_user_message = state.history.get_last_user_message()
|
||||
if latest_user_message and latest_user_message.strip() == '/exit':
|
||||
return AgentFinishAction()
|
||||
|
||||
for prev_action, obs in state.history:
|
||||
action_message = get_action_message(prev_action)
|
||||
if action_message:
|
||||
messages.append(action_message)
|
||||
# prepare what we want to send to the LLM
|
||||
messages: list[dict[str, str]] = self._get_messages(state)
|
||||
|
||||
obs_message = get_observation_message(obs)
|
||||
if obs_message:
|
||||
messages.append(obs_message)
|
||||
|
||||
latest_user_message = [m for m in messages if m['role'] == 'user'][-1]
|
||||
if latest_user_message:
|
||||
if latest_user_message['content'].strip() == '/exit':
|
||||
return AgentFinishAction()
|
||||
latest_user_message['content'] += (
|
||||
f'\n\nENVIRONMENT REMINDER: You have {state.max_iterations - state.iteration} turns left to complete the task.'
|
||||
)
|
||||
|
||||
response = self.llm.do_completion(
|
||||
response = self.llm.completion(
|
||||
messages=messages,
|
||||
stop=[
|
||||
'</execute_ipython>',
|
||||
@@ -234,50 +200,37 @@ class CodeActAgent(Agent):
|
||||
],
|
||||
temperature=0.0,
|
||||
)
|
||||
return self.action_parser.parse(response)
|
||||
|
||||
action_str: str = parse_response(response)
|
||||
state.num_of_chars += sum(
|
||||
len(message['content']) for message in messages
|
||||
) + len(action_str)
|
||||
def _get_messages(self, state: State) -> list[dict[str, str]]:
|
||||
messages = [
|
||||
{'role': 'system', 'content': self.system_message},
|
||||
{'role': 'user', 'content': self.in_context_example},
|
||||
]
|
||||
|
||||
if finish_command := re.search(r'<finish>.*</finish>', action_str, re.DOTALL):
|
||||
thought = action_str.replace(finish_command.group(0), '').strip()
|
||||
return AgentFinishAction(thought=thought)
|
||||
if bash_command := re.search(
|
||||
r'<execute_bash>(.*?)</execute_bash>', action_str, re.DOTALL
|
||||
):
|
||||
# remove the command from the action string to get thought
|
||||
thought = action_str.replace(bash_command.group(0), '').strip()
|
||||
# a command was found
|
||||
command_group = bash_command.group(1).strip()
|
||||
for event in state.history.get_events():
|
||||
# create a regular message from an event
|
||||
if isinstance(event, Action):
|
||||
message = self.get_action_message(event)
|
||||
elif isinstance(event, Observation):
|
||||
message = self.get_observation_message(event)
|
||||
else:
|
||||
raise ValueError(f'Unknown event type: {type(event)}')
|
||||
|
||||
if command_group.strip() == 'exit':
|
||||
return AgentFinishAction()
|
||||
return CmdRunAction(command=command_group, thought=thought)
|
||||
elif python_code := re.search(
|
||||
r'<execute_ipython>(.*?)</execute_ipython>', action_str, re.DOTALL
|
||||
):
|
||||
# a code block was found
|
||||
code_group = python_code.group(1).strip()
|
||||
thought = action_str.replace(python_code.group(0), '').strip()
|
||||
return IPythonRunCellAction(
|
||||
code=code_group,
|
||||
thought=thought,
|
||||
kernel_init_code=self.jupyter_kernel_init_code,
|
||||
# add regular message
|
||||
if message:
|
||||
messages.append(message)
|
||||
|
||||
# the latest user message is important:
|
||||
# we want to remind the agent of the environment constraints
|
||||
latest_user_message = next(
|
||||
(m for m in reversed(messages) if m['role'] == 'user'), None
|
||||
)
|
||||
|
||||
# add a reminder to the prompt
|
||||
if latest_user_message:
|
||||
latest_user_message['content'] += (
|
||||
f'\n\nENVIRONMENT REMINDER: You have {state.max_iterations - state.iteration} turns left to complete the task. When finished reply with <finish></finish>'
|
||||
)
|
||||
elif browse_command := re.search(
|
||||
r'<execute_browse>(.*)</execute_browse>', action_str, re.DOTALL
|
||||
):
|
||||
# BrowserGym actions was found
|
||||
browse_actions = browse_command.group(1).strip()
|
||||
thought = action_str.replace(browse_command.group(0), '').strip()
|
||||
return BrowseInteractiveAction(
|
||||
browser_actions=browse_actions, thought=thought
|
||||
)
|
||||
else:
|
||||
# We assume the LLM is GOOD enough that when it returns pure natural language
|
||||
# it want to talk to the user
|
||||
return MessageAction(content=action_str, wait_for_response=True)
|
||||
|
||||
def search_memory(self, query: str) -> list[str]:
|
||||
raise NotImplementedError('Implement this abstract method')
|
||||
return messages
|
||||
|
||||
@@ -5,35 +5,43 @@ _AGENT_SKILLS_DOCS = AgentSkillsRequirement.documentation
|
||||
COMMAND_DOCS = (
|
||||
'\nApart from the standard Python library, the assistant can also use the following functions (already imported) in <execute_ipython> environment:\n'
|
||||
f'{_AGENT_SKILLS_DOCS}'
|
||||
"Please note that THE `edit_file` FUNCTION REQUIRES PROPER INDENTATION. If the assistant would like to add the line ' print(x)', it must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run."
|
||||
"Please note that THE `edit_file_by_replace`, `append_file` and `insert_content_at_line` FUNCTIONS REQUIRE PROPER INDENTATION. If the assistant would like to add the line ' print(x)', it must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run."
|
||||
)
|
||||
|
||||
# ======= SYSTEM MESSAGE =======
|
||||
MINIMAL_SYSTEM_PREFIX = """A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.
|
||||
The assistant can interact with an interactive Python (Jupyter Notebook) environment and receive the corresponding output when needed. The code should be enclosed using "<execute_ipython>" tag, for example:
|
||||
The assistant can use an interactive Python (Jupyter Notebook) environment, executing code with <execute_ipython>.
|
||||
<execute_ipython>
|
||||
print("Hello World!")
|
||||
</execute_ipython>
|
||||
The assistant can execute bash commands on behalf of the user by wrapping them with <execute_bash> and </execute_bash>.
|
||||
|
||||
For example, you can list the files in the current directory by <execute_bash> ls </execute_bash>.
|
||||
Important, however: do not run interactive commands. You do not have access to stdin.
|
||||
Also, you need to handle commands that may run indefinitely and not return a result. For such cases, you should redirect the output to a file and run the command in the background to avoid blocking the execution.
|
||||
For example, to run a Python script that might run indefinitely without returning immediately, you can use the following format: <execute_bash> python3 app.py > server.log 2>&1 & </execute_bash>
|
||||
Also, if a command execution result saying like: Command: "npm start" timed out. Sending SIGINT to the process, you should also retry with running the command in the background.
|
||||
"""
|
||||
|
||||
BROWSING_PREFIX = """The assistant can browse the Internet with commands on behalf of the user by wrapping them with <execute_browse> and </execute_browse>.
|
||||
For example, you can browse a given URL by <execute_browse> goto("<URL>") </execute_browse>.
|
||||
The assistant should attempt fewer things at a time instead of putting too much commands OR code in one "execute" block.
|
||||
BROWSING_PREFIX = """The assistant can browse the Internet with <execute_browse> and </execute_browse>.
|
||||
For example, <execute_browse> Tell me the usa's president using google search </execute_browse>.
|
||||
Or <execute_browse> Tell me what is in http://example.com </execute_browse>.
|
||||
"""
|
||||
PIP_INSTALL_PREFIX = """The assistant can install Python packages using the %pip magic command in an IPython environment by using the following syntax: <execute_ipython> %pip install [package needed] </execute_ipython> and should always import packages and define variables before starting to use them."""
|
||||
|
||||
SYSTEM_PREFIX = MINIMAL_SYSTEM_PREFIX + BROWSING_PREFIX + PIP_INSTALL_PREFIX
|
||||
|
||||
GITHUB_MESSAGE = """To do any activities on GitHub, the assistant should use the token in the $GITHUB_TOKEN environment variable.
|
||||
For instance, to push a local branch `my_branch` to the github repo `owner/repo`, the assistant can use the following four commands:
|
||||
GITHUB_MESSAGE = """To interact with GitHub, use the $GITHUB_TOKEN environment variable.
|
||||
For example, to push a branch `my_branch` to the GitHub repo `owner/repo`:
|
||||
<execute_bash> git push https://$GITHUB_TOKEN@github.com/owner/repo.git my_branch </execute_bash>
|
||||
If the assistant require access to GitHub but $GITHUB_TOKEN is not set, ask the user to set it."""
|
||||
If $GITHUB_TOKEN is not set, ask the user to set it."""
|
||||
|
||||
SYSTEM_SUFFIX = """The assistant's response should be concise.
|
||||
The assistant should include ONLY ONE <execute_ipython> or <execute_bash> or <execute_browse> in every one of the responses, unless the assistant is finished with the task or need more input or action from the user in order to proceed.
|
||||
IMPORTANT: Whenever possible, execute the code for the user using <execute_ipython> or <execute_bash> or <execute_browse> instead of providing it.
|
||||
SYSTEM_SUFFIX = """Responses should be concise.
|
||||
The assistant should attempt fewer things at a time instead of putting too many commands OR too much code in one "execute" block.
|
||||
Include ONLY ONE <execute_ipython>, <execute_bash>, or <execute_browse> per response, unless the assistant is finished with the task or needs more input or action from the user in order to proceed.
|
||||
If the assistant is finished with the task you MUST include <finish></finish> in your response.
|
||||
IMPORTANT: Execute code using <execute_ipython>, <execute_bash>, or <execute_browse> whenever possible.
|
||||
When handling files, try to use full paths and pwd to avoid errors.
|
||||
"""
|
||||
|
||||
|
||||
@@ -41,10 +49,10 @@ IMPORTANT: Whenever possible, execute the code for the user using <execute_ipyth
|
||||
EXAMPLES = """
|
||||
--- START OF EXAMPLE ---
|
||||
|
||||
USER: Can you create a list of numbers from 1 to 10, and create a web page to display them at port 5000?
|
||||
USER: Create a list of numbers from 1 to 10, and display them in a web page at port 5000.
|
||||
|
||||
ASSISTANT:
|
||||
Sure! Let me create a file first:
|
||||
Sure! Let me create a Python file `app.py`:
|
||||
<execute_ipython>
|
||||
create_file('app.py')
|
||||
</execute_ipython>
|
||||
@@ -52,7 +60,9 @@ create_file('app.py')
|
||||
USER:
|
||||
OBSERVATION:
|
||||
[File: /workspace/app.py (1 lines total)]
|
||||
(this is the beginning of the file)
|
||||
1|
|
||||
(this is the end of the file)
|
||||
[File app.py created.]
|
||||
|
||||
ASSISTANT:
|
||||
@@ -68,11 +78,17 @@ def index():
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(port=5000)\"\"\"
|
||||
edit_file(start=1, end=1, content=EDITED_CODE)
|
||||
|
||||
insert_content_at_line(
|
||||
'app.py',
|
||||
1,
|
||||
EDITED_CODE,
|
||||
)
|
||||
</execute_ipython>
|
||||
|
||||
USER:
|
||||
OBSERVATION:
|
||||
(this is the beginning of the file)
|
||||
1|from flask import Flask
|
||||
2|app = Flask(__name__)
|
||||
3|
|
||||
@@ -83,7 +99,8 @@ OBSERVATION:
|
||||
8|
|
||||
9|if __name__ == '__main__':
|
||||
10| app.run(port=5000)
|
||||
[File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
|
||||
(this is the end of the file)
|
||||
[File updated (edited at line 1). Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
|
||||
|
||||
ASSISTANT:
|
||||
I have created a Python file `app.py` that will display a list of numbers from 1 to 10 when you run it. Let me run the Python file for you:
|
||||
@@ -163,7 +180,7 @@ USER: Now browse the newly started server's homepage and show me the content.
|
||||
ASSISTANT:
|
||||
Sure! Let me browse the server's homepage at http://127.0.0.1:5000:
|
||||
<execute_browse>
|
||||
goto("http://127.0.0.1:5000")
|
||||
Get the content on "http://127.0.0.1:5000"
|
||||
</execute_browse>
|
||||
|
||||
USER:
|
||||
@@ -193,6 +210,7 @@ open_file('app.py')
|
||||
|
||||
USER:
|
||||
[File: /workspace/app.py (10 lines total)]
|
||||
(this is the beginning of the file)
|
||||
1|from flask import Flask
|
||||
2|app = Flask(__name__)
|
||||
3|
|
||||
@@ -203,16 +221,22 @@ USER:
|
||||
8|
|
||||
9|if __name__ == '__main__':
|
||||
10| app.run(port=5000)
|
||||
(this is the end of the file)
|
||||
|
||||
ASSISTANT:
|
||||
I should edit the file to display the numbers in a table format. I should include correct indentation. Let me update the file:
|
||||
<execute_ipython>
|
||||
edit_file(start=7, end=7, content=" return '<table>' + ''.join([f'<tr><td>{i}</td></tr>' for i in numbers]) + '</table>'")
|
||||
edit_file_by_replace(
|
||||
'app.py',
|
||||
to_replace=" return str(numbers)",
|
||||
new_content=" return '<table>' + ''.join([f'<tr><td>{i}</td></tr>' for i in numbers]) + '</table>'",
|
||||
)
|
||||
</execute_ipython>
|
||||
|
||||
USER:
|
||||
Observation:
|
||||
[File: /workspace/app.py (10 lines total after edit)]
|
||||
(this is the beginning of the file)
|
||||
1|from flask import Flask
|
||||
2|app = Flask(__name__)
|
||||
3|
|
||||
@@ -223,10 +247,11 @@ Observation:
|
||||
8|
|
||||
9|if __name__ == '__main__':
|
||||
10| app.run(port=5000)
|
||||
[File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
|
||||
(this is the end of the file)
|
||||
[File updated (edited at line 7). Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
|
||||
|
||||
ASSISTANT:
|
||||
The file has been updated. Let me run the Python file again with the new changes:
|
||||
Running the updated file:
|
||||
<execute_bash>
|
||||
python3 app.py > server.log 2>&1 &
|
||||
</execute_bash>
|
||||
@@ -236,14 +261,15 @@ Observation:
|
||||
[1] 126
|
||||
|
||||
ASSISTANT:
|
||||
The server is running on port 5000 with PID 126. You can access the list of numbers in a table format by visiting http://127.0.0.1:5000. Free free to let me know if you have any further requests!
|
||||
The server is running on port 5000 with PID 126. You can access the list of numbers in a table format by visiting http://127.0.0.1:5000. Let me know if you have any further requests!
|
||||
<finish></finish>
|
||||
|
||||
--- END OF EXAMPLE ---
|
||||
"""
|
||||
|
||||
INVALID_INPUT_MESSAGE = (
|
||||
"I don't understand your input. \n"
|
||||
'If you want to execute a bash command, please use <execute_bash> YOUR_COMMAND_HERE </execute_bash>.\n'
|
||||
'If you want to execute a block of Python code, please use <execute_ipython> YOUR_COMMAND_HERE </execute_ipython>.\n'
|
||||
'If you want to browse the Internet, please use <execute_browse> YOUR_COMMAND_HERE </execute_browse>.\n'
|
||||
'For bash commands, use <execute_bash> YOUR_COMMAND </execute_bash>.\n'
|
||||
'For Python code, use <execute_ipython> YOUR_CODE </execute_ipython>.\n'
|
||||
'For browsing, use <execute_browse> YOUR_COMMAND </execute_browse>.\n'
|
||||
)
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
This agent is an adaptation of the original [SWE Agent](https://swe-agent.com/) based on CodeAct using the `agentskills` library of OpenDevin.
|
||||
|
||||
Its intended use is **solving Github issues**.
|
||||
Its intended use is **solving GitHub issues**.
|
||||
|
||||
It removes web-browsing and Github capability from the original CodeAct agent to avoid confusion to the agent.
|
||||
It removes web-browsing and GitHub capability from the original CodeAct agent to avoid confusion to the agent.
|
||||
|
||||
110
agenthub/codeact_swe_agent/action_parser.py
Normal file
110
agenthub/codeact_swe_agent/action_parser.py
Normal file
@@ -0,0 +1,110 @@
|
||||
import re
|
||||
|
||||
from opendevin.controller.action_parser import ActionParser
|
||||
from opendevin.events.action import (
|
||||
Action,
|
||||
AgentFinishAction,
|
||||
CmdRunAction,
|
||||
IPythonRunCellAction,
|
||||
MessageAction,
|
||||
)
|
||||
|
||||
|
||||
class CodeActSWEActionParserFinish(ActionParser):
|
||||
"""Parser action:
|
||||
- AgentFinishAction() - end the interaction
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
self.finish_command = None
|
||||
|
||||
def check_condition(self, action_str: str) -> bool:
|
||||
self.finish_command = re.search(r'<finish>.*</finish>', action_str, re.DOTALL)
|
||||
return self.finish_command is not None
|
||||
|
||||
def parse(self, action_str: str) -> Action:
|
||||
assert (
|
||||
self.finish_command is not None
|
||||
), 'self.finish_command should not be None when parse is called'
|
||||
thought = action_str.replace(self.finish_command.group(0), '').strip()
|
||||
return AgentFinishAction(thought=thought)
|
||||
|
||||
|
||||
class CodeActSWEActionParserCmdRun(ActionParser):
|
||||
"""Parser action:
|
||||
- CmdRunAction(command) - bash command to run
|
||||
- AgentFinishAction() - end the interaction
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
self.bash_command = None
|
||||
|
||||
def check_condition(self, action_str: str) -> bool:
|
||||
self.bash_command = re.search(
|
||||
r'<execute_bash>(.*?)</execute_bash>', action_str, re.DOTALL
|
||||
)
|
||||
return self.bash_command is not None
|
||||
|
||||
def parse(self, action_str: str) -> Action:
|
||||
assert (
|
||||
self.bash_command is not None
|
||||
), 'self.bash_command should not be None when parse is called'
|
||||
thought = action_str.replace(self.bash_command.group(0), '').strip()
|
||||
# a command was found
|
||||
command_group = self.bash_command.group(1).strip()
|
||||
if command_group.strip() == 'exit':
|
||||
return AgentFinishAction()
|
||||
return CmdRunAction(command=command_group, thought=thought)
|
||||
|
||||
|
||||
class CodeActSWEActionParserIPythonRunCell(ActionParser):
|
||||
"""Parser action:
|
||||
- IPythonRunCellAction(code) - IPython code to run
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
self.python_code = None
|
||||
self.jupyter_kernel_init_code: str = 'from agentskills import *'
|
||||
|
||||
def check_condition(self, action_str: str) -> bool:
|
||||
self.python_code = re.search(
|
||||
r'<execute_ipython>(.*?)</execute_ipython>', action_str, re.DOTALL
|
||||
)
|
||||
return self.python_code is not None
|
||||
|
||||
def parse(self, action_str: str) -> Action:
|
||||
assert (
|
||||
self.python_code is not None
|
||||
), 'self.python_code should not be None when parse is called'
|
||||
code_group = self.python_code.group(1).strip()
|
||||
thought = action_str.replace(self.python_code.group(0), '').strip()
|
||||
return IPythonRunCellAction(
|
||||
code=code_group,
|
||||
thought=thought,
|
||||
kernel_init_code=self.jupyter_kernel_init_code,
|
||||
)
|
||||
|
||||
|
||||
class CodeActSWEActionParserMessage(ActionParser):
|
||||
"""Parser action:
|
||||
- MessageAction(content) - Message action to run (e.g. ask for clarification)
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
pass
|
||||
|
||||
def check_condition(self, action_str: str) -> bool:
|
||||
# We assume the LLM is GOOD enough that when it returns pure natural language
|
||||
# it wants to talk to the user
|
||||
return True
|
||||
|
||||
def parse(self, action_str: str) -> Action:
|
||||
return MessageAction(content=action_str, wait_for_response=True)
|
||||
@@ -1,26 +1,25 @@
|
||||
import re
|
||||
|
||||
from agenthub.codeact_swe_agent.prompt import (
|
||||
COMMAND_DOCS,
|
||||
MINIMAL_SYSTEM_PREFIX,
|
||||
SWE_EXAMPLE,
|
||||
SYSTEM_PREFIX,
|
||||
SYSTEM_SUFFIX,
|
||||
)
|
||||
from agenthub.codeact_swe_agent.response_parser import CodeActSWEResponseParser
|
||||
from opendevin.controller.agent import Agent
|
||||
from opendevin.controller.state.state import State
|
||||
from opendevin.events.action import (
|
||||
Action,
|
||||
AgentFinishAction,
|
||||
BrowseInteractiveAction,
|
||||
CmdRunAction,
|
||||
IPythonRunCellAction,
|
||||
MessageAction,
|
||||
)
|
||||
from opendevin.events.observation import (
|
||||
BrowserOutputObservation,
|
||||
CmdOutputObservation,
|
||||
IPythonRunCellObservation,
|
||||
)
|
||||
from opendevin.events.observation.observation import Observation
|
||||
from opendevin.events.serialization.event import truncate_content
|
||||
from opendevin.llm.llm import LLM
|
||||
from opendevin.runtime.plugins import (
|
||||
AgentSkillsRequirement,
|
||||
@@ -30,81 +29,8 @@ from opendevin.runtime.plugins import (
|
||||
from opendevin.runtime.tools import RuntimeTool
|
||||
|
||||
|
||||
def parse_response(response) -> str:
|
||||
action = response.choices[0].message.content
|
||||
for lang in ['bash', 'ipython', 'browse']:
|
||||
if f'<execute_{lang}>' in action and f'</execute_{lang}>' not in action:
|
||||
action += f'</execute_{lang}>'
|
||||
return action
|
||||
|
||||
|
||||
def action_to_str(action: Action) -> str:
|
||||
if isinstance(action, CmdRunAction):
|
||||
return f'{action.thought}\n<execute_bash>\n{action.command}\n</execute_bash>'
|
||||
elif isinstance(action, IPythonRunCellAction):
|
||||
return f'{action.thought}\n<execute_ipython>\n{action.code}\n</execute_ipython>'
|
||||
elif isinstance(action, BrowseInteractiveAction):
|
||||
return f'{action.thought}\n<execute_browse>\n{action.browser_actions}\n</execute_browse>'
|
||||
elif isinstance(action, MessageAction):
|
||||
return action.content
|
||||
return ''
|
||||
|
||||
|
||||
def get_action_message(action: Action) -> dict[str, str] | None:
|
||||
if (
|
||||
isinstance(action, BrowseInteractiveAction)
|
||||
or isinstance(action, CmdRunAction)
|
||||
or isinstance(action, IPythonRunCellAction)
|
||||
or isinstance(action, MessageAction)
|
||||
):
|
||||
return {
|
||||
'role': 'user' if action.source == 'user' else 'assistant',
|
||||
'content': action_to_str(action),
|
||||
}
|
||||
return None
|
||||
|
||||
|
||||
def get_observation_message(obs) -> dict[str, str] | None:
|
||||
if isinstance(obs, CmdOutputObservation):
|
||||
content = 'OBSERVATION:\n' + truncate_observation(obs.content)
|
||||
content += (
|
||||
f'\n[Command {obs.command_id} finished with exit code {obs.exit_code}]]'
|
||||
)
|
||||
return {'role': 'user', 'content': content}
|
||||
elif isinstance(obs, IPythonRunCellObservation):
|
||||
content = 'OBSERVATION:\n' + obs.content
|
||||
# replace base64 images with a placeholder
|
||||
splitted = content.split('\n')
|
||||
for i, line in enumerate(splitted):
|
||||
if ' already displayed to user'
|
||||
)
|
||||
content = '\n'.join(splitted)
|
||||
content = truncate_observation(content)
|
||||
return {'role': 'user', 'content': content}
|
||||
elif isinstance(obs, BrowserOutputObservation):
|
||||
content = 'OBSERVATION:\n' + truncate_observation(obs.content)
|
||||
return {'role': 'user', 'content': content}
|
||||
return None
|
||||
|
||||
|
||||
def truncate_observation(observation: str, max_chars: int = 10_000) -> str:
|
||||
"""
|
||||
Truncate the middle of the observation if it is too long.
|
||||
"""
|
||||
if len(observation) <= max_chars:
|
||||
return observation
|
||||
half = max_chars // 2
|
||||
return (
|
||||
observation[:half]
|
||||
+ '\n[... Observation truncated due to length ...]\n'
|
||||
+ observation[-half:]
|
||||
)
|
||||
|
||||
|
||||
def get_system_message() -> str:
|
||||
return f'{MINIMAL_SYSTEM_PREFIX}\n\n{COMMAND_DOCS}\n\n{SYSTEM_SUFFIX}'
|
||||
return f'{SYSTEM_PREFIX}\n\n{COMMAND_DOCS}\n\n{SYSTEM_SUFFIX}'
|
||||
|
||||
|
||||
def get_in_context_example() -> str:
|
||||
@@ -112,7 +38,7 @@ def get_in_context_example() -> str:
|
||||
|
||||
|
||||
class CodeActSWEAgent(Agent):
|
||||
VERSION = '1.5'
|
||||
VERSION = '1.6'
|
||||
"""
|
||||
This agent is an adaptation of the original [SWE Agent](https://swe-agent.com/) based on CodeAct 1.5 using the `agentskills` library of OpenDevin.
|
||||
|
||||
@@ -123,23 +49,23 @@ class CodeActSWEAgent(Agent):
|
||||
|
||||
sandbox_plugins: list[PluginRequirement] = [
|
||||
# NOTE: AgentSkillsRequirement need to go before JupyterRequirement, since
|
||||
# AgentSkillsRequirement provides a lot of Python functions
|
||||
# and it need to be initialized before Jupyter for Jupyter to use those functions.
|
||||
# AgentSkillsRequirement provides a lot of Python functions,
|
||||
# and it needs to be initialized before Jupyter for Jupyter to use those functions.
|
||||
AgentSkillsRequirement(),
|
||||
JupyterRequirement(),
|
||||
]
|
||||
runtime_tools: list[RuntimeTool] = [RuntimeTool.BROWSER]
|
||||
jupyter_kernel_init_code: str = 'from agentskills import *'
|
||||
runtime_tools: list[RuntimeTool] = []
|
||||
|
||||
system_message: str = get_system_message()
|
||||
in_context_example: str = f"Here is an example of how you can interact with the environment for task solving:\n{get_in_context_example()}\n\nNOW, LET'S START!"
|
||||
|
||||
response_parser = CodeActSWEResponseParser()
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
llm: LLM,
|
||||
) -> None:
|
||||
"""
|
||||
Initializes a new instance of the CodeActAgent class.
|
||||
"""Initializes a new instance of the CodeActAgent class.
|
||||
|
||||
Parameters:
|
||||
- llm (LLM): The llm to be used by this agent
|
||||
@@ -147,15 +73,59 @@ class CodeActSWEAgent(Agent):
|
||||
super().__init__(llm)
|
||||
self.reset()
|
||||
|
||||
def action_to_str(self, action: Action) -> str:
|
||||
if isinstance(action, CmdRunAction):
|
||||
return (
|
||||
f'{action.thought}\n<execute_bash>\n{action.command}\n</execute_bash>'
|
||||
)
|
||||
elif isinstance(action, IPythonRunCellAction):
|
||||
return f'{action.thought}\n<execute_ipython>\n{action.code}\n</execute_ipython>'
|
||||
elif isinstance(action, MessageAction):
|
||||
return action.content
|
||||
return ''
|
||||
|
||||
def get_action_message(self, action: Action) -> dict[str, str] | None:
|
||||
if (
|
||||
isinstance(action, CmdRunAction)
|
||||
or isinstance(action, IPythonRunCellAction)
|
||||
or isinstance(action, MessageAction)
|
||||
):
|
||||
return {
|
||||
'role': 'user' if action.source == 'user' else 'assistant',
|
||||
'content': self.action_to_str(action),
|
||||
}
|
||||
return None
|
||||
|
||||
def get_observation_message(self, obs: Observation) -> dict[str, str] | None:
|
||||
max_message_chars = self.llm.config.max_message_chars
|
||||
if isinstance(obs, CmdOutputObservation):
|
||||
content = 'OBSERVATION:\n' + truncate_content(
|
||||
obs.content, max_message_chars
|
||||
)
|
||||
content += (
|
||||
f'\n[Command {obs.command_id} finished with exit code {obs.exit_code}]'
|
||||
)
|
||||
return {'role': 'user', 'content': content}
|
||||
elif isinstance(obs, IPythonRunCellObservation):
|
||||
content = 'OBSERVATION:\n' + obs.content
|
||||
# replace base64 images with a placeholder
|
||||
splitted = content.split('\n')
|
||||
for i, line in enumerate(splitted):
|
||||
if ' already displayed to user'
|
||||
)
|
||||
content = '\n'.join(splitted)
|
||||
content = truncate_content(content, max_message_chars)
|
||||
return {'role': 'user', 'content': content}
|
||||
return None
|
||||
|
||||
def reset(self) -> None:
|
||||
"""
|
||||
Resets the CodeAct Agent.
|
||||
"""
|
||||
"""Resets the CodeAct Agent."""
|
||||
super().reset()
|
||||
|
||||
def step(self, state: State) -> Action:
|
||||
"""
|
||||
Performs one step using the CodeAct Agent.
|
||||
"""Performs one step using the CodeAct Agent.
|
||||
This includes gathering info on previous steps and prompting the model to make a command to execute.
|
||||
|
||||
Parameters:
|
||||
@@ -164,85 +134,57 @@ class CodeActSWEAgent(Agent):
|
||||
Returns:
|
||||
- CmdRunAction(command) - bash command to run
|
||||
- IPythonRunCellAction(code) - IPython code to run
|
||||
- BrowseInteractiveAction(browsergym_command) - BrowserGym commands to run
|
||||
- MessageAction(content) - Message action to run (e.g. ask for clarification)
|
||||
- AgentFinishAction() - end the interaction
|
||||
"""
|
||||
messages: list[dict[str, str]] = [
|
||||
{'role': 'system', 'content': self.system_message},
|
||||
{'role': 'user', 'content': self.in_context_example},
|
||||
]
|
||||
# if we're done, go back
|
||||
latest_user_message = state.history.get_last_user_message()
|
||||
if latest_user_message and latest_user_message.strip() == '/exit':
|
||||
return AgentFinishAction()
|
||||
|
||||
for prev_action, obs in state.history:
|
||||
action_message = get_action_message(prev_action)
|
||||
if action_message:
|
||||
messages.append(action_message)
|
||||
# prepare what we want to send to the LLM
|
||||
messages: list[dict[str, str]] = self._get_messages(state)
|
||||
|
||||
obs_message = get_observation_message(obs)
|
||||
if obs_message:
|
||||
messages.append(obs_message)
|
||||
|
||||
latest_user_message = [m for m in messages if m['role'] == 'user'][-1]
|
||||
if latest_user_message:
|
||||
if latest_user_message['content'].strip() == '/exit':
|
||||
return AgentFinishAction()
|
||||
latest_user_message['content'] += (
|
||||
f'\n\nENVIRONMENT REMINDER: You have {state.max_iterations - state.iteration} turns left to complete the task.'
|
||||
)
|
||||
|
||||
response = self.llm.do_completion(
|
||||
response = self.llm.completion(
|
||||
messages=messages,
|
||||
stop=[
|
||||
'</execute_ipython>',
|
||||
'</execute_bash>',
|
||||
'</execute_browse>',
|
||||
],
|
||||
temperature=0.0,
|
||||
)
|
||||
|
||||
action_str: str = parse_response(response)
|
||||
state.num_of_chars += sum(
|
||||
len(message['content']) for message in messages
|
||||
) + len(action_str)
|
||||
return self.response_parser.parse(response)
|
||||
|
||||
if finish_command := re.search(r'<finish>.*</finish>', action_str, re.DOTALL):
|
||||
thought = action_str.replace(finish_command.group(0), '').strip()
|
||||
return AgentFinishAction(thought=thought)
|
||||
if bash_command := re.search(
|
||||
r'<execute_bash>(.*?)</execute_bash>', action_str, re.DOTALL
|
||||
):
|
||||
# remove the command from the action string to get thought
|
||||
thought = action_str.replace(bash_command.group(0), '').strip()
|
||||
# a command was found
|
||||
command_group = bash_command.group(1).strip()
|
||||
def _get_messages(self, state: State) -> list[dict[str, str]]:
|
||||
messages = [
|
||||
{'role': 'system', 'content': self.system_message},
|
||||
{'role': 'user', 'content': self.in_context_example},
|
||||
]
|
||||
|
||||
if command_group.strip() == 'exit':
|
||||
return AgentFinishAction()
|
||||
return CmdRunAction(command=command_group, thought=thought)
|
||||
elif python_code := re.search(
|
||||
r'<execute_ipython>(.*?)</execute_ipython>', action_str, re.DOTALL
|
||||
):
|
||||
# a code block was found
|
||||
code_group = python_code.group(1).strip()
|
||||
thought = action_str.replace(python_code.group(0), '').strip()
|
||||
return IPythonRunCellAction(
|
||||
code=code_group,
|
||||
thought=thought,
|
||||
kernel_init_code=self.jupyter_kernel_init_code,
|
||||
for event in state.history.get_events():
|
||||
# create a regular message from an event
|
||||
if isinstance(event, Action):
|
||||
message = self.get_action_message(event)
|
||||
elif isinstance(event, Observation):
|
||||
message = self.get_observation_message(event)
|
||||
else:
|
||||
raise ValueError(f'Unknown event type: {type(event)}')
|
||||
|
||||
# add regular message
|
||||
if message:
|
||||
messages.append(message)
|
||||
|
||||
# the latest user message is important:
|
||||
# we want to remind the agent of the environment constraints
|
||||
latest_user_message = next(
|
||||
(m for m in reversed(messages) if m['role'] == 'user'), None
|
||||
)
|
||||
|
||||
# add a reminder to the prompt
|
||||
if latest_user_message:
|
||||
latest_user_message['content'] += (
|
||||
f'\n\nENVIRONMENT REMINDER: You have {state.max_iterations - state.iteration} turns left to complete the task.'
|
||||
)
|
||||
elif browse_command := re.search(
|
||||
r'<execute_browse>(.*)</execute_browse>', action_str, re.DOTALL
|
||||
):
|
||||
# BrowserGym actions was found
|
||||
browse_actions = browse_command.group(1).strip()
|
||||
thought = action_str.replace(browse_command.group(0), '').strip()
|
||||
return BrowseInteractiveAction(
|
||||
browser_actions=browse_actions, thought=thought
|
||||
)
|
||||
else:
|
||||
# We assume the LLM is GOOD enough that when it returns pure natural language
|
||||
# it want to talk to the user
|
||||
return MessageAction(content=action_str, wait_for_response=True)
|
||||
|
||||
def search_memory(self, query: str) -> list[str]:
|
||||
raise NotImplementedError('Implement this abstract method')
|
||||
return messages
|
||||
|
||||
@@ -18,9 +18,13 @@ The assistant can execute bash commands on behalf of the user by wrapping them w
|
||||
For example, you can list the files in the current directory by <execute_bash> ls </execute_bash>.
|
||||
"""
|
||||
|
||||
PIP_INSTALL_PREFIX = """The assistant can install Python packages using the %pip magic command in an IPython environment by using the following syntax: <execute_ipython> %pip install [package needed] </execute_ipython> and should always import packages and define variables before starting to use them."""
|
||||
|
||||
SYSTEM_PREFIX = MINIMAL_SYSTEM_PREFIX + PIP_INSTALL_PREFIX
|
||||
|
||||
SYSTEM_SUFFIX = """The assistant's response should be concise.
|
||||
The assistant should include ONLY ONE <execute_ipython> or <execute_bash> or <execute_browse> in every one of the responses, unless the assistant is finished with the task or need more input or action from the user in order to proceed.
|
||||
IMPORTANT: Whenever possible, execute the code for the user using <execute_ipython> or <execute_bash> or <execute_browse> instead of providing it.
|
||||
The assistant should include ONLY ONE <execute_ipython> or <execute_bash> in every one of the responses, unless the assistant is finished with the task or need more input or action from the user in order to proceed.
|
||||
IMPORTANT: Whenever possible, execute the code for the user using <execute_ipython> or <execute_bash> instead of providing it.
|
||||
"""
|
||||
|
||||
SWE_EXAMPLE = """
|
||||
|
||||
46
agenthub/codeact_swe_agent/response_parser.py
Normal file
46
agenthub/codeact_swe_agent/response_parser.py
Normal file
@@ -0,0 +1,46 @@
|
||||
from agenthub.codeact_swe_agent.action_parser import (
|
||||
CodeActSWEActionParserCmdRun,
|
||||
CodeActSWEActionParserFinish,
|
||||
CodeActSWEActionParserIPythonRunCell,
|
||||
CodeActSWEActionParserMessage,
|
||||
)
|
||||
from opendevin.controller.action_parser import ResponseParser
|
||||
from opendevin.events.action import Action
|
||||
|
||||
|
||||
class CodeActSWEResponseParser(ResponseParser):
|
||||
"""Parser action:
|
||||
- CmdRunAction(command) - bash command to run
|
||||
- IPythonRunCellAction(code) - IPython code to run
|
||||
- MessageAction(content) - Message action to run (e.g. ask for clarification)
|
||||
- AgentFinishAction() - end the interaction
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
# Need pay attention to the item order in self.action_parsers
|
||||
super().__init__()
|
||||
self.action_parsers = [
|
||||
CodeActSWEActionParserFinish(),
|
||||
CodeActSWEActionParserCmdRun(),
|
||||
CodeActSWEActionParserIPythonRunCell(),
|
||||
]
|
||||
self.default_parser = CodeActSWEActionParserMessage()
|
||||
|
||||
def parse(self, response: str) -> Action:
|
||||
action_str = self.parse_response(response)
|
||||
return self.parse_action(action_str)
|
||||
|
||||
def parse_response(self, response) -> str:
|
||||
action = response.choices[0].message.content
|
||||
if action is None:
|
||||
return ''
|
||||
for lang in ['bash', 'ipython']:
|
||||
if f'<execute_{lang}>' in action and f'</execute_{lang}>' not in action:
|
||||
action += f'</execute_{lang}>'
|
||||
return action
|
||||
|
||||
def parse_action(self, action_str: str) -> Action:
|
||||
for action_parser in self.action_parsers:
|
||||
if action_parser.check_condition(action_str):
|
||||
return action_parser.parse(action_str)
|
||||
return self.default_parser.parse(action_str)
|
||||
@@ -8,15 +8,13 @@ from opendevin.llm.llm import LLM
|
||||
class DelegatorAgent(Agent):
|
||||
VERSION = '1.0'
|
||||
"""
|
||||
The planner agent utilizes a special prompting strategy to create long term plans for solving problems.
|
||||
The agent is given its previous action-observation pairs, current task, and hint based on last action taken at every step.
|
||||
The Delegator Agent is responsible for delegating tasks to other agents based on the current task.
|
||||
"""
|
||||
|
||||
current_delegate: str = ''
|
||||
|
||||
def __init__(self, llm: LLM):
|
||||
"""
|
||||
Initialize the Delegator Agent with an LLM
|
||||
"""Initialize the Delegator Agent with an LLM
|
||||
|
||||
Parameters:
|
||||
- llm (LLM): The llm to be used by this agent
|
||||
@@ -24,16 +22,15 @@ class DelegatorAgent(Agent):
|
||||
super().__init__(llm)
|
||||
|
||||
def step(self, state: State) -> Action:
|
||||
"""
|
||||
Checks to see if current step is completed, returns AgentFinishAction if True.
|
||||
Otherwise, creates a plan prompt and sends to model for inference, returning the result as the next action.
|
||||
"""Checks to see if current step is completed, returns AgentFinishAction if True.
|
||||
Otherwise, delegates the task to the next agent in the pipeline.
|
||||
|
||||
Parameters:
|
||||
- state (State): The current state given the previous actions and observations
|
||||
|
||||
Returns:
|
||||
- AgentFinishAction: If the last state was 'completed', 'verified', or 'abandoned'
|
||||
- Action: The next action to take based on llm response
|
||||
- AgentDelegateAction: The next agent to delegate the task to
|
||||
"""
|
||||
if self.current_delegate == '':
|
||||
self.current_delegate = 'study'
|
||||
@@ -42,7 +39,9 @@ class DelegatorAgent(Agent):
|
||||
agent='StudyRepoForTaskAgent', inputs={'task': task}
|
||||
)
|
||||
|
||||
last_observation = state.history[-1][1]
|
||||
# last observation in history should be from the delegate
|
||||
last_observation = state.history.get_last_observation()
|
||||
|
||||
if not isinstance(last_observation, AgentDelegateObservation):
|
||||
raise Exception('Last observation is not an AgentDelegateObservation')
|
||||
|
||||
@@ -81,6 +80,3 @@ class DelegatorAgent(Agent):
|
||||
)
|
||||
else:
|
||||
raise Exception('Invalid delegate state')
|
||||
|
||||
def search_memory(self, query: str) -> list[str]:
|
||||
return []
|
||||
|
||||
@@ -7,7 +7,6 @@ from opendevin.events.action import (
|
||||
Action,
|
||||
AddTaskAction,
|
||||
AgentFinishAction,
|
||||
AgentRecallAction,
|
||||
AgentRejectAction,
|
||||
BrowseInteractiveAction,
|
||||
BrowseURLAction,
|
||||
@@ -18,7 +17,6 @@ from opendevin.events.action import (
|
||||
ModifyTaskAction,
|
||||
)
|
||||
from opendevin.events.observation import (
|
||||
AgentRecallObservation,
|
||||
CmdOutputObservation,
|
||||
FileReadObservation,
|
||||
FileWriteObservation,
|
||||
@@ -31,8 +29,6 @@ from opendevin.llm.llm import LLM
|
||||
"""
|
||||
FIXME: There are a few problems this surfaced
|
||||
* FileWrites seem to add an unintended newline at the end of the file
|
||||
* command_id is sometimes a number, sometimes a string
|
||||
* Why isn't the output of the background command split between two steps?
|
||||
* Browser not working
|
||||
"""
|
||||
|
||||
@@ -40,8 +36,6 @@ ActionObs = TypedDict(
|
||||
'ActionObs', {'action': Action, 'observations': list[Observation]}
|
||||
)
|
||||
|
||||
BACKGROUND_CMD = 'echo "This is in the background" && sleep .1 && echo "This too"'
|
||||
|
||||
|
||||
class DummyAgent(Agent):
|
||||
VERSION = '1.0'
|
||||
@@ -95,28 +89,6 @@ class DummyAgent(Agent):
|
||||
)
|
||||
],
|
||||
},
|
||||
{
|
||||
'action': CmdRunAction(command=BACKGROUND_CMD, background=True),
|
||||
'observations': [
|
||||
CmdOutputObservation(
|
||||
'Background command started. To stop it, send a `kill` action with command_id 42',
|
||||
command_id='42', # type: ignore[arg-type]
|
||||
command=BACKGROUND_CMD,
|
||||
),
|
||||
CmdOutputObservation(
|
||||
'This is in the background\nThis too\n',
|
||||
command_id='42', # type: ignore[arg-type]
|
||||
command=BACKGROUND_CMD,
|
||||
),
|
||||
],
|
||||
},
|
||||
{
|
||||
'action': AgentRecallAction(query='who am I?'),
|
||||
'observations': [
|
||||
AgentRecallObservation('', memories=['I am a computer.']),
|
||||
# CmdOutputObservation('This too\n', command_id='42', command=BACKGROUND_CMD),
|
||||
],
|
||||
},
|
||||
{
|
||||
'action': BrowseURLAction(url='https://google.com'),
|
||||
'observations': [
|
||||
@@ -145,11 +117,16 @@ class DummyAgent(Agent):
|
||||
time.sleep(0.1)
|
||||
if state.iteration > 0:
|
||||
prev_step = self.steps[state.iteration - 1]
|
||||
|
||||
# a step is (action, observations list)
|
||||
if 'observations' in prev_step:
|
||||
# one obs, at most
|
||||
expected_observations = prev_step['observations']
|
||||
hist_start = len(state.history) - len(expected_observations)
|
||||
|
||||
# check if the history matches the expected observations
|
||||
hist_events = state.history.get_last_events(len(expected_observations))
|
||||
for i in range(len(expected_observations)):
|
||||
hist_obs = event_to_dict(state.history[hist_start + i][1])
|
||||
hist_obs = event_to_dict(hist_events[i])
|
||||
expected_obs = event_to_dict(expected_observations[i])
|
||||
if (
|
||||
'command_id' in hist_obs['extras']
|
||||
@@ -163,13 +140,7 @@ class DummyAgent(Agent):
|
||||
):
|
||||
del expected_obs['extras']['command_id']
|
||||
expected_obs['content'] = ''
|
||||
if hist_obs != expected_obs:
|
||||
print('\nactual', hist_obs)
|
||||
print('\nexpect', expected_obs)
|
||||
assert (
|
||||
hist_obs == expected_obs
|
||||
), f'Expected observation {expected_obs}, got {hist_obs}'
|
||||
return self.steps[state.iteration]['action']
|
||||
|
||||
def search_memory(self, query: str) -> list[str]:
|
||||
return ['I am a computer.']
|
||||
|
||||
@@ -12,3 +12,6 @@ in the following structure:
|
||||
Note that `prompt.md` could use jinja2 template syntax. During runtime, `prompt.md`
|
||||
is loaded and rendered, and used together with `agent.yaml` to initialize a
|
||||
micro-agent.
|
||||
|
||||
Micro-agents can be used independently. You can also use `ManagerAgent` which knows
|
||||
how to coordinate the agents and collaboratively finish a task.
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
* `kill` - kills a background command
|
||||
* `command_id` - the ID of the background command to kill
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
* `reject` - reject the task. Arguments:
|
||||
* `outputs` - a dictionary representing the outputs of your task, if any
|
||||
* `outputs` - a dictionary with only a `reason` attribute
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
* `run` - runs a command on the command line in a Linux shell. Arguments:
|
||||
* `command` - the command to run
|
||||
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
|
||||
|
||||
@@ -7,6 +7,7 @@ from opendevin.events.action import Action
|
||||
from opendevin.events.serialization.action import action_from_dict
|
||||
from opendevin.events.serialization.event import event_to_memory
|
||||
from opendevin.llm.llm import LLM
|
||||
from opendevin.memory.history import ShortTermHistory
|
||||
|
||||
from .instructions import instructions
|
||||
from .registry import all_microagents
|
||||
@@ -21,31 +22,37 @@ def parse_response(orig_response: str) -> Action:
|
||||
|
||||
|
||||
def to_json(obj, **kwargs):
|
||||
"""
|
||||
Serialize an object to str format
|
||||
"""
|
||||
"""Serialize an object to str format"""
|
||||
return json.dumps(obj, **kwargs)
|
||||
|
||||
|
||||
def history_to_json(obj, **kwargs):
|
||||
"""
|
||||
Serialize and simplify history to str format
|
||||
"""
|
||||
if isinstance(obj, list):
|
||||
# process history, make it simpler.
|
||||
processed_history = []
|
||||
for action, observation in obj:
|
||||
processed_history.append(
|
||||
(event_to_memory(action), event_to_memory(observation))
|
||||
)
|
||||
return json.dumps(processed_history, **kwargs)
|
||||
|
||||
|
||||
class MicroAgent(Agent):
|
||||
VERSION = '1.0'
|
||||
prompt = ''
|
||||
agent_definition: dict = {}
|
||||
|
||||
def history_to_json(
|
||||
self, history: ShortTermHistory, max_events: int = 20, **kwargs
|
||||
):
|
||||
"""
|
||||
Serialize and simplify history to str format
|
||||
"""
|
||||
processed_history = []
|
||||
event_count = 0
|
||||
|
||||
for event in history.get_events(reverse=True):
|
||||
if event_count >= max_events:
|
||||
break
|
||||
processed_history.append(
|
||||
event_to_memory(event, self.llm.config.max_message_chars)
|
||||
)
|
||||
event_count += 1
|
||||
|
||||
# history is in reverse order, let's fix it
|
||||
processed_history.reverse()
|
||||
|
||||
return json.dumps(processed_history, **kwargs)
|
||||
|
||||
def __init__(self, llm: LLM):
|
||||
super().__init__(llm)
|
||||
if 'name' not in self.agent_definition:
|
||||
@@ -59,16 +66,12 @@ class MicroAgent(Agent):
|
||||
state=state,
|
||||
instructions=instructions,
|
||||
to_json=to_json,
|
||||
history_to_json=history_to_json,
|
||||
history_to_json=self.history_to_json,
|
||||
delegates=self.delegates,
|
||||
latest_user_message=state.get_current_user_intent(),
|
||||
)
|
||||
messages = [{'content': prompt, 'role': 'user'}]
|
||||
resp = self.llm.do_completion(messages=messages)
|
||||
resp = self.llm.completion(messages=messages)
|
||||
action_resp = resp['choices'][0]['message']['content']
|
||||
state.num_of_chars += len(prompt) + len(action_resp)
|
||||
action = parse_response(action_resp)
|
||||
return action
|
||||
|
||||
def search_memory(self, query: str) -> list[str]:
|
||||
return []
|
||||
|
||||
@@ -21,7 +21,7 @@ Do NOT finish until you have completed the tasks.
|
||||
|
||||
## History
|
||||
{{ instructions.history_truncated }}
|
||||
{{ history_to_json(state.history[-10:]) }}
|
||||
{{ history_to_json(state.history, max_events=20) }}
|
||||
|
||||
## Format
|
||||
{{ instructions.format.action }}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
CommitWriterAgent can help write git commit message. Example:
|
||||
|
||||
```bash
|
||||
WORKSPACE_MOUNT_PATH="`PWD`" SANDBOX_TYPE="exec" \
|
||||
WORKSPACE_MOUNT_PATH="`PWD`" SANDBOX_BOX_TYPE="ssh" \
|
||||
poetry run python opendevin/core/main.py -t "dummy task" -c CommitWriterAgent -d ./
|
||||
```
|
||||
|
||||
|
||||
@@ -3,3 +3,4 @@ description: "Write a git commit message for files in the git staging area"
|
||||
inputs: {}
|
||||
outputs:
|
||||
answer: string
|
||||
reason: string
|
||||
|
||||
@@ -11,14 +11,16 @@ changes. The commit message should include:
|
||||
- A summary line that clearly states the purpose of the changes.
|
||||
- Optionally, a detailed description if the changes are complex or need further explanation.
|
||||
|
||||
You should find the diff using `git diff --cached`, compile a commit message,
|
||||
and call the `finish` action with `outputs.answer` set to the answer. If current
|
||||
repo is not a valid git repo, or there is no diff in the staging area, please call
|
||||
the `reject` action with `outputs.answer` set to the reason.
|
||||
You should first use `git status` to check whether it's a valid git repo and there
|
||||
is diff in the staging area. If not, please call the `reject` action.
|
||||
|
||||
If it is a valid git repo and there is diff in the staging area, you should find
|
||||
the diff using `git diff --cached`, compile a commit message, and call the `finish`
|
||||
action with `outputs.answer` set to the answer.
|
||||
|
||||
## History
|
||||
{{ instructions.history_truncated }}
|
||||
{{ history_to_json(state.history[-10:]) }}
|
||||
{{ history_to_json(state.history, max_events=20) }}
|
||||
|
||||
If the last item in the history is an error, you should try to fix it.
|
||||
|
||||
|
||||
@@ -3,4 +3,6 @@ description: Delegates tasks to microagents based on their area of expertise
|
||||
generates: Action
|
||||
inputs:
|
||||
task: string
|
||||
outputs: {}
|
||||
outputs:
|
||||
summary: string # if finished
|
||||
reason: string # if rejected
|
||||
|
||||
@@ -7,6 +7,16 @@ can do the actual work. A description of each agent is provided below. You MUST
|
||||
select one of the delegates below to move towards accomplishing the task, and you MUST
|
||||
provide the correct inputs for the delegate you select.
|
||||
|
||||
Note: the delegated agent either returns "finish" or "reject".
|
||||
- If the action is "finish", but the full task is not done yet, you should
|
||||
continue to delegate to one of the agents below to until the full task is finished.
|
||||
- If the action is "reject", it means the delegated agent is not capable of the
|
||||
task you send to. You should revisit the input you send to the delegate, and consider
|
||||
whether any other delegate would be able to solve the task. If you cannot find
|
||||
a proper delegate agent, or the delegate attempts keep failing, call the `reject`
|
||||
action. In `reason` attribute, make sure you include your attempts (e.g. what agent
|
||||
you have delegated to, and why they failed).
|
||||
|
||||
## Agents
|
||||
{% for name, details in delegates.items() %}
|
||||
### {{ name }}
|
||||
@@ -17,11 +27,15 @@ provide the correct inputs for the delegate you select.
|
||||
|
||||
## History
|
||||
{{ instructions.history_truncated }}
|
||||
{{ history_to_json(state.history[-10:]) }}
|
||||
{{ history_to_json(state.history, max_events=20) }}
|
||||
|
||||
If the last item in the history is an error, you should try to fix it. If you
|
||||
cannot fix it, call the `reject` action.
|
||||
|
||||
## Available Actions
|
||||
{{ instructions.actions.delegate }}
|
||||
{{ instructions.actions.finish }}
|
||||
{{ instructions.actions.reject }}
|
||||
|
||||
## Format
|
||||
{{ instructions.format.action }}
|
||||
|
||||
@@ -10,7 +10,7 @@ and call the `finish` action with `outputs.answer` set to the answer.
|
||||
|
||||
## History
|
||||
{{ instructions.history_truncated }}
|
||||
{{ history_to_json(state.history[-10:]) }}
|
||||
{{ history_to_json(state.history, max_events=20) }}
|
||||
|
||||
If the last item in the history is an error, you should try to fix it.
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ You may take any of the following actions:
|
||||
|
||||
## History
|
||||
{{ instructions.history_truncated }}
|
||||
{{ history_to_json(state.history[-10:]) }}
|
||||
{{ history_to_json(state.history, max_events=20) }}
|
||||
|
||||
## Format
|
||||
{{ instructions.format.action }}
|
||||
|
||||
@@ -20,7 +20,7 @@ When you're done, put your summary into the output of the `finish` action.
|
||||
|
||||
## History
|
||||
{{ instructions.history_truncated }}
|
||||
{{ history_to_json(state.history[-10:]) }}
|
||||
{{ history_to_json(state.history, max_events=20) }}
|
||||
|
||||
## Format
|
||||
{{ instructions.format.action }}
|
||||
|
||||
@@ -24,7 +24,7 @@ implement the solution. If the codebase is empty, you should call the `finish` a
|
||||
|
||||
## History
|
||||
{{ instructions.history_truncated }}
|
||||
{{ history_to_json(state.history[-10:]) }}
|
||||
{{ history_to_json(state.history, max_events=20) }}
|
||||
|
||||
## Format
|
||||
{{ instructions.format.action }}
|
||||
@@ -41,8 +41,7 @@ ASSISTANT:
|
||||
{
|
||||
"action": "run",
|
||||
"args": {
|
||||
"command": "ls",
|
||||
"background": false
|
||||
"command": "ls"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ Do NOT finish until you have fixed all the typos and generated a summary.
|
||||
|
||||
## History
|
||||
{{ instructions.history_truncated }}
|
||||
{{ history_to_json(state.history[-5:]) }}
|
||||
{{ history_to_json(state.history, max_events=10) }}
|
||||
|
||||
## Format
|
||||
{{ instructions.format.action }}
|
||||
|
||||
@@ -22,7 +22,7 @@ explaining what the problem is.
|
||||
|
||||
## History
|
||||
{{ instructions.history_truncated }}
|
||||
{{ history_to_json(state.history[-10:]) }}
|
||||
{{ history_to_json(state.history, max_events=20) }}
|
||||
|
||||
## Format
|
||||
{{ instructions.format.action }}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import agenthub.monologue_agent.utils.prompts as prompts
|
||||
from agenthub.monologue_agent.response_parser import MonologueResponseParser
|
||||
from agenthub.monologue_agent.utils.prompts import INITIAL_THOUGHTS
|
||||
from opendevin.controller.agent import Agent
|
||||
from opendevin.controller.state.state import State
|
||||
@@ -7,7 +8,6 @@ from opendevin.core.exceptions import AgentNoInstructionError
|
||||
from opendevin.core.schema import ActionType
|
||||
from opendevin.events.action import (
|
||||
Action,
|
||||
AgentRecallAction,
|
||||
BrowseURLAction,
|
||||
CmdRunAction,
|
||||
FileReadAction,
|
||||
@@ -16,7 +16,6 @@ from opendevin.events.action import (
|
||||
NullAction,
|
||||
)
|
||||
from opendevin.events.observation import (
|
||||
AgentRecallObservation,
|
||||
BrowserOutputObservation,
|
||||
CmdOutputObservation,
|
||||
FileReadObservation,
|
||||
@@ -28,12 +27,9 @@ from opendevin.llm.llm import LLM
|
||||
from opendevin.memory.condenser import MemoryCondenser
|
||||
from opendevin.runtime.tools import RuntimeTool
|
||||
|
||||
if config.agent.memory_enabled:
|
||||
if config.get_agent_config('MonologueAgent').memory_enabled:
|
||||
from opendevin.memory.memory import LongTermMemory
|
||||
|
||||
MAX_TOKEN_COUNT_PADDING = 512
|
||||
MAX_OUTPUT_LENGTH = 5000
|
||||
|
||||
|
||||
class MonologueAgent(Agent):
|
||||
VERSION = '1.0'
|
||||
@@ -48,10 +44,10 @@ class MonologueAgent(Agent):
|
||||
memory: 'LongTermMemory | None'
|
||||
memory_condenser: MemoryCondenser
|
||||
runtime_tools: list[RuntimeTool] = [RuntimeTool.BROWSER]
|
||||
response_parser = MonologueResponseParser()
|
||||
|
||||
def __init__(self, llm: LLM):
|
||||
"""
|
||||
Initializes the Monologue Agent with an llm.
|
||||
"""Initializes the Monologue Agent with an llm.
|
||||
|
||||
Parameters:
|
||||
- llm (LLM): The llm to be used by this agent
|
||||
@@ -59,19 +55,17 @@ class MonologueAgent(Agent):
|
||||
super().__init__(llm)
|
||||
|
||||
def _initialize(self, task: str):
|
||||
"""
|
||||
Utilizes the INITIAL_THOUGHTS list to give the agent a context for its capabilities
|
||||
"""Utilizes the INITIAL_THOUGHTS list to give the agent a context for its capabilities
|
||||
and how to navigate the WORKSPACE_MOUNT_PATH_IN_SANDBOX in `config` (e.g., /workspace by default).
|
||||
Short circuited to return when already initialized.
|
||||
Will execute again when called after reset.
|
||||
|
||||
Parameters:
|
||||
- task (str): The initial goal statement provided by the user
|
||||
- task: The initial goal statement provided by the user
|
||||
|
||||
Raises:
|
||||
- AgentNoInstructionError: If task is not provided
|
||||
"""
|
||||
|
||||
if self._initialized:
|
||||
return
|
||||
|
||||
@@ -79,7 +73,7 @@ class MonologueAgent(Agent):
|
||||
raise AgentNoInstructionError()
|
||||
|
||||
self.initial_thoughts = []
|
||||
if config.agent.memory_enabled:
|
||||
if config.get_agent_config('MonologueAgent').memory_enabled:
|
||||
self.memory = LongTermMemory()
|
||||
else:
|
||||
self.memory = None
|
||||
@@ -89,7 +83,7 @@ class MonologueAgent(Agent):
|
||||
self._add_initial_thoughts(task)
|
||||
self._initialized = True
|
||||
|
||||
def _add_initial_thoughts(self, task):
|
||||
def _add_initial_thoughts(self, task: str):
|
||||
previous_action = ''
|
||||
for thought in INITIAL_THOUGHTS:
|
||||
thought = thought.replace('$TASK', task)
|
||||
@@ -101,13 +95,13 @@ class MonologueAgent(Agent):
|
||||
)
|
||||
elif previous_action == ActionType.READ:
|
||||
observation = FileReadObservation(content=thought, path='')
|
||||
elif previous_action == ActionType.RECALL:
|
||||
observation = AgentRecallObservation(content=thought, memories=[])
|
||||
elif previous_action == ActionType.BROWSE:
|
||||
observation = BrowserOutputObservation(
|
||||
content=thought, url='', screenshot=''
|
||||
)
|
||||
self.initial_thoughts.append(event_to_memory(observation))
|
||||
self.initial_thoughts.append(
|
||||
event_to_memory(observation, self.llm.config.max_message_chars)
|
||||
)
|
||||
previous_action = ''
|
||||
else:
|
||||
action: Action = NullAction()
|
||||
@@ -124,21 +118,18 @@ class MonologueAgent(Agent):
|
||||
path = thought.split('READ ')[1]
|
||||
action = FileReadAction(path=path)
|
||||
previous_action = ActionType.READ
|
||||
elif thought.startswith('RECALL'):
|
||||
query = thought.split('RECALL ')[1]
|
||||
action = AgentRecallAction(query=query)
|
||||
previous_action = ActionType.RECALL
|
||||
elif thought.startswith('BROWSE'):
|
||||
url = thought.split('BROWSE ')[1]
|
||||
action = BrowseURLAction(url=url)
|
||||
previous_action = ActionType.BROWSE
|
||||
else:
|
||||
action = MessageAction(thought)
|
||||
self.initial_thoughts.append(event_to_memory(action))
|
||||
self.initial_thoughts.append(
|
||||
event_to_memory(action, self.llm.config.max_message_chars)
|
||||
)
|
||||
|
||||
def step(self, state: State) -> Action:
|
||||
"""
|
||||
Modifies the current state by adding the most recent actions and observations, then prompts the model to think about it's next action to take using monologue, memory, and hint.
|
||||
"""Modifies the current state by adding the most recent actions and observations, then prompts the model to think about it's next action to take using monologue, memory, and hint.
|
||||
|
||||
Parameters:
|
||||
- state (State): The current state based on previous steps taken
|
||||
@@ -146,32 +137,36 @@ class MonologueAgent(Agent):
|
||||
Returns:
|
||||
- Action: The next action to take based on LLM response
|
||||
"""
|
||||
|
||||
goal = state.get_current_user_intent()
|
||||
self._initialize(goal)
|
||||
|
||||
recent_events: list[dict[str, str]] = []
|
||||
|
||||
# add the events from state.history
|
||||
for prev_action, obs in state.history:
|
||||
if not isinstance(prev_action, NullAction):
|
||||
recent_events.append(event_to_memory(prev_action))
|
||||
if not isinstance(obs, NullObservation):
|
||||
recent_events.append(self._truncate_output(event_to_memory(obs)))
|
||||
for event in state.history.get_events():
|
||||
recent_events.append(
|
||||
event_to_memory(event, self.llm.config.max_message_chars)
|
||||
)
|
||||
|
||||
# add the last messages to long term memory
|
||||
if self.memory is not None and state.history and len(state.history) > 0:
|
||||
self.memory.add_event(event_to_memory(state.history[-1][0]))
|
||||
self.memory.add_event(
|
||||
self._truncate_output(event_to_memory(state.history[-1][1]))
|
||||
)
|
||||
if self.memory is not None:
|
||||
last_action = state.history.get_last_action()
|
||||
last_observation = state.history.get_last_observation()
|
||||
|
||||
# this should still work
|
||||
# we will need to do this differently: find out if there really is an action or an observation in this step
|
||||
if last_action:
|
||||
self.memory.add_event(
|
||||
event_to_memory(last_action, self.llm.config.max_message_chars)
|
||||
)
|
||||
if last_observation:
|
||||
self.memory.add_event(
|
||||
event_to_memory(last_observation, self.llm.config.max_message_chars)
|
||||
)
|
||||
|
||||
# the action prompt with initial thoughts and recent events
|
||||
prompt = prompts.get_request_action_prompt(
|
||||
goal,
|
||||
self.initial_thoughts,
|
||||
recent_events,
|
||||
state.background_commands_obs,
|
||||
goal, self.initial_thoughts, recent_events
|
||||
)
|
||||
|
||||
messages: list[dict[str, str]] = [
|
||||
@@ -179,60 +174,12 @@ class MonologueAgent(Agent):
|
||||
]
|
||||
|
||||
# format all as a single message, a monologue
|
||||
resp = self.llm.do_completion(messages=messages)
|
||||
resp = self.llm.completion(messages=messages)
|
||||
|
||||
# get the next action from the response
|
||||
action_resp = resp['choices'][0]['message']['content']
|
||||
|
||||
# keep track of max_chars fallback option
|
||||
state.num_of_chars += len(prompt) + len(action_resp)
|
||||
|
||||
action = prompts.parse_action_response(action_resp)
|
||||
action = self.response_parser.parse(resp)
|
||||
self.latest_action = action
|
||||
return action
|
||||
|
||||
def _truncate_output(
|
||||
self, observation: dict, max_chars: int = MAX_OUTPUT_LENGTH
|
||||
) -> dict[str, str]:
|
||||
"""
|
||||
Truncates the output of an observation to a maximum number of characters.
|
||||
|
||||
Parameters:
|
||||
- output (str): The observation whose output to truncate
|
||||
- max_chars (int): The maximum number of characters to allow
|
||||
|
||||
Returns:
|
||||
- str: The truncated output
|
||||
"""
|
||||
if (
|
||||
'args' in observation
|
||||
and 'output' in observation['args']
|
||||
and len(observation['args']['output']) > max_chars
|
||||
):
|
||||
output = observation['args']['output']
|
||||
half = max_chars // 2
|
||||
observation['args']['output'] = (
|
||||
output[:half]
|
||||
+ '\n[... Output truncated due to length...]\n'
|
||||
+ output[-half:]
|
||||
)
|
||||
return observation
|
||||
|
||||
def search_memory(self, query: str) -> list[str]:
|
||||
"""
|
||||
Uses VectorIndexRetriever to find related memories within the long term memory.
|
||||
Uses search to produce top 10 results.
|
||||
|
||||
Parameters:
|
||||
- query (str): The query that we want to find related memories for
|
||||
|
||||
Returns:
|
||||
- list[str]: A list of top 10 text results that matched the query
|
||||
"""
|
||||
if self.memory is None:
|
||||
return []
|
||||
return self.memory.search(query)
|
||||
|
||||
def reset(self) -> None:
|
||||
super().reset()
|
||||
|
||||
|
||||
37
agenthub/monologue_agent/response_parser.py
Normal file
37
agenthub/monologue_agent/response_parser.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from opendevin.controller.action_parser import ResponseParser
|
||||
from opendevin.core.utils import json
|
||||
from opendevin.events.action import (
|
||||
Action,
|
||||
)
|
||||
from opendevin.events.serialization.action import action_from_dict
|
||||
|
||||
|
||||
class MonologueResponseParser(ResponseParser):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def parse(self, response: str) -> Action:
|
||||
action_str = self.parse_response(response)
|
||||
return self.parse_action(action_str)
|
||||
|
||||
def parse_response(self, response) -> str:
|
||||
# get the next action from the response
|
||||
return response['choices'][0]['message']['content']
|
||||
|
||||
def parse_action(self, action_str: str) -> Action:
|
||||
"""Parses a string to find an action within it
|
||||
|
||||
Parameters:
|
||||
- response (str): The string to be parsed
|
||||
|
||||
Returns:
|
||||
- Action: The action that was found in the response string
|
||||
"""
|
||||
# attempt to load the JSON dict from the response
|
||||
action_dict = json.loads(action_str)
|
||||
|
||||
if 'content' in action_dict:
|
||||
# The LLM gets confused here. Might as well be robust
|
||||
action_dict['contents'] = action_dict.pop('content')
|
||||
|
||||
return action_from_dict(action_dict)
|
||||
@@ -3,9 +3,6 @@ from opendevin.core.utils import json
|
||||
from opendevin.events.action import (
|
||||
Action,
|
||||
)
|
||||
from opendevin.events.observation import (
|
||||
CmdOutputObservation,
|
||||
)
|
||||
from opendevin.events.serialization.action import action_from_dict
|
||||
|
||||
ACTION_PROMPT = """
|
||||
@@ -32,25 +29,18 @@ Here are the possible actions:
|
||||
* `content` - the content to write to the file
|
||||
* `run` - runs a command. Arguments:
|
||||
* `command` - the command to run
|
||||
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
|
||||
* `kill` - kills a background command
|
||||
* `command_id` - the ID of the background command to kill
|
||||
* `browse` - opens a web page. Arguments:
|
||||
* `url` - the URL to open
|
||||
* `push` - Push a branch from the current repo to github:
|
||||
* `owner` - the owner of the repo to push to
|
||||
* `repo` - the name of the repo to push to
|
||||
* `branch` - the name of the branch to push
|
||||
* `recall` - recalls a past memory. Arguments:
|
||||
* `query` - the query to search for
|
||||
* `message` - make a plan, set a goal, record your thoughts, or ask for more input from the user. Arguments:
|
||||
* `content` - the message to record
|
||||
* `wait_for_response` - set to `true` to wait for the user to respond before proceeding
|
||||
* `finish` - if you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
|
||||
|
||||
%(background_commands)s
|
||||
|
||||
You MUST take time to think in between read, write, run, kill, browse, push, and recall actions--do this with the `message` action.
|
||||
You MUST take time to think in between read, write, run, browse, and push actions--do this with the `message` action.
|
||||
You should never act twice in a row without thinking. But if your last several
|
||||
actions are all `message` actions, you should consider taking a different action.
|
||||
|
||||
@@ -100,15 +90,7 @@ INITIAL_THOUGHTS = [
|
||||
'It seems like I have some kind of short term memory.',
|
||||
'Each of my thoughts seems to be stored in a JSON array.',
|
||||
'It seems whatever I say next will be added as an object to the list.',
|
||||
'But no one has perfect short-term memory. My list of thoughts will be summarized and condensed over time, losing information in the process.',
|
||||
'Fortunately I have long term memory!',
|
||||
'I can just perform a recall action, followed by the thing I want to remember. And then related thoughts just spill out!',
|
||||
"Sometimes they're random thoughts that don't really have to do with what I wanted to remember. But usually they're exactly what I need!",
|
||||
"Let's try it out!",
|
||||
'RECALL what it is I want to do',
|
||||
"Here's what I want to do: $TASK",
|
||||
'How am I going to get there though?',
|
||||
"Neat! And it looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!",
|
||||
"It looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!",
|
||||
'RUN echo "hello world"',
|
||||
'hello world',
|
||||
'Cool! I bet I can write files too using the write action.',
|
||||
@@ -138,8 +120,7 @@ INITIAL_THOUGHTS = [
|
||||
|
||||
|
||||
def get_summarize_monologue_prompt(thoughts: list[dict]):
|
||||
"""
|
||||
Gets the prompt for summarizing the monologue
|
||||
"""Gets the prompt for summarizing the monologue
|
||||
|
||||
Returns:
|
||||
- str: A formatted string with the current monologue within the prompt
|
||||
@@ -153,23 +134,16 @@ def get_request_action_prompt(
|
||||
task: str,
|
||||
thoughts: list[dict],
|
||||
recent_events: list[dict],
|
||||
background_commands_obs: list[CmdOutputObservation] | None = None,
|
||||
):
|
||||
"""
|
||||
Gets the action prompt formatted with appropriate values.
|
||||
"""Gets the action prompt formatted with appropriate values.
|
||||
|
||||
Parameters:
|
||||
- task (str): The current task the agent is trying to accomplish
|
||||
- thoughts (list[dict]): The agent's current thoughts
|
||||
- background_commands_obs (list[CmdOutputObservation]): list of all observed background commands running
|
||||
|
||||
Returns:
|
||||
- str: Formatted prompt string with hint, task, monologue, and background commands included
|
||||
"""
|
||||
|
||||
if background_commands_obs is None:
|
||||
background_commands_obs = []
|
||||
|
||||
hint = ''
|
||||
if len(recent_events) > 0:
|
||||
latest_event = recent_events[-1]
|
||||
@@ -187,15 +161,6 @@ def get_request_action_prompt(
|
||||
else:
|
||||
hint = "You're just getting started! What should you do first?"
|
||||
|
||||
bg_commands_message = ''
|
||||
if len(background_commands_obs) > 0:
|
||||
bg_commands_message = 'The following commands are running in the background:'
|
||||
for command_obs in background_commands_obs:
|
||||
bg_commands_message += (
|
||||
f'\n`{command_obs.command_id}`: {command_obs.command}'
|
||||
)
|
||||
bg_commands_message += '\nYou can end any process by sending a `kill` action with the numerical `command_id` above.'
|
||||
|
||||
user = 'opendevin' if config.run_as_devin else 'root'
|
||||
|
||||
monologue = thoughts + recent_events
|
||||
@@ -203,17 +168,15 @@ def get_request_action_prompt(
|
||||
return ACTION_PROMPT % {
|
||||
'task': task,
|
||||
'monologue': json.dumps(monologue, indent=2),
|
||||
'background_commands': bg_commands_message,
|
||||
'hint': hint,
|
||||
'user': user,
|
||||
'timeout': config.sandbox_timeout,
|
||||
'timeout': config.sandbox.timeout,
|
||||
'WORKSPACE_MOUNT_PATH_IN_SANDBOX': config.workspace_mount_path_in_sandbox,
|
||||
}
|
||||
|
||||
|
||||
def parse_action_response(orig_response: str) -> Action:
|
||||
"""
|
||||
Parses a string to find an action within it
|
||||
"""Parses a string to find an action within it
|
||||
|
||||
Parameters:
|
||||
- response (str): The string to be parsed
|
||||
@@ -232,8 +195,7 @@ def parse_action_response(orig_response: str) -> Action:
|
||||
|
||||
|
||||
def parse_summary_response(response: str) -> list[dict]:
|
||||
"""
|
||||
Parses a summary of the monologue
|
||||
"""Parses a summary of the monologue
|
||||
|
||||
Parameters:
|
||||
- response (str): The response string to be parsed
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from agenthub.monologue_agent.response_parser import MonologueResponseParser
|
||||
from opendevin.controller.agent import Agent
|
||||
from opendevin.controller.state.state import State
|
||||
from opendevin.events.action import Action, AgentFinishAction
|
||||
from opendevin.llm.llm import LLM
|
||||
from opendevin.runtime.tools import RuntimeTool
|
||||
|
||||
from .prompt import get_prompt, parse_response
|
||||
from .prompt import get_prompt
|
||||
|
||||
|
||||
class PlannerAgent(Agent):
|
||||
@@ -14,10 +15,10 @@ class PlannerAgent(Agent):
|
||||
The agent is given its previous action-observation pairs, current task, and hint based on last action taken at every step.
|
||||
"""
|
||||
runtime_tools: list[RuntimeTool] = [RuntimeTool.BROWSER]
|
||||
response_parser = MonologueResponseParser()
|
||||
|
||||
def __init__(self, llm: LLM):
|
||||
"""
|
||||
Initialize the Planner Agent with an LLM
|
||||
"""Initialize the Planner Agent with an LLM
|
||||
|
||||
Parameters:
|
||||
- llm (LLM): The llm to be used by this agent
|
||||
@@ -25,8 +26,7 @@ class PlannerAgent(Agent):
|
||||
super().__init__(llm)
|
||||
|
||||
def step(self, state: State) -> Action:
|
||||
"""
|
||||
Checks to see if current step is completed, returns AgentFinishAction if True.
|
||||
"""Checks to see if current step is completed, returns AgentFinishAction if True.
|
||||
Otherwise, creates a plan prompt and sends to model for inference, returning the result as the next action.
|
||||
|
||||
Parameters:
|
||||
@@ -36,20 +36,13 @@ class PlannerAgent(Agent):
|
||||
- AgentFinishAction: If the last state was 'completed', 'verified', or 'abandoned'
|
||||
- Action: The next action to take based on llm response
|
||||
"""
|
||||
|
||||
if state.root_task.state in [
|
||||
'completed',
|
||||
'verified',
|
||||
'abandoned',
|
||||
]:
|
||||
return AgentFinishAction()
|
||||
prompt = get_prompt(state)
|
||||
prompt = get_prompt(state, self.llm.config.max_message_chars)
|
||||
messages = [{'content': prompt, 'role': 'user'}]
|
||||
resp = self.llm.do_completion(messages=messages)
|
||||
action_resp = resp['choices'][0]['message']['content']
|
||||
state.num_of_chars += len(prompt) + len(action_resp)
|
||||
action = parse_response(action_resp)
|
||||
return action
|
||||
|
||||
def search_memory(self, query: str) -> list[str]:
|
||||
return []
|
||||
resp = self.llm.completion(messages=messages)
|
||||
return self.response_parser.parse(resp)
|
||||
|
||||
@@ -6,13 +6,10 @@ from opendevin.events.action import (
|
||||
Action,
|
||||
NullAction,
|
||||
)
|
||||
from opendevin.events.observation import (
|
||||
NullObservation,
|
||||
)
|
||||
from opendevin.events.serialization.action import action_from_dict
|
||||
from opendevin.events.serialization.event import event_to_memory
|
||||
|
||||
HISTORY_SIZE = 10
|
||||
HISTORY_SIZE = 20
|
||||
|
||||
prompt = """
|
||||
# Task
|
||||
@@ -77,9 +74,6 @@ It must be an object, and it must contain two fields:
|
||||
* `content` - the content to write to the file
|
||||
* `run` - runs a command on the command line in a Linux shell. Arguments:
|
||||
* `command` - the command to run
|
||||
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
|
||||
* `kill` - kills a background command
|
||||
* `command_id` - the ID of the background command to kill
|
||||
* `browse` - opens a web page. Arguments:
|
||||
* `url` - the URL to open
|
||||
* `message` - make a plan, set a goal, record your thoughts, or ask for more input from the user. Arguments:
|
||||
@@ -94,7 +88,7 @@ It must be an object, and it must contain two fields:
|
||||
* `state` - set to 'in_progress' to start the task, 'completed' to finish it, 'verified' to assert that it was successful, 'abandoned' to give up on it permanently, or `open` to stop working on it for now.
|
||||
* `finish` - if ALL of your tasks and subtasks have been verified or abandoned, and you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
|
||||
|
||||
You MUST take time to think in between read, write, run, kill, browse, and recall actions--do this with the `message` action.
|
||||
You MUST take time to think in between read, write, run, and browse actions--do this with the `message` action.
|
||||
You should never act twice in a row without thinking. But if your last several
|
||||
actions are all `message` actions, you should consider taking a different action.
|
||||
|
||||
@@ -106,7 +100,6 @@ What is your next thought or action? Again, you must reply with JSON, and only w
|
||||
|
||||
def get_hint(latest_action_id: str) -> str:
|
||||
"""Returns action type hint based on given action_id"""
|
||||
|
||||
hints = {
|
||||
'': "You haven't taken any actions yet. Start by using `ls` to check out what files you're working with.",
|
||||
ActionType.RUN: 'You should think about the command you just ran, what output it gave, and how that affects your plan.',
|
||||
@@ -114,7 +107,6 @@ def get_hint(latest_action_id: str) -> str:
|
||||
ActionType.WRITE: 'You just changed a file. You should think about how it affects your plan.',
|
||||
ActionType.BROWSE: 'You should think about the page you just visited, and what you learned from it.',
|
||||
ActionType.MESSAGE: "Look at your last thought in the history above. What does it suggest? Don't think anymore--take action.",
|
||||
ActionType.RECALL: 'You should think about the information you just recalled, and how it should affect your plan.',
|
||||
ActionType.ADD_TASK: 'You should think about the next action to take.',
|
||||
ActionType.MODIFY_TASK: 'You should think about the next action to take.',
|
||||
ActionType.SUMMARIZE: '',
|
||||
@@ -123,9 +115,9 @@ def get_hint(latest_action_id: str) -> str:
|
||||
return hints.get(latest_action_id, '')
|
||||
|
||||
|
||||
def get_prompt(state: State) -> str:
|
||||
"""
|
||||
Gets the prompt for the planner agent.
|
||||
def get_prompt(state: State, max_message_chars: int) -> str:
|
||||
"""Gets the prompt for the planner agent.
|
||||
|
||||
Formatted with the most recent action-observation pairs, current task, and hint based on last action
|
||||
|
||||
Parameters:
|
||||
@@ -134,19 +126,28 @@ def get_prompt(state: State) -> str:
|
||||
Returns:
|
||||
- str: The formatted string prompt with historical values
|
||||
"""
|
||||
|
||||
# the plan
|
||||
plan_str = json.dumps(state.root_task.to_dict(), indent=2)
|
||||
sub_history = state.history[-HISTORY_SIZE:]
|
||||
|
||||
# the history
|
||||
history_dicts = []
|
||||
latest_action: Action = NullAction()
|
||||
for action, observation in sub_history:
|
||||
if not isinstance(action, NullAction):
|
||||
history_dicts.append(event_to_memory(action))
|
||||
latest_action = action
|
||||
if not isinstance(observation, NullObservation):
|
||||
observation_dict = event_to_memory(observation)
|
||||
history_dicts.append(observation_dict)
|
||||
|
||||
# retrieve the latest HISTORY_SIZE events
|
||||
for event_count, event in enumerate(state.history.get_events(reverse=True)):
|
||||
if event_count >= HISTORY_SIZE:
|
||||
break
|
||||
if latest_action == NullAction() and isinstance(event, Action):
|
||||
latest_action = event
|
||||
history_dicts.append(event_to_memory(event, max_message_chars))
|
||||
|
||||
# history_dicts is in reverse order, lets fix it
|
||||
history_dicts.reverse()
|
||||
|
||||
# and get it as a JSON string
|
||||
history_str = json.dumps(history_dicts, indent=2)
|
||||
|
||||
# the plan status
|
||||
current_task = state.root_task.get_current_task()
|
||||
if current_task is not None:
|
||||
plan_status = f"You're currently working on this task:\n{current_task.goal}."
|
||||
@@ -154,9 +155,15 @@ def get_prompt(state: State) -> str:
|
||||
plan_status += "\nIf it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW."
|
||||
else:
|
||||
plan_status = "You're not currently working on any tasks. Your next action MUST be to mark a task as in_progress."
|
||||
hint = get_hint(event_to_memory(latest_action).get('action', ''))
|
||||
|
||||
# the hint, based on the last action
|
||||
hint = get_hint(event_to_memory(latest_action, max_message_chars).get('action', ''))
|
||||
logger.info('HINT:\n' + hint, extra={'msg_type': 'DETAIL'})
|
||||
|
||||
# the last relevant user message (the task)
|
||||
task = state.get_current_user_intent()
|
||||
|
||||
# finally, fill in the prompt
|
||||
return prompt % {
|
||||
'task': task,
|
||||
'plan': plan_str,
|
||||
@@ -167,9 +174,7 @@ def get_prompt(state: State) -> str:
|
||||
|
||||
|
||||
def parse_response(response: str) -> Action:
|
||||
"""
|
||||
Parses the model output to find a valid action to take
|
||||
|
||||
"""Parses the model output to find a valid action to take
|
||||
Parameters:
|
||||
- response (str): A response from the model that potentially contains an Action.
|
||||
|
||||
|
||||
204
config.template.toml
Normal file
204
config.template.toml
Normal file
@@ -0,0 +1,204 @@
|
||||
###################### OpenDevin Configuration Example ######################
|
||||
#
|
||||
# All settings have default values, so you only need to uncomment and
|
||||
# modify what you want to change
|
||||
# The fields within each section are sorted in alphabetical order.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
#################################### Core ####################################
|
||||
# General core configurations
|
||||
##############################################################################
|
||||
[core]
|
||||
# API key for E2B
|
||||
#e2b_api_key = ""
|
||||
|
||||
# Base path for the workspace
|
||||
workspace_base = "./workspace"
|
||||
|
||||
# Cache directory path
|
||||
#cache_dir = "/tmp/cache"
|
||||
|
||||
# Debugging enabled
|
||||
#debug = false
|
||||
|
||||
# Disable color in terminal output
|
||||
#disable_color = false
|
||||
|
||||
# Enable saving and restoring the session when run from CLI
|
||||
#enable_cli_session = false
|
||||
|
||||
# File store path
|
||||
#file_store_path = "/tmp/file_store"
|
||||
|
||||
# File store type
|
||||
#file_store = "memory"
|
||||
|
||||
# List of allowed file extensions for uploads
|
||||
#file_uploads_allowed_extensions = [".*"]
|
||||
|
||||
# Maximum file size for uploads, in megabytes
|
||||
#file_uploads_max_file_size_mb = 0
|
||||
|
||||
# Maximum budget per task, 0.0 means no limit
|
||||
#max_budget_per_task = 0.0
|
||||
|
||||
# Maximum number of iterations
|
||||
#max_iterations = 100
|
||||
|
||||
# Path to mount the workspace in the sandbox
|
||||
#workspace_mount_path_in_sandbox = "/workspace"
|
||||
|
||||
# Path to mount the workspace
|
||||
#workspace_mount_path = ""
|
||||
|
||||
# Path to rewrite the workspace mount path to
|
||||
#workspace_mount_rewrite = ""
|
||||
|
||||
# Persist the sandbox
|
||||
persist_sandbox = false
|
||||
|
||||
# Run as devin
|
||||
#run_as_devin = true
|
||||
|
||||
# Runtime environment
|
||||
#runtime = "server"
|
||||
|
||||
# SSH hostname for the sandbox
|
||||
#ssh_hostname = "localhost"
|
||||
|
||||
# SSH password for the sandbox
|
||||
#ssh_password = ""
|
||||
|
||||
# SSH port for the sandbox
|
||||
#ssh_port = 63710
|
||||
|
||||
|
||||
# Name of the default agent
|
||||
#default_agent = "CodeActAgent"
|
||||
|
||||
#################################### LLM #####################################
|
||||
# Configuration for LLM models (group name starts with 'llm')
|
||||
# use 'llm' for the default LLM config
|
||||
##############################################################################
|
||||
[llm]
|
||||
# AWS access key ID
|
||||
#aws_access_key_id = ""
|
||||
|
||||
# AWS region name
|
||||
#aws_region_name = ""
|
||||
|
||||
# AWS secret access key
|
||||
#aws_secret_access_key = ""
|
||||
|
||||
# API key to use
|
||||
api_key = "your-api-key"
|
||||
|
||||
# API base URL
|
||||
#base_url = ""
|
||||
|
||||
# API version
|
||||
#api_version = ""
|
||||
|
||||
# Cost per input token
|
||||
#input_cost_per_token = 0.0
|
||||
|
||||
# Cost per output token
|
||||
#output_cost_per_token = 0.0
|
||||
|
||||
# Custom LLM provider
|
||||
#custom_llm_provider = ""
|
||||
|
||||
# Embedding API base URL
|
||||
#embedding_base_url = ""
|
||||
|
||||
# Embedding deployment name
|
||||
#embedding_deployment_name = ""
|
||||
|
||||
# Embedding model to use
|
||||
embedding_model = ""
|
||||
|
||||
# Maximum number of characters in an observation's content
|
||||
#max_message_chars = 10000
|
||||
|
||||
# Maximum number of input tokens
|
||||
#max_input_tokens = 0
|
||||
|
||||
# Maximum number of output tokens
|
||||
#max_output_tokens = 0
|
||||
|
||||
# Model to use
|
||||
model = "gpt-4o"
|
||||
|
||||
# Number of retries to attempt
|
||||
#num_retries = 5
|
||||
|
||||
# Retry maximum wait time
|
||||
#retry_max_wait = 60
|
||||
|
||||
# Retry minimum wait time
|
||||
#retry_min_wait = 3
|
||||
|
||||
# Temperature for the API
|
||||
#temperature = 0.0
|
||||
|
||||
# Timeout for the API
|
||||
#timeout = 0
|
||||
|
||||
# Top p for the API
|
||||
#top_p = 0.5
|
||||
|
||||
[llm.gpt3]
|
||||
# API key to use
|
||||
api_key = "your-api-key"
|
||||
|
||||
# Model to use
|
||||
model = "gpt-3.5"
|
||||
|
||||
#################################### Agent ###################################
|
||||
# Configuration for agents (group name starts with 'agent')
|
||||
# Use 'agent' for the default agent config
|
||||
# otherwise, group name must be `agent.<agent_name>` (case-sensitive), e.g.
|
||||
# agent.CodeActAgent
|
||||
##############################################################################
|
||||
[agent]
|
||||
# Memory enabled
|
||||
#memory_enabled = false
|
||||
|
||||
# Memory maximum threads
|
||||
#memory_max_threads = 2
|
||||
|
||||
# LLM config group to use
|
||||
#llm_config = 'llm'
|
||||
|
||||
[agent.RepoExplorerAgent]
|
||||
# Example: use a cheaper model for RepoExplorerAgent to reduce cost, especially
|
||||
# useful when an agent doesn't demand high quality but uses a lot of tokens
|
||||
llm_config = 'gpt3'
|
||||
|
||||
#################################### Sandbox ###################################
|
||||
# Configuration for the sandbox
|
||||
##############################################################################
|
||||
[sandbox]
|
||||
# Sandbox timeout in seconds
|
||||
#timeout = 120
|
||||
|
||||
# Sandbox type (ssh, e2b, local)
|
||||
#box_type = "ssh"
|
||||
|
||||
# Sandbox user ID
|
||||
#user_id = 1000
|
||||
|
||||
# Container image to use for the sandbox
|
||||
#container_image = "ghcr.io/opendevin/sandbox:main"
|
||||
|
||||
# Use host network
|
||||
#use_host_network = false
|
||||
|
||||
# Enable auto linting after editing
|
||||
#enable_auto_lint = false
|
||||
|
||||
#################################### Eval ####################################
|
||||
# Configuration for the evaluation, please refer to the specific evaluation
|
||||
# plugin for the available options
|
||||
##############################################################################
|
||||
@@ -1,11 +1,12 @@
|
||||
# Docker Containers
|
||||
|
||||
Each folder here contains a Dockerfile, and a config.sh describing how to build
|
||||
the image and where to push it. These are images are built and pushed in GitHub Actions
|
||||
the images and where to push them. These images are built and pushed in GitHub Actions
|
||||
by the `ghcr.yml` workflow.
|
||||
|
||||
## Building Manually
|
||||
|
||||
```
|
||||
```bash
|
||||
docker build -f containers/app/Dockerfile -t opendevin .
|
||||
docker build -f containers/sandbox/Dockerfile -t sandbox .
|
||||
```
|
||||
|
||||
@@ -10,7 +10,7 @@ RUN npm ci
|
||||
COPY ./frontend ./
|
||||
RUN npm run make-i18n && npm run build
|
||||
|
||||
FROM python:3.12-slim as backend-builder
|
||||
FROM python:3.12.3-slim as backend-builder
|
||||
|
||||
WORKDIR /app
|
||||
ENV PYTHONPATH '/app'
|
||||
@@ -28,7 +28,7 @@ COPY ./pyproject.toml ./poetry.lock ./
|
||||
RUN touch README.md
|
||||
RUN poetry install --without evaluation --no-root && rm -rf $POETRY_CACHE_DIR
|
||||
|
||||
FROM python:3.12-slim as runtime
|
||||
FROM python:3.12.3-slim as runtime
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
8
containers/app/entrypoint.sh
Executable file → Normal file
8
containers/app/entrypoint.sh
Executable file → Normal file
@@ -22,7 +22,9 @@ if [[ "$SANDBOX_USER_ID" -eq 0 ]]; then
|
||||
echo "Running OpenDevin as root"
|
||||
export RUN_AS_DEVIN=false
|
||||
mkdir -p /root/.cache/ms-playwright/
|
||||
mv /home/opendevin/.cache/ms-playwright/ /root/.cache/
|
||||
if [ -d "/home/opendevin/.cache/ms-playwright/" ]; then
|
||||
mv /home/opendevin/.cache/ms-playwright/ /root/.cache/
|
||||
fi
|
||||
"$@"
|
||||
else
|
||||
echo "Setting up enduser with id $SANDBOX_USER_ID"
|
||||
@@ -52,7 +54,9 @@ else
|
||||
|
||||
mkdir -p /home/enduser/.cache/huggingface/hub/
|
||||
mkdir -p /home/enduser/.cache/ms-playwright/
|
||||
mv /home/opendevin/.cache/ms-playwright/ /home/enduser/.cache/
|
||||
if [ -d "/home/opendevin/.cache/ms-playwright/" ]; then
|
||||
mv /home/opendevin/.cache/ms-playwright/ /home/enduser/.cache/
|
||||
fi
|
||||
|
||||
usermod -aG $DOCKER_SOCKET_GID enduser
|
||||
echo "Running as enduser"
|
||||
|
||||
@@ -3,65 +3,68 @@ set -eo pipefail
|
||||
|
||||
image_name=$1
|
||||
org_name=$2
|
||||
push=0
|
||||
if [[ $3 == "--push" ]]; then
|
||||
push=1
|
||||
fi
|
||||
platform=$3
|
||||
|
||||
echo -e "Building: $image_name"
|
||||
echo "Building: $image_name for platform: $platform"
|
||||
tags=()
|
||||
|
||||
OPEN_DEVIN_BUILD_VERSION="dev"
|
||||
|
||||
cache_tag_base="buildcache"
|
||||
cache_tag="$cache_tag_base"
|
||||
|
||||
if [[ -n $GITHUB_REF_NAME ]]; then
|
||||
# check if ref name is a version number
|
||||
if [[ $GITHUB_REF_NAME =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
major_version=$(echo $GITHUB_REF_NAME | cut -d. -f1)
|
||||
minor_version=$(echo $GITHUB_REF_NAME | cut -d. -f1,2)
|
||||
tags+=($major_version $minor_version)
|
||||
major_version=$(echo "$GITHUB_REF_NAME" | cut -d. -f1)
|
||||
minor_version=$(echo "$GITHUB_REF_NAME" | cut -d. -f1,2)
|
||||
tags+=("$major_version" "$minor_version")
|
||||
tags+=("latest")
|
||||
fi
|
||||
sanitized=$(echo $GITHUB_REF_NAME | sed 's/[^a-zA-Z0-9.-]\+/-/g')
|
||||
sanitized=$(echo "$GITHUB_REF_NAME" | sed 's/[^a-zA-Z0-9.-]\+/-/g')
|
||||
OPEN_DEVIN_BUILD_VERSION=$sanitized
|
||||
cache_tag+="-${sanitized}"
|
||||
tags+=($sanitized)
|
||||
tag=$(echo "$sanitized" | tr '[:upper:]' '[:lower:]') # lower case is required in tagging
|
||||
tags+=("$tag")
|
||||
fi
|
||||
echo "Tags: ${tags[@]}"
|
||||
|
||||
dir=./containers/$image_name
|
||||
if [ ! -f $dir/Dockerfile ]; then
|
||||
if [[ "$image_name" == "opendevin" ]]; then
|
||||
dir="./containers/app"
|
||||
else
|
||||
dir="./containers/$image_name"
|
||||
fi
|
||||
|
||||
if [[ ! -f "$dir/Dockerfile" ]]; then
|
||||
echo "No Dockerfile found"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f $dir/config.sh ]; then
|
||||
if [[ ! -f "$dir/config.sh" ]]; then
|
||||
echo "No config.sh found for Dockerfile"
|
||||
exit 1
|
||||
fi
|
||||
source $dir/config.sh
|
||||
|
||||
source "$dir/config.sh"
|
||||
|
||||
if [[ -n "$org_name" ]]; then
|
||||
DOCKER_ORG="$org_name"
|
||||
fi
|
||||
DOCKER_REPOSITORY=$DOCKER_REGISTRY/$DOCKER_ORG/$DOCKER_IMAGE
|
||||
|
||||
DOCKER_REPOSITORY="$DOCKER_REGISTRY/$DOCKER_ORG/$DOCKER_IMAGE"
|
||||
DOCKER_REPOSITORY=${DOCKER_REPOSITORY,,} # lowercase
|
||||
echo "Repo: $DOCKER_REPOSITORY"
|
||||
echo "Base dir: $DOCKER_BASE_DIR"
|
||||
|
||||
args=""
|
||||
for tag in ${tags[@]}; do
|
||||
for tag in "${tags[@]}"; do
|
||||
args+=" -t $DOCKER_REPOSITORY:$tag"
|
||||
done
|
||||
if [[ $push -eq 1 ]]; then
|
||||
args+=" --push"
|
||||
args+=" --cache-to=type=registry,ref=$DOCKER_REPOSITORY:$cache_tag,mode=max"
|
||||
fi
|
||||
|
||||
output_image="/tmp/${image_name}_image_${platform}.tar"
|
||||
|
||||
docker buildx build \
|
||||
$args \
|
||||
--build-arg OPEN_DEVIN_BUILD_VERSION=$OPEN_DEVIN_BUILD_VERSION \
|
||||
--cache-from=type=registry,ref=$DOCKER_REPOSITORY:$cache_tag \
|
||||
--cache-from=type=registry,ref=$DOCKER_REPOSITORY:$cache_tag_base-main \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--build-arg OPEN_DEVIN_BUILD_VERSION="$OPEN_DEVIN_BUILD_VERSION" \
|
||||
--platform linux/$platform \
|
||||
--provenance=false \
|
||||
-f $dir/Dockerfile $DOCKER_BASE_DIR
|
||||
-f "$dir/Dockerfile" \
|
||||
--output type=docker,dest="$output_image" \
|
||||
"$DOCKER_BASE_DIR"
|
||||
|
||||
echo "${tags[*]}" > tags.txt
|
||||
|
||||
@@ -16,13 +16,11 @@ RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
openssh-server \
|
||||
sudo \
|
||||
bash \
|
||||
gcc \
|
||||
jq \
|
||||
g++ \
|
||||
make \
|
||||
iproute2 \
|
||||
libgl1-mesa-glx \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN mkdir -p -m0755 /var/run/sshd
|
||||
@@ -30,8 +28,17 @@ RUN mkdir -p -m0755 /var/run/sshd
|
||||
# symlink python3 to python
|
||||
RUN ln -s /usr/bin/python3 /usr/bin/python
|
||||
|
||||
# install basic dependencies for CodeActAgent
|
||||
RUN pip3 install --upgrade pip
|
||||
RUN pip3 install jupyterlab notebook jupyter_kernel_gateway flake8
|
||||
# TODO: those dependencies are needed for agentskills, we should pack them in a new sandbox image
|
||||
RUN pip3 install python-docx PyPDF2 python-pptx pylatexenc openai opencv-python
|
||||
# ==== OpenDevin Runtime Client ====
|
||||
RUN mkdir -p /opendevin && mkdir -p /opendevin/logs && chmod 777 /opendevin/logs
|
||||
RUN wget --progress=bar:force -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
|
||||
RUN bash Miniforge3.sh -b -p /opendevin/miniforge3
|
||||
RUN chmod -R g+w /opendevin/miniforge3
|
||||
RUN bash -c ". /opendevin/miniforge3/etc/profile.d/conda.sh && conda config --set changeps1 False && conda config --append channels conda-forge"
|
||||
RUN echo "" > /opendevin/bash.bashrc
|
||||
RUN rm -f Miniforge3.sh
|
||||
|
||||
# - agentskills dependencies
|
||||
RUN /opendevin/miniforge3/bin/pip install --upgrade pip
|
||||
RUN /opendevin/miniforge3/bin/pip install jupyterlab notebook jupyter_kernel_gateway flake8
|
||||
RUN /opendevin/miniforge3/bin/pip install python-docx PyPDF2 python-pptx pylatexenc openai
|
||||
RUN /opendevin/miniforge3/bin/pip install python-dotenv toml termcolor pydantic python-docx pyyaml docker pexpect tenacity e2b browsergym minio
|
||||
|
||||
@@ -8,8 +8,8 @@ const config: Config = {
|
||||
favicon: "img/logo.png",
|
||||
|
||||
// Set the production url of your site here
|
||||
url: "https://OpenDevin.github.io",
|
||||
baseUrl: "/OpenDevin/",
|
||||
url: "https://docs.all-hands.dev",
|
||||
baseUrl: "/",
|
||||
|
||||
// GitHub pages deployment config.
|
||||
organizationName: "OpenDevin",
|
||||
@@ -23,8 +23,13 @@ const config: Config = {
|
||||
// useful metadata like html lang. For example, if your site is Chinese, you
|
||||
// may want to replace "en" with "zh-Hans".
|
||||
i18n: {
|
||||
defaultLocale: "en",
|
||||
locales: ["en"],
|
||||
defaultLocale: 'en',
|
||||
locales: ['en', 'fr', 'zh-Hans'],
|
||||
localeConfigs: {
|
||||
en: {
|
||||
htmlLang: 'en-GB',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
presets: [
|
||||
@@ -78,6 +83,10 @@ const config: Config = {
|
||||
label: "GitHub",
|
||||
position: "right",
|
||||
},
|
||||
{
|
||||
type: 'localeDropdown',
|
||||
position: 'left',
|
||||
},
|
||||
],
|
||||
},
|
||||
prism: {
|
||||
|
||||
406
docs/i18n/fr/code.json
Normal file
406
docs/i18n/fr/code.json
Normal file
@@ -0,0 +1,406 @@
|
||||
{
|
||||
"footer.title": {
|
||||
"message": "OpenDevin"
|
||||
},
|
||||
"footer.docs": {
|
||||
"message": "Documents"
|
||||
},
|
||||
"footer.community": {
|
||||
"message": "Communauté"
|
||||
},
|
||||
"footer.copyright": {
|
||||
"message": "© {year} OpenDevin"
|
||||
},
|
||||
"faq.title": {
|
||||
"message": "Questions Fréquemment Posées",
|
||||
"description": "FAQ Title"
|
||||
},
|
||||
"faq.description": {
|
||||
"message": "Questions Fréquemment Posées"
|
||||
},
|
||||
"faq.section.title.1": {
|
||||
"message": "Qu'est-ce qu'OpenDevin ?",
|
||||
"description": "First Section Title"
|
||||
},
|
||||
"faq.section.highlight": {
|
||||
"message": "OpenDevin",
|
||||
"description": "Highlight Text"
|
||||
},
|
||||
"faq.section.description.1": {
|
||||
"message": "est un ingénieur logiciel autonome qui peut résoudre des tâches d'ingénierie logicielle et de navigation web à tout moment. Il peut exécuter des requêtes en sciences des données, telles que \"Trouver le nombre de demandes de pull à l'repository OpenDevin dans les derniers mois\", et des tâches d'ingénierie logicielle, comme \"Veuillez ajouter des tests à ce fichier et vérifier si tous les tests passent. Si ce n'est pas le cas, réparez le fichier.\"",
|
||||
"description": "Description for OpenDevin"
|
||||
},
|
||||
"faq.section.description.2": {
|
||||
"message": "De plus, OpenDevin est une plateforme et communauté pour les développeurs d'agents qui souhaitent tester et évaluer de nouveaux agents.",
|
||||
"description": "Further Description for OpenDevin"
|
||||
},
|
||||
"faq.section.title.2": {
|
||||
"message": "Support",
|
||||
"description": "Support Section Title"
|
||||
},
|
||||
"faq.section.support.answer": {
|
||||
"message": "Si vous rencontrez un problème que d'autres utilisateurs peuvent également avoir, merci de le signaler sur {githubLink}. Si vous avez des difficultés à l'installation ou des questions générales, rejoignez-vous sur {discordLink} ou {slackLink}.",
|
||||
"description": "Support Answer"
|
||||
},
|
||||
"faq.section.title.3": {
|
||||
"message": "Comment résoudre un problème sur GitHub avec OpenDevin ?",
|
||||
"description": "GitHub Issue Section Title"
|
||||
},
|
||||
"faq.section.github.steps.intro": {
|
||||
"message": "Pour résoudre un problème sur GitHub en utilisant OpenDevin, envoyez une commande à OpenDevin demandant qu'il suit des étapes comme les suivantes :",
|
||||
"description": "GitHub Steps Introduction"
|
||||
},
|
||||
"faq.section.github.step1": {
|
||||
"message": "Lisez l'issue https://github.com/OpenDevin/OpenDevin/issues/1611",
|
||||
"description": "GitHub Step 1"
|
||||
},
|
||||
"faq.section.github.step2": {
|
||||
"message": "Cloner le dépôt et vérifier une nouvelle branche",
|
||||
"description": "GitHub Step 2"
|
||||
},
|
||||
"faq.section.github.step3": {
|
||||
"message": "Sur la base des instructions dans la description de l'issue, modifiez les fichiers pour résoudre le problème",
|
||||
"description": "GitHub Step 3"
|
||||
},
|
||||
"faq.section.github.step4": {
|
||||
"message": "Pousser le résultat à GitHub en utilisant la variable d'environnement GITHUB_TOKEN",
|
||||
"description": "GitHub Step 4"
|
||||
},
|
||||
"faq.section.github.step5": {
|
||||
"message": "Dites-moi le lien que je dois utiliser pour envoyer une demande de pull",
|
||||
"description": "GitHub Step 5"
|
||||
},
|
||||
"faq.section.github.steps.preRun": {
|
||||
"message": "Avant de lancer OpenDevin, vous pouvez faire :",
|
||||
"description": "GitHub Steps Pre-Run"
|
||||
},
|
||||
"faq.section.github.steps.tokenInfo": {
|
||||
"message": "où XXX est un jeton GitHub que vous avez créé et qui a les autorisations pour pousser dans le dépôt OpenDevin. Si vous n'avez pas d'autorisations de modification du dépôt OpenDevin, vous devrez peut-être changer cela en :",
|
||||
"description": "GitHub Steps Token Info"
|
||||
},
|
||||
"faq.section.github.steps.usernameInfo": {
|
||||
"message": "où USERNAME est votre nom GitHub.",
|
||||
"description": "GitHub Steps Username Info"
|
||||
},
|
||||
"faq.section.title.4": {
|
||||
"message": "Comment OpenDevin est-il différent de Devin ?",
|
||||
"description": "Devin Section Title"
|
||||
},
|
||||
"faq.section.devin.linkText": {
|
||||
"message": "Devin",
|
||||
"description": "Devin Link Text"
|
||||
},
|
||||
"faq.section.devin.description": {
|
||||
"message": "est un produit commercial par Cognition Inc., qui a servi d'inspiration initiale pour OpenDevin. Les deux visent à bien faire le travail d'ingénierie logicielle, mais vous pouvez télécharger, utiliser et modifier OpenDevin, tandis que Devin peut être utilisé uniquement via le site de Cognition. De plus, OpenDevin a évolué au-delà de l'inspiration initiale, et est maintenant un écosystème communautaire pour le développement d'agents en général, et nous serions ravis de vous voir rejoindre et",
|
||||
"description": "Devin Description"
|
||||
},
|
||||
"faq.section.devin.contribute": {
|
||||
"message": "contribuer",
|
||||
"description": "Contribute Link"
|
||||
},
|
||||
"faq.section.title.5": {
|
||||
"message": "Comment OpenDevin est-il différent de ChatGPT ?",
|
||||
"description": "ChatGPT Section Title"
|
||||
},
|
||||
"faq.section.chatgpt.description": {
|
||||
"message": "ChatGPT vous pouvez accéder en ligne, il ne se connecte pas aux fichiers locaux et ses capacités d'exécution du code sont limitées. Alors qu'il peut écrire du code, mais c'est difficile à tester ou à exécuter.",
|
||||
"description": "ChatGPT Description"
|
||||
},
|
||||
"homepage.description": {
|
||||
"message": "Génération d'code AI pour l'ingénierie logicielle.",
|
||||
"description": "The homepage description"
|
||||
},
|
||||
"homepage.getStarted": {
|
||||
"message": "Commencer"
|
||||
},
|
||||
"welcome.message": {
|
||||
"message": "Bienvenue à OpenDevin, un système d'IA autonome ingénieur logiciel capable d'exécuter des tâches d'ingénierie complexes et de collaborer activement avec les utilisateurs sur les projets de développement logiciel."
|
||||
},
|
||||
"theme.ErrorPageContent.title": {
|
||||
"message": "Cette page a planté.",
|
||||
"description": "The title of the fallback page when the page crashed"
|
||||
},
|
||||
"theme.BackToTopButton.buttonAriaLabel": {
|
||||
"message": "Retourner en haut de la page",
|
||||
"description": "The ARIA label for the back to top button"
|
||||
},
|
||||
"theme.blog.archive.title": {
|
||||
"message": "Archives",
|
||||
"description": "The page & hero title of the blog archive page"
|
||||
},
|
||||
"theme.blog.archive.description": {
|
||||
"message": "Archives",
|
||||
"description": "The page & hero description of the blog archive page"
|
||||
},
|
||||
"theme.blog.paginator.navAriaLabel": {
|
||||
"message": "Pagination des listes d'articles du blog",
|
||||
"description": "The ARIA label for the blog pagination"
|
||||
},
|
||||
"theme.blog.paginator.newerEntries": {
|
||||
"message": "Nouvelles entrées",
|
||||
"description": "The label used to navigate to the newer blog posts page (previous page)"
|
||||
},
|
||||
"theme.blog.paginator.olderEntries": {
|
||||
"message": "Anciennes entrées",
|
||||
"description": "The label used to navigate to the older blog posts page (next page)"
|
||||
},
|
||||
"theme.blog.post.paginator.navAriaLabel": {
|
||||
"message": "Pagination des articles du blog",
|
||||
"description": "The ARIA label for the blog posts pagination"
|
||||
},
|
||||
"theme.blog.post.paginator.newerPost": {
|
||||
"message": "Article plus récent",
|
||||
"description": "The blog post button label to navigate to the newer/previous post"
|
||||
},
|
||||
"theme.blog.post.paginator.olderPost": {
|
||||
"message": "Article plus ancien",
|
||||
"description": "The blog post button label to navigate to the older/next post"
|
||||
},
|
||||
"theme.blog.post.plurals": {
|
||||
"message": "Un article|{count} articles",
|
||||
"description": "Pluralized label for \"{count} posts\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
|
||||
},
|
||||
"theme.blog.tagTitle": {
|
||||
"message": "{nPosts} tags avec « {tagName} »",
|
||||
"description": "The title of the page for a blog tag"
|
||||
},
|
||||
"theme.tags.tagsPageLink": {
|
||||
"message": "Voir tous les tags",
|
||||
"description": "The label of the link targeting the tag list page"
|
||||
},
|
||||
"theme.colorToggle.ariaLabel": {
|
||||
"message": "Basculer entre le mode sombre et clair (actuellement {mode})",
|
||||
"description": "The ARIA label for the navbar color mode toggle"
|
||||
},
|
||||
"theme.colorToggle.ariaLabel.mode.dark": {
|
||||
"message": "mode sombre",
|
||||
"description": "The name for the dark color mode"
|
||||
},
|
||||
"theme.colorToggle.ariaLabel.mode.light": {
|
||||
"message": "mode clair",
|
||||
"description": "The name for the light color mode"
|
||||
},
|
||||
"theme.docs.breadcrumbs.navAriaLabel": {
|
||||
"message": "Bouton de navigation des liens de la page",
|
||||
"description": "The ARIA label for the breadcrumbs"
|
||||
},
|
||||
"theme.docs.DocCard.categoryDescription.plurals": {
|
||||
"message": "1 élément|{count} éléments",
|
||||
"description": "The default description for a category card in the generated index about how many items this category includes"
|
||||
},
|
||||
"theme.docs.paginator.navAriaLabel": {
|
||||
"message": "Pages de documentation",
|
||||
"description": "The ARIA label for the docs pagination"
|
||||
},
|
||||
"theme.docs.paginator.previous": {
|
||||
"message": "Précédent",
|
||||
"description": "The label used to navigate to the previous doc"
|
||||
},
|
||||
"theme.docs.paginator.next": {
|
||||
"message": "Suivant",
|
||||
"description": "The label used to navigate to the next doc"
|
||||
},
|
||||
"theme.docs.tagDocListPageTitle.nDocsTagged": {
|
||||
"message": "Un document tagué|{count} documents tagués",
|
||||
"description": "Pluralized label for \"{count} docs tagged\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
|
||||
},
|
||||
"theme.docs.tagDocListPageTitle": {
|
||||
"message": "{nDocsTagged} avec \"{tagName}\"",
|
||||
"description": "The title of the page for a docs tag"
|
||||
},
|
||||
"theme.docs.versionBadge.label": {
|
||||
"message": "Version: {versionLabel}"
|
||||
},
|
||||
"theme.docs.versions.unreleasedVersionLabel": {
|
||||
"message": "Ceci est la documentation de la prochaine version {versionLabel} de {siteTitle}.",
|
||||
"description": "The label used to tell the user that he's browsing an unreleased doc version"
|
||||
},
|
||||
"theme.docs.versions.unmaintainedVersionLabel": {
|
||||
"message": "Ceci est la documentation de {siteTitle} {versionLabel}, qui n'est plus activement maintenue.",
|
||||
"description": "The label used to tell the user that he's browsing an unmaintained doc version"
|
||||
},
|
||||
"theme.docs.versions.latestVersionSuggestionLabel": {
|
||||
"message": "Pour une documentation à jour, consultez la {latestVersionLink} ({versionLabel}).",
|
||||
"description": "The label used to tell the user to check the latest version"
|
||||
},
|
||||
"theme.docs.versions.latestVersionLinkLabel": {
|
||||
"message": "dernière version",
|
||||
"description": "The label used for the latest version suggestion link label"
|
||||
},
|
||||
"theme.common.editThisPage": {
|
||||
"message": "Éditer cette page",
|
||||
"description": "The link label to edit the current page"
|
||||
},
|
||||
"theme.common.headingLinkTitle": {
|
||||
"message": "Lien direct vers {heading}",
|
||||
"description": "Title for link to heading"
|
||||
},
|
||||
"theme.lastUpdated.atDate": {
|
||||
"message": " le {date}",
|
||||
"description": "The words used to describe on which date a page has been last updated"
|
||||
},
|
||||
"theme.lastUpdated.byUser": {
|
||||
"message": " par {user}",
|
||||
"description": "The words used to describe by who the page has been last updated"
|
||||
},
|
||||
"theme.lastUpdated.lastUpdatedAtBy": {
|
||||
"message": "Dernière mise à jour{atDate}{byUser}",
|
||||
"description": "The sentence used to display when a page has been last updated, and by who"
|
||||
},
|
||||
"theme.navbar.mobileVersionsDropdown.label": {
|
||||
"message": "Versions",
|
||||
"description": "The label for the navbar versions dropdown on mobile view"
|
||||
},
|
||||
"theme.NotFound.title": {
|
||||
"message": "Page introuvable",
|
||||
"description": "The title of the 404 page"
|
||||
},
|
||||
"theme.tags.tagsListLabel": {
|
||||
"message": "Tags :",
|
||||
"description": "The label alongside a tag list"
|
||||
},
|
||||
"theme.admonition.caution": {
|
||||
"message": "prudence",
|
||||
"description": "The default label used for the Caution admonition (:::caution)"
|
||||
},
|
||||
"theme.admonition.danger": {
|
||||
"message": "danger",
|
||||
"description": "The default label used for the Danger admonition (:::danger)"
|
||||
},
|
||||
"theme.admonition.info": {
|
||||
"message": "information",
|
||||
"description": "The default label used for the Info admonition (:::info)"
|
||||
},
|
||||
"theme.admonition.note": {
|
||||
"message": "remarque",
|
||||
"description": "The default label used for the Note admonition (:::note)"
|
||||
},
|
||||
"theme.admonition.tip": {
|
||||
"message": "astuce",
|
||||
"description": "The default label used for the Tip admonition (:::tip)"
|
||||
},
|
||||
"theme.admonition.warning": {
|
||||
"message": "prudence",
|
||||
"description": "The default label used for the Warning admonition (:::warning)"
|
||||
},
|
||||
"theme.AnnouncementBar.closeButtonAriaLabel": {
|
||||
"message": "Fermer",
|
||||
"description": "The ARIA label for close button of announcement bar"
|
||||
},
|
||||
"theme.blog.sidebar.navAriaLabel": {
|
||||
"message": "Navigation vers les articles récents du blog",
|
||||
"description": "The ARIA label for recent posts in the blog sidebar"
|
||||
},
|
||||
"theme.CodeBlock.copied": {
|
||||
"message": "Copié",
|
||||
"description": "The copied button label on code blocks"
|
||||
},
|
||||
"theme.CodeBlock.copyButtonAriaLabel": {
|
||||
"message": "Copier le code",
|
||||
"description": "The ARIA label for copy code blocks button"
|
||||
},
|
||||
"theme.CodeBlock.copy": {
|
||||
"message": "Copier",
|
||||
"description": "The copy button label on code blocks"
|
||||
},
|
||||
"theme.CodeBlock.wordWrapToggle": {
|
||||
"message": "Activer/désactiver le retour à la ligne",
|
||||
"description": "The title attribute for toggle word wrapping button of code block lines"
|
||||
},
|
||||
"theme.DocSidebarItem.expandCategoryAriaLabel": {
|
||||
"message": "Développer la catégorie '{label}' de la barre latérale",
|
||||
"description": "The ARIA label to expand the sidebar category"
|
||||
},
|
||||
"theme.DocSidebarItem.collapseCategoryAriaLabel": {
|
||||
"message": "Réduire la catégorie '{label}' de la barre latérale",
|
||||
"description": "The ARIA label to collapse the sidebar category"
|
||||
},
|
||||
"theme.NavBar.navAriaLabel": {
|
||||
"message": "Main",
|
||||
"description": "The ARIA label for the main navigation"
|
||||
},
|
||||
"theme.navbar.mobileLanguageDropdown.label": {
|
||||
"message": "Langues",
|
||||
"description": "The label for the mobile language switcher dropdown"
|
||||
},
|
||||
"theme.NotFound.p1": {
|
||||
"message": "Nous n'avons pas trouvé ce que vous recherchez.",
|
||||
"description": "The first paragraph of the 404 page"
|
||||
},
|
||||
"theme.NotFound.p2": {
|
||||
"message": "Veuillez contacter le propriétaire du site qui vous a lié à l'URL d'origine et leur faire savoir que leur lien est cassé.",
|
||||
"description": "The 2nd paragraph of the 404 page"
|
||||
},
|
||||
"theme.TOCCollapsible.toggleButtonLabel": {
|
||||
"message": "Sur cette page",
|
||||
"description": "The label used by the button on the collapsible TOC component"
|
||||
},
|
||||
"theme.blog.post.readMore": {
|
||||
"message": "Lire plus",
|
||||
"description": "The label used in blog post item excerpts to link to full blog posts"
|
||||
},
|
||||
"theme.blog.post.readMoreLabel": {
|
||||
"message": "En savoir plus sur {title}",
|
||||
"description": "The ARIA label for the link to full blog posts from excerpts"
|
||||
},
|
||||
"theme.blog.post.readingTime.plurals": {
|
||||
"message": "Une minute de lecture|{readingTime} minutes de lecture",
|
||||
"description": "Pluralized label for \"{readingTime} min read\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
|
||||
},
|
||||
"theme.docs.breadcrumbs.home": {
|
||||
"message": "Page d'accueil",
|
||||
"description": "The ARIA label for the home page in the breadcrumbs"
|
||||
},
|
||||
"theme.docs.sidebar.collapseButtonTitle": {
|
||||
"message": "Réduire le menu latéral",
|
||||
"description": "The title attribute for collapse button of doc sidebar"
|
||||
},
|
||||
"theme.docs.sidebar.collapseButtonAriaLabel": {
|
||||
"message": "Réduire le menu latérale",
|
||||
"description": "The title attribute for collapse button of doc sidebar"
|
||||
},
|
||||
"theme.docs.sidebar.navAriaLabel": {
|
||||
"message": "Barre de navigation latérale des docs",
|
||||
"description": "The ARIA label for the sidebar navigation"
|
||||
},
|
||||
"theme.docs.sidebar.closeSidebarButtonAriaLabel": {
|
||||
"message": "Fermer la barre de navigation",
|
||||
"description": "The ARIA label for close button of mobile sidebar"
|
||||
},
|
||||
"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel": {
|
||||
"message": "← Retour au menu principal",
|
||||
"description": "The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"
|
||||
},
|
||||
"theme.docs.sidebar.toggleSidebarButtonAriaLabel": {
|
||||
"message": "Ouvrir/fermer la barre de navigation",
|
||||
"description": "The ARIA label for hamburger menu button of mobile navigation"
|
||||
},
|
||||
"theme.docs.sidebar.expandButtonTitle": {
|
||||
"message": "Déplier le menu latéral",
|
||||
"description": "The ARIA label and title attribute for expand button of doc sidebar"
|
||||
},
|
||||
"theme.docs.sidebar.expandButtonAriaLabel": {
|
||||
"message": "Déployer le menu latérale",
|
||||
"description": "The ARIA label and title attribute for expand button of doc sidebar"
|
||||
},
|
||||
"theme.ErrorPageContent.tryAgain": {
|
||||
"message": "Réessayer",
|
||||
"description": "The label of the button to try again rendering when the React error boundary captures an error"
|
||||
},
|
||||
"theme.common.skipToMainContent": {
|
||||
"message": "Aller directement au contenu principal",
|
||||
"description": "The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation"
|
||||
},
|
||||
"theme.tags.tagsPageTitle": {
|
||||
"message": "Tags",
|
||||
"description": "The title of the tag list page"
|
||||
},
|
||||
"theme.unlistedContent.title": {
|
||||
"message": "Page non répertoriée",
|
||||
"description": "The unlisted content banner title"
|
||||
},
|
||||
"theme.unlistedContent.message": {
|
||||
"message": "Cette page n'est pas répertoriée. Les moteurs de recherche ne l'indexeront pas, et seuls les utilisateurs ayant un lien direct peuvent y accéder.",
|
||||
"description": "The unlisted content banner message"
|
||||
}
|
||||
}
|
||||
14
docs/i18n/fr/docusaurus-plugin-content-blog/options.json
Normal file
14
docs/i18n/fr/docusaurus-plugin-content-blog/options.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"title": {
|
||||
"message": "Blog",
|
||||
"description": "The title for the blog used in SEO"
|
||||
},
|
||||
"description": {
|
||||
"message": "Blog",
|
||||
"description": "The description for the blog used in SEO"
|
||||
},
|
||||
"sidebar.title": {
|
||||
"message": "Articles récents",
|
||||
"description": "The label for the left sidebar"
|
||||
}
|
||||
}
|
||||
18
docs/i18n/fr/docusaurus-plugin-content-docs/current.json
Normal file
18
docs/i18n/fr/docusaurus-plugin-content-docs/current.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"version.label": {
|
||||
"message": "Next",
|
||||
"description": "The label for version current"
|
||||
},
|
||||
"sidebar.docsSidebar.category.🤖 Backends LLM": {
|
||||
"message": "🤖 Backends LLM",
|
||||
"description": "The label for category 🤖 Backends LLM in sidebar docsSidebar"
|
||||
},
|
||||
"sidebar.docsSidebar.category.🚧 Dépannage": {
|
||||
"message": "🚧 Dépannage",
|
||||
"description": "The label for category 🚧 Dépannage in sidebar docsSidebar"
|
||||
},
|
||||
"sidebar.apiSidebar.category.Backend": {
|
||||
"message": "Backend",
|
||||
"description": "The label for category Backend in sidebar apiSidebar"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# Documentation Python
|
||||
|
||||
Les documents apparaîtront ici après le déploiement.
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"items": ["python/python"],
|
||||
"label": "Backend",
|
||||
"type": "categorie"
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
sidebar_position: 7
|
||||
---
|
||||
|
||||
# 📚 Divers {#misc}
|
||||
|
||||
## ⭐️ Stratégie de Recherche {#research-strategy}
|
||||
|
||||
La réalisation d'une réplication complète des applications de production avec les LLM est une entreprise complexe. Notre stratégie implique :
|
||||
|
||||
1. **Recherche Technique de Base :** Se concentrer sur la recherche fondamentale pour comprendre et améliorer les aspects techniques de la génération et de la gestion de code.
|
||||
2. **Compétences Spécialisées :** Améliorer l'efficacité des composants de base grâce à la curation des données, aux méthodes de formation, et plus encore.
|
||||
3. **Planification des Tâches :** Développer des capacités pour la détection de bogues, la gestion du code source et l'optimisation.
|
||||
4. **Évaluation :** Établir des métriques d'évaluation complètes pour mieux comprendre et améliorer nos modèles.
|
||||
|
||||
## 🚧 Agent Par Défaut {#default-agent}
|
||||
|
||||
- Notre agent par défaut est actuellement le CodeActAgent, capable de générer du code et de gérer des fichiers. Nous travaillons sur d'autres implémentations d'agents, y compris [SWE Agent](https://swe-agent.com/). Vous pouvez [lire à propos de notre ensemble actuel d'agents ici](./agents).
|
||||
|
||||
## 🤝 Comment Contribuer {#how-to-contribute}
|
||||
|
||||
OpenDevin est un projet communautaire, et nous accueillons les contributions de tout le monde. Que vous soyez développeur, chercheur, ou simplement enthousiaste à l'idée de faire progresser le domaine de l'ingénierie logicielle avec l'IA, il existe de nombreuses façons de vous impliquer :
|
||||
|
||||
- **Contributions de Code :** Aidez-nous à développer les fonctionnalités de base, l'interface frontend ou les solutions de sandboxing.
|
||||
- **Recherche et Évaluation :** Contribuez à notre compréhension des LLM en ingénierie logicielle, participez à l'évaluation des modèles ou suggérez des améliorations.
|
||||
- **Retour d'Information et Tests :** Utilisez l'ensemble d'outils OpenDevin, signalez des bogues, suggérez des fonctionnalités ou fournissez des retours sur l'ergonomie.
|
||||
|
||||
Pour plus de détails, veuillez consulter [ce document](https://github.com/OpenDevin/OpenDevin/blob/main/CONTRIBUTING.md).
|
||||
|
||||
## 🤖 Rejoignez Notre Communauté {#join-our-community}
|
||||
|
||||
Nous avons maintenant à la fois un espace de travail Slack pour la collaboration sur la construction d'OpenDevin et un serveur Discord pour discuter de tout ce qui est lié, par exemple, à ce projet, aux LLM, aux agents, etc.
|
||||
|
||||
- [Espace de travail Slack](https://join.slack.com/t/opendevin/shared_invite/zt-2jsrl32uf-fTeeFjNyNYxqSZt5NPY3fA)
|
||||
- [Serveur Discord](https://discord.gg/ESHStjSjD4)
|
||||
|
||||
Si vous souhaitez contribuer, n'hésitez pas à rejoindre notre communauté. Simplifions l'ingénierie logicielle ensemble !
|
||||
|
||||
🐚 **Codez moins, créez plus avec OpenDevin.**
|
||||
|
||||
[](https://star-history.com/#OpenDevin/OpenDevin&Date)
|
||||
|
||||
## 🛠️ Construit Avec {#built-with}
|
||||
|
||||
OpenDevin est construit en utilisant une combinaison de cadres et de bibliothèques puissants, offrant une base robuste pour son développement. Voici les technologies clés utilisées dans le projet :
|
||||
|
||||
       
|
||||
|
||||
Veuillez noter que la sélection de ces technologies est en cours, et que des technologies supplémentaires peuvent être ajoutées ou des existantes supprimées au fur et à mesure de l'évolution du projet. Nous nous efforçons d'adopter les outils les plus adaptés et efficaces pour améliorer les capacités d'OpenDevin.
|
||||
|
||||
## 📜 Licence {#license}
|
||||
|
||||
Distribué sous la licence MIT. Voir [notre licence](https://github.com/OpenDevin/OpenDevin/blob/main/LICENSE) pour plus d'informations.
|
||||
@@ -0,0 +1,134 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# 🧠 Agents et Capacités
|
||||
|
||||
## Agent CodeAct
|
||||
|
||||
### Description
|
||||
|
||||
Cet agent implémente l'idée CodeAct ([article](https://arxiv.org/abs/2402.01030), [tweet](https://twitter.com/xingyaow_/status/1754556835703751087)) qui consolide les **act**ions des agents LLM en un espace d'action **code** unifié pour à la fois la _simplicité_ et la _performance_ (voir article pour plus de détails).
|
||||
|
||||
L'idée conceptuelle est illustrée ci-dessous. À chaque tour, l'agent peut :
|
||||
|
||||
1. **Converse** : Communiquer avec les humains en langage naturel pour demander des clarifications, des confirmations, etc.
|
||||
2. **CodeAct** : Choisir d'accomplir la tâche en exécutant du code
|
||||
|
||||
- Exécuter toute commande `bash` Linux valide
|
||||
- Exécuter tout code `Python` valide avec [un interpréteur Python interactif](https://ipython.org/). Cela est simulé à travers la commande `bash`, voir le système de plugin ci-dessous pour plus de détails.
|
||||
|
||||

|
||||
|
||||
### Système de Plugin
|
||||
|
||||
Pour rendre l'agent CodeAct plus puissant avec seulement l'accès à l'espace d'action `bash`, l'agent CodeAct exploite le système de plugins d'OpenDevin:
|
||||
|
||||
- [Plugin Jupyter](https://github.com/OpenDevin/OpenDevin/tree/main/opendevin/runtime/plugins/jupyter) : pour l'exécution d'IPython via la commande bash
|
||||
- [Plugin outil agent SWE](https://github.com/OpenDevin/OpenDevin/tree/main/opendevin/runtime/plugins/swe_agent_commands) : Outils de ligne de commande bash puissants pour les tâches de développement logiciel introduits par [swe-agent](https://github.com/princeton-nlp/swe-agent).
|
||||
|
||||
### Démonstration
|
||||
|
||||
https://github.com/OpenDevin/OpenDevin/assets/38853559/f592a192-e86c-4f48-ad31-d69282d5f6ac
|
||||
|
||||
_Exemple de CodeActAgent avec `gpt-4-turbo-2024-04-09` effectuant une tâche de science des données (régression linéaire)_
|
||||
|
||||
### Actions
|
||||
|
||||
`Action`,
|
||||
`CmdRunAction`,
|
||||
`IPythonRunCellAction`,
|
||||
`AgentEchoAction`,
|
||||
`AgentFinishAction`,
|
||||
`AgentTalkAction`
|
||||
|
||||
### Observations
|
||||
|
||||
`CmdOutputObservation`,
|
||||
`IPythonRunCellObservation`,
|
||||
`AgentMessageObservation`,
|
||||
`UserMessageObservation`
|
||||
|
||||
### Méthodes
|
||||
|
||||
| Méthode | Description |
|
||||
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `__init__` | Initialise un agent avec `llm` et une liste de messages `list[Mapping[str, str]]` |
|
||||
| `step` | Effectue une étape en utilisant l'agent CodeAct. Cela inclut la collecte d'informations sur les étapes précédentes et invite le modèle à exécuter une commande. |
|
||||
|
||||
### En cours de réalisation & prochaine étape
|
||||
|
||||
[] Support de la navigation sur le web
|
||||
[] Compléter le workflow pour l'agent CodeAct afin de soumettre des PRs Github
|
||||
|
||||
## Agent Monologue
|
||||
|
||||
### Description
|
||||
|
||||
L'agent Monologue utilise la mémoire à long terme et à court terme pour accomplir des tâches.
|
||||
La mémoire à long terme est stockée en tant qu'objet LongTermMemory et le modèle l'utilise pour rechercher des exemples du passé.
|
||||
La mémoire à court terme est stockée en tant qu'objet Monologue et le modèle peut la condenser si nécessaire.
|
||||
|
||||
### Actions
|
||||
|
||||
`Action`,
|
||||
`NullAction`,
|
||||
`CmdRunAction`,
|
||||
`FileWriteAction`,
|
||||
`FileReadAction`,
|
||||
`BrowseURLAction`,
|
||||
`GithubPushAction`,
|
||||
`AgentThinkAction`
|
||||
|
||||
### Observations
|
||||
|
||||
`Observation`,
|
||||
`NullObservation`,
|
||||
`CmdOutputObservation`,
|
||||
`FileReadObservation`,
|
||||
`BrowserOutputObservation`
|
||||
|
||||
### Méthodes
|
||||
|
||||
| Méthode | Description |
|
||||
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `__init__` | Initialise l'agent avec une mémoire à long terme et un monologue interne |
|
||||
| `_add_event` | Ajoute des événements au monologue de l'agent et condense avec un résumé automatiquement si le monologue est trop long |
|
||||
| `_initialize` | Utilise la liste `INITIAL_THOUGHTS` pour donner à l'agent un contexte pour ses capacités et comment naviguer dans le `/workspace` |
|
||||
| `step` | Modifie l'état actuel en ajoutant les actions et observations les plus récentes, puis invite le modèle à réfléchir à la prochaine action à entreprendre. |
|
||||
|
||||
## Agent Planificateur
|
||||
|
||||
### Description
|
||||
|
||||
L'agent planificateur utilise une stratégie d'incitation spéciale pour créer des plans à long terme pour résoudre les problèmes.
|
||||
L'agent reçoit ses paires action-observation précédentes, la tâche actuelle, et un indice basé sur la dernière action effectuée à chaque étape.
|
||||
|
||||
### Actions
|
||||
|
||||
`NullAction`,
|
||||
`CmdRunAction`,
|
||||
`BrowseURLAction`,
|
||||
`GithubPushAction`,
|
||||
`FileReadAction`,
|
||||
`FileWriteAction`,
|
||||
`AgentThinkAction`,
|
||||
`AgentFinishAction`,
|
||||
`AgentSummarizeAction`,
|
||||
`AddTaskAction`,
|
||||
`ModifyTaskAction`,
|
||||
|
||||
### Observations
|
||||
|
||||
`Observation`,
|
||||
`NullObservation`,
|
||||
`CmdOutputObservation`,
|
||||
`FileReadObservation`,
|
||||
`BrowserOutputObservation`
|
||||
|
||||
### Méthodes
|
||||
|
||||
| Méthode | Description |
|
||||
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `__init__` | Initialise un agent avec `llm` |
|
||||
| `step` | Vérifie si l'étape actuelle est terminée, retourne `AgentFinishAction` si oui. Sinon, crée une incitation de planification et l'envoie au modèle pour inférence, en ajoutant le résultat comme prochaine action. |
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
# 🏛️ Aperçu de l'Architecture Système
|
||||
|
||||
Voici un aperçu de haut niveau de l'architecture du système. Le système est divisé en deux composants principaux : le frontend et le backend. Le frontend est responsable de la gestion des interactions avec l'utilisateur et de l'affichage des résultats. Le backend est responsable de la gestion de la logique métier et de l'exécution des agents.
|
||||
|
||||

|
||||
|
||||
Cet aperçu est simplifié pour montrer les principaux composants et leurs interactions. Pour une vue plus détaillée de l'architecture du backend, consultez la section [Architecture du Backend](#backend-architecture-fr).
|
||||
|
||||
# Architecture du Backend {#backend-architecture-fr}
|
||||
|
||||
_**Avertissement**: L'architecture du backend est en cours de développement et est sujette à modifications. Le schéma suivant montre l'architecture actuelle du backend basée sur le commit indiqué dans le pied de page du schéma._
|
||||
|
||||

|
||||
|
||||
<details>
|
||||
<summary>Mise à jour de ce Schéma</summary>
|
||||
<div>
|
||||
La génération du schéma d'architecture du backend est partiellement automatisée.
|
||||
Le schéma est généré à partir des annotations de type dans le code en utilisant l'outil py2puml.
|
||||
Le schéma est ensuite revu manuellement, ajusté et exporté en PNG et SVG.
|
||||
|
||||
## Prérequis
|
||||
|
||||
- Un environnement Python dans lequel opendevin est exécutable
|
||||
(selon les instructions du fichier README.md à la racine du dépôt)
|
||||
- [py2puml](https://github.com/lucsorel/py2puml) installé
|
||||
|
||||
## Étapes
|
||||
|
||||
1. Générez automatiquement le schéma en exécutant la commande suivante depuis la racine du dépôt :
|
||||
`py2puml opendevin opendevin > docs/architecture/backend_architecture.puml`
|
||||
|
||||
2. Ouvrez le fichier généré dans un éditeur PlantUML, par exemple Visual Studio Code avec l'extension PlantUML ou [PlantText](https://www.planttext.com/)
|
||||
|
||||
3. Révisez le PUML généré et apportez toutes les modifications nécessaires au schéma (ajoutez les parties manquantes, corrigez les erreurs, améliorez l'agencement).
|
||||
_py2puml crée le schéma à partir des annotations de type dans le code, donc les annotations de type manquantes ou incorrectes peuvent entraîner un schéma incomplet ou incorrect._
|
||||
|
||||
4. Examinez la différence entre le nouveau schéma et le précédent et vérifiez manuellement si les modifications sont correctes.
|
||||
_Assurez-vous de ne pas supprimer les parties ajoutées manuellement au schéma par le passé et qui sont toujours pertinentes._
|
||||
|
||||
5. Ajoutez le hash du commit qui a été utilisé pour générer le schéma dans le pied de page du schéma.
|
||||
|
||||
6. Exporte le schéma sous forme de fichiers PNG et SVG et remplacez les schémas existants dans le répertoire `docs/architecture`. Cela peut être fait avec (par exemple [PlantText](https://www.planttext.com/))
|
||||
|
||||
</div>
|
||||
</details>
|
||||
@@ -0,0 +1,107 @@
|
||||
# 💿 Comment Créer un Soutien Docker sur Mesure
|
||||
|
||||
Le sandbox par défaut OpenDevin est équipé d'une configuration ubuntu minimaliste. Votre cas d'utilisation pourrait nécessiter des logiciels installés par défaut. Cet article vous enseignera comment réaliser cela en utilisant une image docker personnalisée.
|
||||
|
||||
## Configuration
|
||||
|
||||
Assurez-vous de pouvoir utiliser OpenDevin en suivant la documentation [Development.md](https://github.com/OpenDevin/OpenDevin/blob/main/Development.md).
|
||||
|
||||
## Créer Votre Image Docker
|
||||
|
||||
Ensuite, vous devez créer votre image docker personnalisée qui doit être basée sur debian/ubuntu. Par exemple, si nous souhaitons que OpenDevin ait accès au "node" binaire, nous utiliserions ce Dockerfile:
|
||||
|
||||
```bash
|
||||
# Commencez avec l'image ubuntu la plus récente
|
||||
FROM ubuntu:latest
|
||||
|
||||
# Effectuez les mises à jour nécessaires
|
||||
RUN apt-get update && apt-get install
|
||||
|
||||
# Installez nodejs
|
||||
RUN apt-get install -y nodejs
|
||||
```
|
||||
|
||||
Ensuite, construisez votre image docker avec le nom de votre choix. Par exemple "image_personnalisée". Pour cela, créez un répertoire et placez le fichier à l'intérieur avec le nom "Dockerfile", puis dans le répertoire exécutez cette commande:
|
||||
|
||||
```bash
|
||||
docker build -t image_personnalisée .
|
||||
```
|
||||
|
||||
Cela produira une nouvelle image appelée ```image_personnalisée``` qui sera disponible dans Docker Engine.
|
||||
|
||||
> Remarque: Dans la configuration décrite ici, OpenDevin va fonctionner en tant que utilisateur "opendevin" à l'intérieur du sandbox et donc tous les packages installés via le Dockerfile seront disponibles pour tous les utilisateurs sur le système, pas seulement root.
|
||||
>
|
||||
> L'installation avec apt-get ci-dessus installe nodejs pour tous les utilisateurs.
|
||||
|
||||
## Spécifiez votre image personnalisée dans le fichier config.toml
|
||||
|
||||
La configuration OpenDevin se fait via le fichier de niveau supérieur ```config.toml``` .
|
||||
Créez un fichier ```config.toml``` dans le répertoire OpenDevin et entrez ces contenus:
|
||||
|
||||
```toml
|
||||
[core]
|
||||
workspace_base="./workspace"
|
||||
persist_sandbox=false
|
||||
run_as_devin=true
|
||||
sandbox_container_image="image_personnalisée"
|
||||
```
|
||||
|
||||
> Assurez-vous que ```sandbox_container_image``` est défini sur le nom de votre image personnalisée précédente.
|
||||
|
||||
## Exécution
|
||||
|
||||
Exécutez OpenDevin en exécutant ```make run``` dans le répertoire racine.
|
||||
|
||||
Naviguez vers ```localhost:3001``` et vérifiez si vos dépendances souhaitées sont disponibles.
|
||||
|
||||
Dans le cas de l'exemple ci-dessus, la commande ```node -v``` dans la console produit ```v18.19.1```
|
||||
|
||||
Félicitations !
|
||||
|
||||
## Explication technique
|
||||
|
||||
Le code pertinent est défini dans [ssh_box.py](https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/runtime/docker/ssh_box.py) et [image_agnostic_util.py](https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/runtime/docker/image_agnostic_util.py).
|
||||
|
||||
En particulier, ssh_box.py vérifie l'objet config pour ```config.sandbox_container_image``` et ensuite tente de récupérer l'image à l'aide de [get_od_sandbox_image](https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/runtime/docker/image_agnostic_util.py#L72), qui est défini dans image_agnostic_util.py.
|
||||
|
||||
Lorsqu'une image personnalisée est utilisée pour la première fois, elle ne sera pas trouvée et donc elle sera construite (à l'exécution ultérieure, l'image construite sera trouvée et renvoyée).
|
||||
|
||||
L'image personnalisée est construite avec [_build_sandbox_image()](https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/runtime/docker/image_agnostic_util.py#L29), qui crée un fichier docker en utilisant votre image personnalisée comme base et configure ensuite l'environnement pour OpenDevin, comme ceci:
|
||||
|
||||
```python
|
||||
dockerfile_content = (
|
||||
f'FROM {base_image}\n'
|
||||
'RUN apt update && apt install -y openssh-server wget sudo\n'
|
||||
'RUN mkdir -p -m0755 /var/run/sshd\n'
|
||||
'RUN mkdir -p /opendevin && mkdir -p /opendevin/logs && chmod 777 /opendevin/logs\n'
|
||||
'RUN wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"\n'
|
||||
'RUN bash Miniforge3-$(uname)-$(uname -m).sh -b -p /opendevin/miniforge3\n'
|
||||
'RUN bash -c ". /opendevin/miniforge3/etc/profile.d/conda.sh && conda config --set changeps1 False && conda config --append channels conda-forge"\n'
|
||||
'RUN echo "export PATH=/opendevin/miniforge3/bin:$PATH" >> ~/.bashrc\n'
|
||||
'RUN echo "export PATH=/opendevin/miniforge3/bin:$PATH" >> /opendevin/bash.bashrc\n'
|
||||
).strip()
|
||||
```
|
||||
|
||||
> Remarque: Le nom de l'image est modifié via [_get_new_image_name()](https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/runtime/docker/image_agnostic_util.py#L63) et c'est ce nom modifié qui sera recherché lors des exécutions ultérieures.
|
||||
|
||||
## Dépannage / Erreurs
|
||||
|
||||
### Erreur: ```useradd: UID 1000 est non unique```
|
||||
Si vous voyez cette erreur dans la sortie de la console, il s'agit du fait que OpenDevin essaie de créer le utilisateur opendevin dans le sandbox avec un ID d'utilisateur de 1000, cependant cet ID d'utilisateur est déjà utilisé dans l'image (pour une raison inconnue). Pour résoudre ce problème, changez la valeur du champ sandbox_user_id dans le fichier config.toml en une valeur différente:
|
||||
|
||||
```toml
|
||||
[core]
|
||||
workspace_base="./workspace"
|
||||
persist_sandbox=false
|
||||
run_as_devin=true
|
||||
sandbox_container_image="image_personnalisée"
|
||||
sandbox_user_id="1001"
|
||||
```
|
||||
|
||||
### Erreurs de port d'utilisation
|
||||
|
||||
Si vous voyez un message d'erreur indiquant que le port est utilisé ou indisponible, essayez de supprimer toutes les containers docker en cours d'exécution (exécutez `docker ps` et `docker rm` des containers concernés) puis ré-exécutez ```make run```
|
||||
|
||||
## Discuter
|
||||
|
||||
Pour d'autres problèmes ou questions rejoignez le [Slack](https://join.slack.com/t/opendevin/shared_invite/zt-2jsrl32uf-fTeeFjNyNYxqSZt5NPY3fA) ou le [Discord](https://discord.gg/ESHStjSjD4) et demandez!
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
---
|
||||
|
||||
# ✅ Fournir des Commentaires
|
||||
|
||||
Lorsque vous utilisez OpenDevin, vous rencontrerez sans aucun doute des cas où les choses fonctionnent bien et d'autres où elles ne fonctionnent pas. Nous vous encourageons à fournir des commentaires lorsque vous utilisez OpenDevin pour aider l'équipe de développement et, peut-être plus important encore, créer un corpus ouvert d'exemples de formation pour les agents de codage -- Partagez-OpenDevin !
|
||||
|
||||
## 📝 Comment Fournir des Commentaires
|
||||
|
||||
Fournir des commentaires est simple ! Lorsque vous utilisez OpenDevin, vous pouvez appuyer sur le bouton de pouce vers le haut ou vers le bas à n'importe quel moment de votre interaction. Vous serez invité à fournir votre adresse email (par exemple, afin que nous puissions vous contacter si nous voulons poser des questions de suivi), et vous pouvez choisir si vous souhaitez fournir des commentaires publiquement ou en privé.
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/5rFx-StMVV0?si=svo7xzp6LhGK_GXr" title="Lecteur vidéo YouTube" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
|
||||
|
||||
## 📜 Licence de Données et Confidentialité
|
||||
|
||||
* Les données **publiques** seront distribuées sous la licence MIT, comme OpenDevin lui-même, et pourront être utilisées par la communauté pour former et tester des modèles. Évidemment, les commentaires que vous pouvez rendre publics seront plus précieux pour la communauté dans son ensemble, donc lorsque vous ne traitez pas d'informations sensibles, nous vous encourageons à choisir cette option !
|
||||
* Les données **privées** ne seront partagées qu'avec l'équipe OpenDevin dans le but d'améliorer OpenDevin.
|
||||
@@ -0,0 +1,111 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# 💻 OpenDevin
|
||||
|
||||
OpenDevin est un **ingénieur logiciel IA autonome** capable d'exécuter des tâches d'ingénierie complexes et de collaborer activement avec les utilisateurs sur des projets de développement logiciel.
|
||||
Ce projet est entièrement open-source, vous pouvez donc l'utiliser et le modifier comme bon vous semble.
|
||||
|
||||
:::tip
|
||||
Explorez le code source d'OpenDevin sur [GitHub](https://github.com/OpenDevin/OpenDevin) ou rejoignez l'une de nos communautés !
|
||||
|
||||
<a href="https://github.com/OpenDevin/OpenDevin/graphs/contributors">
|
||||
<img
|
||||
src="https://img.shields.io/github/contributors/opendevin/opendevin?style=for-the-badge"
|
||||
alt="Contributors"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/OpenDevin/OpenDevin/network/members">
|
||||
<img
|
||||
src="https://img.shields.io/github/forks/opendevin/opendevin?style=for-the-badge"
|
||||
alt="Forks"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/OpenDevin/OpenDevin/stargazers">
|
||||
<img
|
||||
src="https://img.shields.io/github/stars/opendevin/opendevin?style=for-the-badge"
|
||||
alt="Stargazers"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/OpenDevin/OpenDevin/issues">
|
||||
<img
|
||||
src="https://img.shields.io/github/issues/opendevin/opendevin?style=for-the-badge"
|
||||
alt="Issues"
|
||||
/>
|
||||
</a>
|
||||
<br></br>
|
||||
<a href="https://github.com/OpenDevin/OpenDevin/blob/main/LICENSE">
|
||||
<img
|
||||
src="https://img.shields.io/github/license/opendevin/opendevin?style=for-the-badge"
|
||||
alt="MIT License"
|
||||
/>
|
||||
</a>
|
||||
<br></br>
|
||||
<a href="https://join.slack.com/t/opendevin/shared_invite/zt-2jsrl32uf-fTeeFjNyNYxqSZt5NPY3fA">
|
||||
<img
|
||||
src="https://img.shields.io/badge/Slack-Join%20Us-red?logo=slack&logoColor=white&style=for-the-badge"
|
||||
alt="Join our Slack community"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://discord.gg/ESHStjSjD4">
|
||||
<img
|
||||
src="https://img.shields.io/badge/Discord-Join%20Us-purple?logo=discord&logoColor=white&style=for-the-badge"
|
||||
alt="Join our Discord community"
|
||||
/>
|
||||
</a>
|
||||
:::
|
||||
|
||||
## 🛠️ Pour commencer
|
||||
|
||||
La manière la plus simple d'exécuter OpenDevin est à l'intérieur d'un conteneur Docker. Il fonctionne mieux avec la version la plus récente de Docker, `26.0.0`.
|
||||
Vous devez utiliser Linux, Mac OS ou WSL sur Windows.
|
||||
|
||||
Pour démarrer OpenDevin dans un conteneur docker, exécutez les commandes suivantes dans votre terminal :
|
||||
|
||||
:::warning
|
||||
Lorsque vous exécutez la commande suivante, les fichiers dans `./workspace` peuvent être modifiés ou supprimés.
|
||||
:::
|
||||
|
||||
```bash
|
||||
WORKSPACE_BASE=$(pwd)/workspace
|
||||
docker run -it \
|
||||
--pull=always \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e PERSIST_SANDBOX="true" \
|
||||
-e SSH_PASSWORD="make something up here" \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-p 3000:3000 \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
--name opendevin-app-$(date +%Y%m%d%H%M%S) \
|
||||
ghcr.io/opendevin/opendevin:0.6
|
||||
```
|
||||
|
||||
Vous trouverez OpenDevin fonctionnant à l'adresse [http://localhost:3000](http://localhost:3000) avec accès à `./workspace`. Pour qu'OpenDevin fonctionne sur votre code, placez-le dans `./workspace`.
|
||||
|
||||
OpenDevin n'aura accès qu'à ce dossier de workspace. Le reste de votre système ne sera pas affecté car il s'exécute dans un bac à sable sécurisé de docker.
|
||||
|
||||
:::tip
|
||||
Si vous souhaitez utiliser la version **(instable !)** la plus récente, vous pouvez utiliser `ghcr.io/opendevin/opendevin:main` comme image (dernière ligne).
|
||||
:::
|
||||
|
||||
Pour le workflow de développement, consultez [Development.md](https://github.com/OpenDevin/OpenDevin/blob/main/Development.md).
|
||||
|
||||
Avez-vous des problèmes ? Consultez notre [Guide de dépannage](https://docs.all-hands.dev/modules/usage/troubleshooting).
|
||||
|
||||
:::warning
|
||||
OpenDevin est actuellement en cours de développement, mais vous pouvez déjà exécuter la version alpha pour voir le système de bout en bout en action.
|
||||
:::
|
||||
|
||||
[contributors-shield]: https://img.shields.io/github/contributors/opendevin/opendevin?style=for-the-badge
|
||||
[contributors-url]: https://github.com/OpenDevin/OpenDevin/graphs/contributors
|
||||
[forks-shield]: https://img.shields.io/github/forks/opendevin/opendevin?style=for-the-badge
|
||||
[forks-url]: https://github.com/OpenDevin/OpenDevin/network/members
|
||||
[stars-shield]: https://img.shields.io/github/stars/opendevin/opendevin?style=for-the-badge
|
||||
[stars-url]: https://github.com/OpenDevin/OpenDevin/stargazers
|
||||
[issues-shield]: https://img.shields.io/github/issues/opendevin/opendevin?style=for-the-badge
|
||||
[issues-url]: https://github.com/OpenDevin/OpenDevin/issues
|
||||
[license-shield]: https://img.shields.io/github/license/opendevin/opendevin?style=for-the-badge
|
||||
[license-url]: https://github.com/OpenDevin/OpenDevin/blob/main/LICENSE
|
||||
@@ -0,0 +1,37 @@
|
||||
# Azure OpenAI LLM
|
||||
|
||||
## Complétion
|
||||
|
||||
OpenDevin utilise LiteLLM pour les appels de complétion. Vous pouvez trouver leur documentation sur Azure [ici](https://docs.litellm.ai/docs/providers/azure)
|
||||
|
||||
### Configurations openai Azure
|
||||
|
||||
Lors de l'exécution de l'image Docker OpenDevin, vous devrez définir les variables d'environnement suivantes en utilisant `-e` :
|
||||
|
||||
```
|
||||
LLM_BASE_URL="<azure-api-base-url>" # e.g. "https://openai-gpt-4-test-v-1.openai.azure.com/"
|
||||
LLM_API_KEY="<azure-api-key>"
|
||||
LLM_MODEL="azure/<your-gpt-deployment-name>"
|
||||
LLM_API_VERSION = "<api-version>" # e.g. "2024-02-15-preview"
|
||||
```
|
||||
|
||||
:::note
|
||||
Vous pouvez trouver le nom de votre déploiement ChatGPT sur la page des déploiements sur Azure. Par défaut ou initialement, il pourrait être le même que le nom du modèle de chat (par exemple 'GPT4-1106-preview'), mais il n'est pas obligé de l'être. Exécutez OpenDevin, et une fois chargé dans le navigateur, allez dans Paramètres et définissez le modèle comme suit : "azure/<your-actual-gpt-deployment-name>". Si ce n'est pas dans la liste, entrez votre propre texte et enregistrez-le.
|
||||
:::
|
||||
|
||||
## Embeddings
|
||||
|
||||
OpenDevin utilise llama-index pour les embeddings. Vous pouvez trouver leur documentation sur Azure [ici](https://docs.llamaindex.ai/en/stable/api_reference/embeddings/azure_openai/)
|
||||
|
||||
### Configurations openai Azure
|
||||
|
||||
Le modèle utilisé pour les embeddings Azure OpenAI est "text-embedding-ada-002".
|
||||
Vous avez besoin du nom de déploiement correct pour ce modèle dans votre compte Azure.
|
||||
|
||||
Lors de l'exécution d'OpenDevin dans Docker, définissez les variables d'environnement suivantes en utilisant `-e` :
|
||||
|
||||
```
|
||||
LLM_EMBEDDING_MODEL="azureopenai"
|
||||
LLM_EMBEDDING_DEPLOYMENT_NAME = "<your-embedding-deployment-name>" # e.g. "TextEmbedding...<etc>"
|
||||
LLM_API_VERSION = "<api-version>" # e.g. "2024-02-15-preview"
|
||||
```
|
||||
@@ -0,0 +1,28 @@
|
||||
# Google Gemini/Vertex LLM
|
||||
|
||||
## Complétion
|
||||
|
||||
OpenDevin utilise LiteLLM pour les appels de complétion. Les ressources suivantes sont pertinentes pour utiliser OpenDevin avec les LLMs de Google :
|
||||
|
||||
- [Gemini - Google AI Studio](https://docs.litellm.ai/docs/providers/gemini)
|
||||
- [VertexAI - Google Cloud Platform](https://docs.litellm.ai/docs/providers/vertex)
|
||||
|
||||
### Configurations de Gemini - Google AI Studio
|
||||
|
||||
Pour utiliser Gemini via Google AI Studio lors de l'exécution de l'image Docker d'OpenDevin, vous devez définir les variables d'environnement suivantes en utilisant `-e` :
|
||||
|
||||
```
|
||||
GEMINI_API_KEY="<votre-cle-api-google>"
|
||||
LLM_MODEL="gemini/gemini-1.5-pro"
|
||||
```
|
||||
|
||||
### Configurations de Vertex AI - Google Cloud Platform
|
||||
|
||||
Pour utiliser Vertex AI via Google Cloud Platform lors de l'exécution de l'image Docker d'OpenDevin, vous devez définir les variables d'environnement suivantes en utilisant `-e` :
|
||||
|
||||
```
|
||||
GOOGLE_APPLICATION_CREDENTIALS="<dump-json-du-compte-de-service-gcp-json>"
|
||||
VERTEXAI_PROJECT="<votre-id-de-projet-gcp>"
|
||||
VERTEXAI_LOCATION="<votre-localisation-gcp>"
|
||||
LLM_MODEL="vertex_ai/<modele-llm-desire>"
|
||||
```
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# 🤖 Backends LLM
|
||||
|
||||
OpenDevin peut fonctionner avec n'importe quel backend LLM.
|
||||
Pour une liste complète des fournisseurs et des modèles LM disponibles, veuillez consulter la
|
||||
[documentation litellm](https://docs.litellm.ai/docs/providers).
|
||||
|
||||
:::warning
|
||||
OpenDevin émettra de nombreuses invitations au LLM que vous configurez. La plupart de ces LLM coûtent de l'argent -- assurez-vous de définir des limites de dépenses et de surveiller l'utilisation.
|
||||
:::
|
||||
|
||||
La variable d'environnement `LLM_MODEL` contrôle le modèle utilisé dans les interactions programmatiques.
|
||||
Mais en utilisant l'interface utilisateur OpenDevin, vous devrez choisir votre modèle dans la fenêtre des paramètres (la roue dentée en bas à gauche).
|
||||
|
||||
Les variables d'environnement suivantes peuvent être nécessaires pour certains LLM :
|
||||
|
||||
- `LLM_API_KEY`
|
||||
- `LLM_BASE_URL`
|
||||
- `LLM_EMBEDDING_MODEL`
|
||||
- `LLM_EMBEDDING_DEPLOYMENT_NAME`
|
||||
- `LLM_API_VERSION`
|
||||
|
||||
Nous avons quelques guides pour exécuter OpenDevin avec des fournisseurs de modèles spécifiques :
|
||||
|
||||
- [ollama](llms/localLLMs)
|
||||
- [Azure](llms/azureLLMs)
|
||||
|
||||
Si vous utilisez un autre fournisseur, nous vous encourageons à ouvrir une PR pour partager votre configuration !
|
||||
|
||||
## Remarque sur les modèles alternatifs
|
||||
|
||||
Les meilleurs modèles sont GPT-4 et Claude 3. Les modèles locaux et open source actuels ne sont pas aussi puissants.
|
||||
Lors de l'utilisation d'un modèle alternatif, vous pouvez constater des temps d'attente prolongés entre les messages,
|
||||
des réponses de mauvaise qualité ou des erreurs sur des JSON mal formés. OpenDevin
|
||||
ne peut être aussi puissant que les modèles qui le pilotent -- heureusement, les membres de notre équipe travaillent activement à la construction de meilleurs modèles open source !
|
||||
|
||||
## Réessais d'API et limites de taux
|
||||
|
||||
Certains LLM ont des limites de taux et peuvent nécessiter des réessais. OpenDevin réessaiera automatiquement les demandes s'il reçoit une erreur 429 ou une erreur de connexion API.
|
||||
Vous pouvez définir les variables d'environnement `LLM_NUM_RETRIES`, `LLM_RETRY_MIN_WAIT`, `LLM_RETRY_MAX_WAIT` pour contrôler le nombre de réessais et le temps entre les réessais.
|
||||
Par défaut, `LLM_NUM_RETRIES` est 5 et `LLM_RETRY_MIN_WAIT`, `LLM_RETRY_MAX_WAIT` sont respectivement de 3 secondes et 60 secondes.
|
||||
@@ -0,0 +1,141 @@
|
||||
# LLM Local avec Ollama
|
||||
|
||||
Assurez-vous que le serveur Ollama est en cours d'exécution.
|
||||
Pour des instructions détaillées de démarrage, consultez [ici](https://github.com/ollama/ollama)
|
||||
|
||||
Ce guide suppose que vous avez démarré ollama avec `ollama serve`. Si vous exécutez ollama différemment (par exemple, à l'intérieur de docker), les instructions pourraient devoir être modifiées. Veuillez noter que si vous utilisez WSL, la configuration par défaut de ollama bloque les requêtes des conteneurs docker. Voir [ici](#configuring-ollama-service-fr).
|
||||
|
||||
## Télécharger des modèles
|
||||
|
||||
Les noms des modèles Ollama peuvent être trouvés [ici](https://ollama.com/library). Pour un petit exemple, vous pouvez utiliser
|
||||
le modèle `codellama:7b`. Des modèles plus grands offriront généralement de meilleures performances.
|
||||
|
||||
```bash
|
||||
ollama pull codellama:7b
|
||||
```
|
||||
|
||||
vous pouvez vérifier quels modèles vous avez téléchargés de cette manière :
|
||||
|
||||
```bash
|
||||
~$ ollama list
|
||||
NAME ID SIZE MODIFIED
|
||||
codellama:7b 8fdf8f752f6e 3.8 GB 6 weeks ago
|
||||
mistral:7b-instruct-v0.2-q4_K_M eb14864c7427 4.4 GB 2 weeks ago
|
||||
starcoder2:latest f67ae0f64584 1.7 GB 19 hours ago
|
||||
```
|
||||
|
||||
## Démarrer OpenDevin
|
||||
|
||||
### Docker
|
||||
|
||||
Utilisez les instructions [ici](../intro) pour démarrer OpenDevin en utilisant Docker.
|
||||
Mais lors de l'exécution de `docker run`, vous devrez ajouter quelques arguments supplémentaires :
|
||||
|
||||
```bash
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
-e LLM_API_KEY="ollama" \
|
||||
-e LLM_BASE_URL="http://host.docker.internal:11434" \
|
||||
```
|
||||
|
||||
Par exemple :
|
||||
|
||||
```bash
|
||||
# Le répertoire que vous souhaitez qu'OpenDevin modifie. DOIT être un chemin absolu !
|
||||
export WORKSPACE_BASE=$(pwd)/workspace
|
||||
|
||||
docker run \
|
||||
-it \
|
||||
--pull=always \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e LLM_API_KEY="ollama" \
|
||||
-e LLM_BASE_URL="http://host.docker.internal:11434" \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-p 3000:3000 \
|
||||
ghcr.io/opendevin/opendevin:main
|
||||
```
|
||||
|
||||
Vous devriez maintenant pouvoir vous connecter à `http://localhost:3000/`
|
||||
|
||||
### Compiler à partir des sources
|
||||
|
||||
Utilisez les instructions dans [Development.md](https://github.com/OpenDevin/OpenDevin/blob/main/Development.md) pour compiler OpenDevin.
|
||||
Assurez-vous que `config.toml` soit présent en exécutant `make setup-config` qui en créera un pour vous. Dans `config.toml`, saisissez les éléments suivants :
|
||||
|
||||
```
|
||||
LLM_MODEL="ollama/codellama:7b"
|
||||
LLM_API_KEY="ollama"
|
||||
LLM_EMBEDDING_MODEL="local"
|
||||
LLM_BASE_URL="http://localhost:11434"
|
||||
WORKSPACE_BASE="./workspace"
|
||||
WORKSPACE_DIR="$(pwd)/workspace"
|
||||
```
|
||||
|
||||
Remplacez `LLM_MODEL` par celui de votre choix si nécessaire.
|
||||
|
||||
Fini ! Vous pouvez maintenant démarrer Devin avec : `make run` sans Docker. Vous devriez maintenant pouvoir vous connecter à `http://localhost:3000/`
|
||||
|
||||
## Sélection de votre modèle
|
||||
|
||||
Dans l'interface OpenDevin, cliquez sur l'icône des paramètres en bas à gauche.
|
||||
Ensuite, dans l'entrée `Model`, saisissez `ollama/codellama:7b`, ou le nom du modèle que vous avez téléchargé précédemment.
|
||||
S'il n'apparaît pas dans un menu déroulant, ce n'est pas grave, tapez-le simplement. Cliquez sur Enregistrer lorsque vous avez terminé.
|
||||
|
||||
Et maintenant, vous êtes prêt à démarrer !
|
||||
|
||||
## Configuration du service ollama (WSL){#configuring-ollama-service-fr}
|
||||
|
||||
La configuration par défaut pour ollama sous WSL ne sert que localhost. Cela signifie que vous ne pouvez pas l'atteindre depuis un conteneur docker, par exemple, il ne fonctionnera pas avec OpenDevin. Testons d'abord que ollama est en cours d'exécution correctement.
|
||||
|
||||
```bash
|
||||
ollama list # obtenir la liste des modèles installés
|
||||
curl http://localhost:11434/api/generate -d '{"model":"[NAME]","prompt":"hi"}'
|
||||
#ex. curl http://localhost:11434/api/generate -d '{"model":"codellama:7b","prompt":"hi"}'
|
||||
#ex. curl http://localhost:11434/api/generate -d '{"model":"codellama","prompt":"hi"}' #le tag est optionnel s'il n'y en a qu'un seul
|
||||
```
|
||||
|
||||
Une fois cela fait, testez qu'il accepte les requêtes "externes", comme celles provenant d'un conteneur docker.
|
||||
|
||||
```bash
|
||||
docker ps # obtenir la liste des conteneurs docker en cours d'exécution, pour un test le plus précis choisissez le conteneur de sandbox open devin.
|
||||
docker exec [CONTAINER ID] curl http://host.docker.internal:11434/api/generate -d '{"model":"[NAME]","prompt":"hi"}'
|
||||
#ex. docker exec cd9cc82f7a11 curl http://host.docker.internal:11434/api/generate -d '{"model":"codellama","prompt":"hi"}'
|
||||
```
|
||||
|
||||
## Correction
|
||||
|
||||
Maintenant faisons en sorte que cela fonctionne. Modifiez /etc/systemd/system/ollama.service avec les privilèges sudo. (Le chemin peut varier selon la distribution Linux)
|
||||
|
||||
```bash
|
||||
sudo vi /etc/systemd/system/ollama.service
|
||||
```
|
||||
|
||||
ou
|
||||
|
||||
```bash
|
||||
sudo nano /etc/systemd/system/ollama.service
|
||||
```
|
||||
|
||||
Dans la section [Service], ajoutez ces lignes
|
||||
|
||||
```
|
||||
Environment="OLLAMA_HOST=0.0.0.0:11434"
|
||||
Environment="OLLAMA_ORIGINS=*"
|
||||
```
|
||||
|
||||
Ensuite, sauvegardez, rechargez la configuration et redémarrez le service.
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart ollama
|
||||
```
|
||||
|
||||
Enfin, testez que ollama est accessible depuis le conteneur
|
||||
|
||||
```bash
|
||||
ollama list # obtenir la liste des modèles installés
|
||||
docker ps # obtenir la liste des conteneurs docker en cours d'exécution, pour un test le plus précis choisissez le conteneur de sandbox open devin.
|
||||
docker exec [CONTAINER ID] curl http://host.docker.internal:11434/api/generate -d '{"model":"[NAME]","prompt":"hi"}'
|
||||
```
|
||||
@@ -0,0 +1,207 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
---
|
||||
|
||||
# 🚧 Dépannage
|
||||
|
||||
Il existe certains messages d'erreur qui sont souvent signalés par les utilisateurs.
|
||||
|
||||
Nous essaierons de rendre le processus d'installation plus facile et ces messages d'erreur
|
||||
mieux à l'avenir. Mais pour l'instant, vous pouvez rechercher votre message d'erreur ci-dessous et voir s'il existe des solutions de contournement.
|
||||
|
||||
Pour chacun de ces messages d'erreur, **il existe un problème existant**. Veuillez ne pas
|
||||
ouvrir un nouveau problème - commentez simplement dessus.
|
||||
|
||||
Si vous trouvez plus d'informations ou une solution de contournement pour l'un de ces problèmes, veuillez ouvrir un *PR* pour ajouter des détails à ce fichier.
|
||||
|
||||
:::tip
|
||||
Si vous utilisez Windows et que vous rencontrez des problèmes, consultez notre [guide pour les utilisateurs de Windows (WSL)](troubleshooting/windows).
|
||||
:::
|
||||
|
||||
## Impossible de se connecter à Docker
|
||||
|
||||
[Problème GitHub](https://github.com/OpenDevin/OpenDevin/issues/1226)
|
||||
|
||||
### Symptômes
|
||||
|
||||
```bash
|
||||
Erreur lors de la création du contrôleur. Veuillez vérifier que Docker est en cours d'exécution et visitez `https://docs.all-hands.dev/modules/usage/troubleshooting` pour plus d'informations sur le débogage.
|
||||
```
|
||||
|
||||
```bash
|
||||
docker.errors.DockerException: Erreur lors de la récupération de la version de l'API du serveur : ('Connection aborted.', FileNotFoundError(2, 'Aucun fichier ou répertoire de ce type'))
|
||||
```
|
||||
|
||||
### Détails
|
||||
|
||||
OpenDevin utilise un conteneur Docker pour effectuer son travail en toute sécurité, sans risquer de briser votre machine.
|
||||
|
||||
### Solutions de contournement
|
||||
|
||||
* Exécutez `docker ps` pour vous assurer que docker est en cours d'exécution
|
||||
* Assurez-vous que vous n'avez pas besoin de `sudo` pour exécuter docker [voir ici](https://www.baeldung.com/linux/docker-run-without-sudo)
|
||||
* Si vous êtes sur un Mac, vérifiez les [exigences en matière d'autorisations](https://docs.docker.com/desktop/mac/permission-requirements/) et envisagez particulièrement d'activer l'option `Allow the default Docker socket to be used` sous `Settings > Advanced` dans Docker Desktop.
|
||||
* De plus, mettez à jour Docker vers la dernière version sous `Check for Updates`
|
||||
|
||||
## Impossible de se connecter à la boîte SSH
|
||||
|
||||
[Problème GitHub](https://github.com/OpenDevin/OpenDevin/issues/1156)
|
||||
|
||||
### Symptômes
|
||||
|
||||
```python
|
||||
self.shell = DockerSSHBox(
|
||||
...
|
||||
pexpect.pxssh.ExceptionPxssh: Impossible d'établir une connexion avec l'hôte
|
||||
```
|
||||
|
||||
### Détails
|
||||
|
||||
Par défaut, OpenDevin se connecte à un conteneur en cours d'exécution via SSH. Sur certaines machines,
|
||||
en particulier Windows, cela semble échouer.
|
||||
|
||||
### Solutions de contournement
|
||||
|
||||
* Redémarrez votre ordinateur (parfois cela fonctionne)
|
||||
* Assurez-vous d'avoir les dernières versions de WSL et Docker
|
||||
* Vérifiez que votre distribution dans WSL est également à jour
|
||||
* Essayez [ce guide de réinstallation](https://github.com/OpenDevin/OpenDevin/issues/1156#issuecomment-2064549427)
|
||||
|
||||
## Impossible de se connecter à LLM
|
||||
|
||||
[Problème GitHub](https://github.com/OpenDevin/OpenDevin/issues/1208)
|
||||
|
||||
### Symptômes
|
||||
|
||||
```python
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/_exceptions.py", line 81, in __init__
|
||||
super().__init__(message, response.request, body=body)
|
||||
^^^^^^^^^^^^^^^^
|
||||
AttributeError: 'NoneType' object has no attribute 'request'
|
||||
```
|
||||
|
||||
### Détails
|
||||
|
||||
[Problèmes GitHub](https://github.com/OpenDevin/OpenDevin/issues?q=is%3Aissue+is%3Aopen+404)
|
||||
|
||||
Cela se produit généralement avec les configurations de LLM *locales*, lorsque OpenDevin ne parvient pas à se connecter au serveur LLM.
|
||||
Consultez notre guide pour [LLMs locaux](llms/localLLMs) pour plus d'informations.
|
||||
|
||||
### Solutions de contournement
|
||||
|
||||
* Vérifiez votre `base_url` dans votre config.toml (si elle existe) sous la section "llm"
|
||||
* Vérifiez que ollama (ou tout autre LLM que vous utilisez) fonctionne correctement
|
||||
* Assurez-vous d'utiliser `--add-host host.docker.internal:host-gateway` lorsque vous utilisez Docker
|
||||
|
||||
## `404 Ressource non trouvée`
|
||||
|
||||
### Symptômes
|
||||
|
||||
```python
|
||||
Traceback (most recent call last):
|
||||
File "/app/.venv/lib/python3.12/site-packages/litellm/llms/openai.py", line 414, in completion
|
||||
raise e
|
||||
File "/app/.venv/lib/python3.12/site-packages/litellm/llms/openai.py", line 373, in completion
|
||||
response = openai_client.chat.completions.create(**data, timeout=timeout) # type: ignore
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/_utils/_utils.py", line 277, in wrapper
|
||||
return func(*args, **kwargs)
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/resources/chat/completions.py", line 579, in create
|
||||
return self._post(
|
||||
^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1232, in post
|
||||
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 921, in request
|
||||
return self._request(
|
||||
^^^^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1012, in _request
|
||||
raise self._make_status_error_from_response(err.response) from None
|
||||
openai.NotFoundError: Code d'erreur : 404 - {'error': {'code': '404', 'message': 'Ressource non trouvée'}}
|
||||
```
|
||||
|
||||
### Détails
|
||||
|
||||
Cela se produit lorsque LiteLLM (notre bibliothèque pour se connecter à différents fournisseurs de LLM) ne parvient pas à trouver
|
||||
le point de terminaison API avec lequel vous essayez de vous connecter. Cela arrive le plus souvent aux utilisateurs de Azure ou ollama.
|
||||
|
||||
### Solutions de contournement
|
||||
|
||||
* Vérifiez que vous avez correctement défini `LLM_BASE_URL`
|
||||
* Vérifiez que le modèle est correctement défini, en fonction des [docs de LiteLLM](https://docs.litellm.ai/docs/providers)
|
||||
* Si vous êtes en cours d'exécution dans l'interface utilisateur, assurez-vous de définir le `model` dans le modal des paramètres
|
||||
* Si vous êtes en cours d'exécution sans interface (via main.py), assurez-vous de définir `LLM_MODEL` dans votre env/config
|
||||
* Assurez-vous de suivre les instructions spéciales de votre fournisseur de LLM
|
||||
* [ollama](/fr/modules/usage/llms/localLLMs)
|
||||
* [Azure](/fr/modules/usage/llms/azureLLMs)
|
||||
* [Google](/fr/modules/usage/llms/googleLLMs)
|
||||
* Assurez-vous que votre clé API est correcte
|
||||
* Voyez si vous pouvez vous connecter au LLM en utilisant `curl`
|
||||
* Essayez de [vous connecter via LiteLLM directement](https://github.com/BerriAI/litellm) pour tester votre configuration
|
||||
|
||||
## `make build` bloqué sur les installations de packages
|
||||
|
||||
### Symptômes
|
||||
|
||||
Installation de package bloquée sur `En attente...` sans aucun message d'erreur :
|
||||
|
||||
```bash
|
||||
Opérations de package : 286 installations, 0 mises à jour, 0 suppressions
|
||||
|
||||
- Installation de certifi (2024.2.2) : En attente...
|
||||
- Installation de h11 (0.14.0) : En attente...
|
||||
- Installation de idna (3.7) : En attente...
|
||||
- Installation de sniffio (1.3.1) : En attente...
|
||||
- Installation de typing-extensions (4.11.0) : En attente...
|
||||
```
|
||||
|
||||
### Détails
|
||||
|
||||
Dans de rares cas, `make build` peut sembler bloqué sur les installations de packages
|
||||
sans aucun message d'erreur.
|
||||
|
||||
### Solutions de contournement
|
||||
|
||||
* Le gestionnaire de packages Poetry peut manquer d'un paramètre de configuration concernant
|
||||
l'emplacement où doivent être recherchées les informations d'identification (keyring).
|
||||
|
||||
### Solution de contournement
|
||||
|
||||
Tout d'abord, vérifiez avec `env` si une valeur pour `PYTHON_KEYRING_BACKEND` existe.
|
||||
Sinon, exécutez la commande ci-dessous pour la définir à une valeur connue et réessayez la construction :
|
||||
|
||||
```bash
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
```
|
||||
|
||||
## Les sessions ne sont pas restaurées
|
||||
|
||||
### Symptômes
|
||||
|
||||
OpenDevin demande généralement s'il faut reprendre ou commencer une nouvelle session lors de l'ouverture de l'interface utilisateur.
|
||||
Mais cliquer sur "Reprendre" démarre toujours une toute nouvelle discussion.
|
||||
|
||||
### Détails
|
||||
|
||||
Avec une installation standard à ce jour, les données de session sont stockées en mémoire.
|
||||
Actuellement, si le service OpenDevin est redémarré, les sessions précédentes deviennent
|
||||
invalides (un nouveau secret est généré) et donc non récupérables.
|
||||
|
||||
### Solutions de contournement
|
||||
|
||||
* Modifiez la configuration pour rendre les sessions persistantes en éditant le fichier `config.toml`
|
||||
(dans le dossier racine d'OpenDevin) en spécifiant un `file_store` et un
|
||||
`file_store_path` absolu :
|
||||
|
||||
```toml
|
||||
file_store="local"
|
||||
file_store_path="/absolute/path/to/opendevin/cache/directory"
|
||||
```
|
||||
|
||||
* Ajoutez un secret jwt fixe dans votre .bashrc, comme ci-dessous, afin que les id de session précédents
|
||||
restent acceptés.
|
||||
|
||||
```bash
|
||||
EXPORT JWT_SECRET=A_CONST_VALUE
|
||||
```
|
||||
@@ -0,0 +1,76 @@
|
||||
# Notes pour les utilisateurs de Windows et WSL
|
||||
|
||||
OpenDevin ne supporte Windows que via [WSL](https://learn.microsoft.com/en-us/windows/wsl/install).
|
||||
Veuillez vous assurer de lancer toutes les commandes à l'intérieur de votre terminal WSL.
|
||||
|
||||
## Dépannage
|
||||
|
||||
### Erreur : 'docker' n'a pas pu être trouvé dans cette distribution WSL 2.
|
||||
|
||||
Si vous utilisez Docker Desktop, assurez-vous de le démarrer avant d'exécuter toute commande docker depuis l'intérieur de WSL.
|
||||
Docker doit également avoir l'option d'intégration WSL activée.
|
||||
|
||||
### Recommandation : Ne pas exécuter en tant qu'utilisateur root
|
||||
|
||||
Pour des raisons de sécurité, il est fortement recommandé de ne pas exécuter OpenDevin en tant qu'utilisateur root, mais en tant qu'utilisateur avec un UID non nul.
|
||||
De plus, les sandboxes persistants ne seront pas pris en charge lors de l'exécution en tant que root et un message approprié pourrait apparaître lors du démarrage d'OpenDevin.
|
||||
|
||||
Références :
|
||||
|
||||
* [Pourquoi il est mauvais de se connecter en tant que root](https://askubuntu.com/questions/16178/why-is-it-bad-to-log-in-as-root)
|
||||
* [Définir l'utilisateur par défaut dans WSL](https://www.tenforums.com/tutorials/128152-set-default-user-windows-subsystem-linux-distro-windows-10-a.html#option2)
|
||||
Astuce pour la 2e référence : pour les utilisateurs d'Ubuntu, la commande pourrait en fait être "ubuntupreview" au lieu de "ubuntu".
|
||||
|
||||
### Échec de la création de l'utilisateur opendevin
|
||||
|
||||
Si vous rencontrez l'erreur suivante lors de l'installation :
|
||||
|
||||
```sh
|
||||
Exception: Failed to create opendevin user in sandbox: 'useradd: UID 0 is not unique'
|
||||
```
|
||||
|
||||
Vous pouvez la résoudre en exécutant :
|
||||
|
||||
```sh
|
||||
export SANDBOX_USER_ID=1000
|
||||
```
|
||||
|
||||
### Installation de Poetry
|
||||
|
||||
* Si vous rencontrez des problèmes pour exécuter Poetry même après l'avoir installé pendant le processus de construction, il peut être nécessaire d'ajouter son chemin binaire à votre environnement :
|
||||
|
||||
```sh
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
```
|
||||
|
||||
* Si `make build` s'arrête avec une erreur telle que :
|
||||
|
||||
```sh
|
||||
ModuleNotFoundError: no module named <module-name>
|
||||
```
|
||||
|
||||
Cela pourrait être un problème avec le cache de Poetry.
|
||||
Essayez d'exécuter ces 2 commandes l'une après l'autre :
|
||||
|
||||
```sh
|
||||
rm -r ~/.cache/pypoetry
|
||||
make build
|
||||
```
|
||||
|
||||
### L'objet NoneType n'a pas d'attribut 'request'
|
||||
|
||||
Si vous rencontrez des problèmes liés au réseau, tels que `NoneType object has no attribute 'request'` lors de l'exécution de `make run`, il peut être nécessaire de configurer vos paramètres réseau WSL2. Suivez ces étapes :
|
||||
|
||||
* Ouvrez ou créez le fichier `.wslconfig` situé à `C:\Users\%username%\.wslconfig` sur votre machine hôte Windows.
|
||||
* Ajoutez la configuration suivante au fichier `.wslconfig` :
|
||||
|
||||
```sh
|
||||
[wsl2]
|
||||
networkingMode=mirrored
|
||||
localhostForwarding=true
|
||||
```
|
||||
|
||||
* Enregistrez le fichier `.wslconfig`.
|
||||
* Redémarrez WSL2 complètement en quittant toute instance WSL2 en cours d'exécution et en exécutant la commande `wsl --shutdown` dans votre invite de commande ou terminal.
|
||||
* Après avoir redémarré WSL, essayez d'exécuter `make run` à nouveau.
|
||||
Le problème réseau devrait être résolu.
|
||||
26
docs/i18n/fr/docusaurus-theme-classic/navbar.json
Normal file
26
docs/i18n/fr/docusaurus-theme-classic/navbar.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"title": {
|
||||
"message": "OpenDevin",
|
||||
"description": "The title in the navbar"
|
||||
},
|
||||
"logo.alt": {
|
||||
"message": "OpenDevin",
|
||||
"description": "The alt text of navbar logo"
|
||||
},
|
||||
"item.label.Docs": {
|
||||
"message": "Docs",
|
||||
"description": "Navbar item with label Docs"
|
||||
},
|
||||
"item.label.Codebase": {
|
||||
"message": "Codebase",
|
||||
"description": "Navbar item with label Codebase"
|
||||
},
|
||||
"item.label.FAQ": {
|
||||
"message": "FAQ",
|
||||
"description": "Navbar item with label FAQ"
|
||||
},
|
||||
"item.label.GitHub": {
|
||||
"message": "GitHub",
|
||||
"description": "Navbar item with label GitHub"
|
||||
}
|
||||
}
|
||||
406
docs/i18n/zh-Hans/code.json
Normal file
406
docs/i18n/zh-Hans/code.json
Normal file
@@ -0,0 +1,406 @@
|
||||
{
|
||||
"footer.title": {
|
||||
"message": "OpenDevin"
|
||||
},
|
||||
"footer.docs": {
|
||||
"message": "文档"
|
||||
},
|
||||
"footer.community": {
|
||||
"message": "社区"
|
||||
},
|
||||
"footer.copyright": {
|
||||
"message": "版权所有 © {year} OpenDevin"
|
||||
},
|
||||
"faq.title": {
|
||||
"message": "常见问题解答",
|
||||
"description": "FAQ Title"
|
||||
},
|
||||
"faq.description": {
|
||||
"message": "常见问题解答"
|
||||
},
|
||||
"faq.section.title.1": {
|
||||
"message": "什么是OpenDevin?",
|
||||
"description": "First Section Title"
|
||||
},
|
||||
"faq.section.highlight": {
|
||||
"message": "OpenDevin",
|
||||
"description": "Highlight Text"
|
||||
},
|
||||
"faq.section.description.1": {
|
||||
"message": "是一个自主的软件工程师,能够端到端地解决软件工程和网页浏览任务。它能执行数据科学查询,如 \"查找上个月OpenDevin仓库中的拉取请求数量\",还能处理软件工程任务,例如 \"请为这个文件添加测试并验证所有测试都通过,如果没有修复该文件\"。",
|
||||
"description": "Description for OpenDevin"
|
||||
},
|
||||
"faq.section.description.2": {
|
||||
"message": "同时,OpenDevin是一个代理开发者平台和社区,用于测试和评估新代理的环境。",
|
||||
"description": "Further Description for OpenDevin"
|
||||
},
|
||||
"faq.section.title.2": {
|
||||
"message": "支持",
|
||||
"description": "Support Section Title"
|
||||
},
|
||||
"faq.section.support.answer": {
|
||||
"message": "如果您发现了可能影响他人的问题,请在 {githubLink} 上提交一个 bug。如果遇到安装困难或有其他疑问,可以访问 {discordLink} 或 {slackLink} 进行提问。",
|
||||
"description": "Support Answer"
|
||||
},
|
||||
"faq.section.title.3": {
|
||||
"message": "如何使用OpenDevin解决GitHub上的问题?",
|
||||
"description": "GitHub Issue Section Title"
|
||||
},
|
||||
"faq.section.github.steps.intro": {
|
||||
"message": "要通过OpenDevin解决GitHub上的问题,您可以发送一个提示给OpenDevin,请它按照以下步骤操作:",
|
||||
"description": "GitHub Steps Introduction"
|
||||
},
|
||||
"faq.section.github.step1": {
|
||||
"message": "阅读问题 https://github.com/OpenDevin/OpenDevin/issues/1611",
|
||||
"description": "GitHub Step 1"
|
||||
},
|
||||
"faq.section.github.step2": {
|
||||
"message": "克隆仓库并创建新分支",
|
||||
"description": "GitHub Step 2"
|
||||
},
|
||||
"faq.section.github.step3": {
|
||||
"message": "根据问题描述中的说明,修改文件以解决问题",
|
||||
"description": "GitHub Step 3"
|
||||
},
|
||||
"faq.section.github.step4": {
|
||||
"message": "使用GITHUB_TOKEN环境变量将结果推送到GitHub",
|
||||
"description": "GitHub Step 4"
|
||||
},
|
||||
"faq.section.github.step5": {
|
||||
"message": "告诉我需要前往的链接来提交拉取请求",
|
||||
"description": "GitHub Step 5"
|
||||
},
|
||||
"faq.section.github.steps.preRun": {
|
||||
"message": "在运行OpenDevin之前,您可以:",
|
||||
"description": "GitHub Steps Pre-Run"
|
||||
},
|
||||
"faq.section.github.steps.tokenInfo": {
|
||||
"message": "其中XXX是您创建的一个具有对OpenDevin仓库写权限的GitHub令牌。如果您的写入权限不足,请将其更改为:",
|
||||
"description": "GitHub Steps Token Info"
|
||||
},
|
||||
"faq.section.github.steps.usernameInfo": {
|
||||
"message": "其中USERNAME是您的GitHub用户名。",
|
||||
"description": "GitHub Steps Username Info"
|
||||
},
|
||||
"faq.section.title.4": {
|
||||
"message": "OpenDevin与Devin有何不同?",
|
||||
"description": "Devin Section Title"
|
||||
},
|
||||
"faq.section.devin.linkText": {
|
||||
"message": "Devin",
|
||||
"description": "Devin Link Text"
|
||||
},
|
||||
"faq.section.devin.description": {
|
||||
"message": "是由Cognition Inc.开发的商业产品,它最初为OpenDevin提供了灵感。它们都旨在擅长解决软件工程任务,但您可以下载、使用和修改OpenDevin,而Devin只能通过Cognition网站进行访问。此外,OpenDevin已超越最初的灵感,并成为一个面向代理开发者的社区驱动生态系统,在这里我们欢迎您加入并",
|
||||
"description": "Devin Description"
|
||||
},
|
||||
"faq.section.devin.contribute": {
|
||||
"message": "贡献",
|
||||
"description": "Contribute Link"
|
||||
},
|
||||
"faq.section.title.5": {
|
||||
"message": "OpenDevin与ChatGPT有何不同?",
|
||||
"description": "ChatGPT Section Title"
|
||||
},
|
||||
"faq.section.chatgpt.description": {
|
||||
"message": "您可以通过网络访问ChatGPT,它不与本地文件交互,并且其执行代码的能力有限。因此,它可以编写代码,但测试或执行起来可能不太容易。",
|
||||
"description": "ChatGPT Description"
|
||||
},
|
||||
"homepage.description": {
|
||||
"message": "使用AI生成代码的软件工程工具。",
|
||||
"description": "The homepage description"
|
||||
},
|
||||
"homepage.getStarted": {
|
||||
"message": "开始使用"
|
||||
},
|
||||
"welcome.message": {
|
||||
"message": "欢迎来到OpenDevin,这是一个开源自主AI软件工程师,能够执行复杂的工程任务,并积极参与用户在软件开发项目中的协作。"
|
||||
},
|
||||
"theme.ErrorPageContent.title": {
|
||||
"message": "页面已崩溃。",
|
||||
"description": "The title of the fallback page when the page crashed"
|
||||
},
|
||||
"theme.BackToTopButton.buttonAriaLabel": {
|
||||
"message": "返回顶部",
|
||||
"description": "The ARIA label for the back to top button"
|
||||
},
|
||||
"theme.blog.archive.title": {
|
||||
"message": "历史博文",
|
||||
"description": "The page & hero title of the blog archive page"
|
||||
},
|
||||
"theme.blog.archive.description": {
|
||||
"message": "历史博文",
|
||||
"description": "The page & hero description of the blog archive page"
|
||||
},
|
||||
"theme.blog.paginator.navAriaLabel": {
|
||||
"message": "博文列表分页导航",
|
||||
"description": "The ARIA label for the blog pagination"
|
||||
},
|
||||
"theme.blog.paginator.newerEntries": {
|
||||
"message": "较新的博文",
|
||||
"description": "The label used to navigate to the newer blog posts page (previous page)"
|
||||
},
|
||||
"theme.blog.paginator.olderEntries": {
|
||||
"message": "较旧的博文",
|
||||
"description": "The label used to navigate to the older blog posts page (next page)"
|
||||
},
|
||||
"theme.blog.post.paginator.navAriaLabel": {
|
||||
"message": "博文分页导航",
|
||||
"description": "The ARIA label for the blog posts pagination"
|
||||
},
|
||||
"theme.blog.post.paginator.newerPost": {
|
||||
"message": "较新一篇",
|
||||
"description": "The blog post button label to navigate to the newer/previous post"
|
||||
},
|
||||
"theme.blog.post.paginator.olderPost": {
|
||||
"message": "较旧一篇",
|
||||
"description": "The blog post button label to navigate to the older/next post"
|
||||
},
|
||||
"theme.blog.post.plurals": {
|
||||
"message": "{count} 篇博文",
|
||||
"description": "Pluralized label for \"{count} posts\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
|
||||
},
|
||||
"theme.blog.tagTitle": {
|
||||
"message": "{nPosts} 含有标签「{tagName}」",
|
||||
"description": "The title of the page for a blog tag"
|
||||
},
|
||||
"theme.tags.tagsPageLink": {
|
||||
"message": "查看所有标签",
|
||||
"description": "The label of the link targeting the tag list page"
|
||||
},
|
||||
"theme.colorToggle.ariaLabel": {
|
||||
"message": "切换浅色/暗黑模式(当前为{mode})",
|
||||
"description": "The ARIA label for the navbar color mode toggle"
|
||||
},
|
||||
"theme.colorToggle.ariaLabel.mode.dark": {
|
||||
"message": "暗黑模式",
|
||||
"description": "The name for the dark color mode"
|
||||
},
|
||||
"theme.colorToggle.ariaLabel.mode.light": {
|
||||
"message": "浅色模式",
|
||||
"description": "The name for the light color mode"
|
||||
},
|
||||
"theme.docs.breadcrumbs.navAriaLabel": {
|
||||
"message": "页面路径",
|
||||
"description": "The ARIA label for the breadcrumbs"
|
||||
},
|
||||
"theme.docs.DocCard.categoryDescription.plurals": {
|
||||
"message": "{count} 个项目",
|
||||
"description": "The default description for a category card in the generated index about how many items this category includes"
|
||||
},
|
||||
"theme.docs.paginator.navAriaLabel": {
|
||||
"message": "文件选项卡",
|
||||
"description": "The ARIA label for the docs pagination"
|
||||
},
|
||||
"theme.docs.paginator.previous": {
|
||||
"message": "上一页",
|
||||
"description": "The label used to navigate to the previous doc"
|
||||
},
|
||||
"theme.docs.paginator.next": {
|
||||
"message": "下一页",
|
||||
"description": "The label used to navigate to the next doc"
|
||||
},
|
||||
"theme.docs.tagDocListPageTitle.nDocsTagged": {
|
||||
"message": "{count} 篇文档带有标签",
|
||||
"description": "Pluralized label for \"{count} docs tagged\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
|
||||
},
|
||||
"theme.docs.tagDocListPageTitle": {
|
||||
"message": "{nDocsTagged}「{tagName}」",
|
||||
"description": "The title of the page for a docs tag"
|
||||
},
|
||||
"theme.docs.versionBadge.label": {
|
||||
"message": "版本:{versionLabel}"
|
||||
},
|
||||
"theme.docs.versions.unreleasedVersionLabel": {
|
||||
"message": "此为 {siteTitle} {versionLabel} 版尚未发行的文档。",
|
||||
"description": "The label used to tell the user that he's browsing an unreleased doc version"
|
||||
},
|
||||
"theme.docs.versions.unmaintainedVersionLabel": {
|
||||
"message": "此为 {siteTitle} {versionLabel} 版的文档,现已不再积极维护。",
|
||||
"description": "The label used to tell the user that he's browsing an unmaintained doc version"
|
||||
},
|
||||
"theme.docs.versions.latestVersionSuggestionLabel": {
|
||||
"message": "最新的文档请参阅 {latestVersionLink} ({versionLabel})。",
|
||||
"description": "The label used to tell the user to check the latest version"
|
||||
},
|
||||
"theme.docs.versions.latestVersionLinkLabel": {
|
||||
"message": "最新版本",
|
||||
"description": "The label used for the latest version suggestion link label"
|
||||
},
|
||||
"theme.common.editThisPage": {
|
||||
"message": "编辑此页",
|
||||
"description": "The link label to edit the current page"
|
||||
},
|
||||
"theme.common.headingLinkTitle": {
|
||||
"message": "{heading}的直接链接",
|
||||
"description": "Title for link to heading"
|
||||
},
|
||||
"theme.lastUpdated.atDate": {
|
||||
"message": "于 {date} ",
|
||||
"description": "The words used to describe on which date a page has been last updated"
|
||||
},
|
||||
"theme.lastUpdated.byUser": {
|
||||
"message": "由 {user} ",
|
||||
"description": "The words used to describe by who the page has been last updated"
|
||||
},
|
||||
"theme.lastUpdated.lastUpdatedAtBy": {
|
||||
"message": "最后{byUser}{atDate}更新",
|
||||
"description": "The sentence used to display when a page has been last updated, and by who"
|
||||
},
|
||||
"theme.navbar.mobileVersionsDropdown.label": {
|
||||
"message": "选择版本",
|
||||
"description": "The label for the navbar versions dropdown on mobile view"
|
||||
},
|
||||
"theme.NotFound.title": {
|
||||
"message": "找不到页面",
|
||||
"description": "The title of the 404 page"
|
||||
},
|
||||
"theme.tags.tagsListLabel": {
|
||||
"message": "标签:",
|
||||
"description": "The label alongside a tag list"
|
||||
},
|
||||
"theme.admonition.caution": {
|
||||
"message": "警告",
|
||||
"description": "The default label used for the Caution admonition (:::caution)"
|
||||
},
|
||||
"theme.admonition.danger": {
|
||||
"message": "危险",
|
||||
"description": "The default label used for the Danger admonition (:::danger)"
|
||||
},
|
||||
"theme.admonition.info": {
|
||||
"message": "信息",
|
||||
"description": "The default label used for the Info admonition (:::info)"
|
||||
},
|
||||
"theme.admonition.note": {
|
||||
"message": "备注",
|
||||
"description": "The default label used for the Note admonition (:::note)"
|
||||
},
|
||||
"theme.admonition.tip": {
|
||||
"message": "提示",
|
||||
"description": "The default label used for the Tip admonition (:::tip)"
|
||||
},
|
||||
"theme.admonition.warning": {
|
||||
"message": "注意",
|
||||
"description": "The default label used for the Warning admonition (:::warning)"
|
||||
},
|
||||
"theme.AnnouncementBar.closeButtonAriaLabel": {
|
||||
"message": "关闭",
|
||||
"description": "The ARIA label for close button of announcement bar"
|
||||
},
|
||||
"theme.blog.sidebar.navAriaLabel": {
|
||||
"message": "最近博文导航",
|
||||
"description": "The ARIA label for recent posts in the blog sidebar"
|
||||
},
|
||||
"theme.CodeBlock.copied": {
|
||||
"message": "复制成功",
|
||||
"description": "The copied button label on code blocks"
|
||||
},
|
||||
"theme.CodeBlock.copyButtonAriaLabel": {
|
||||
"message": "将代码复制到剪贴板",
|
||||
"description": "The ARIA label for copy code blocks button"
|
||||
},
|
||||
"theme.CodeBlock.copy": {
|
||||
"message": "复制",
|
||||
"description": "The copy button label on code blocks"
|
||||
},
|
||||
"theme.CodeBlock.wordWrapToggle": {
|
||||
"message": "切换自动换行",
|
||||
"description": "The title attribute for toggle word wrapping button of code block lines"
|
||||
},
|
||||
"theme.DocSidebarItem.expandCategoryAriaLabel": {
|
||||
"message": "展开侧边栏分类 '{label}'",
|
||||
"description": "The ARIA label to expand the sidebar category"
|
||||
},
|
||||
"theme.DocSidebarItem.collapseCategoryAriaLabel": {
|
||||
"message": "折叠侧边栏分类 '{label}'",
|
||||
"description": "The ARIA label to collapse the sidebar category"
|
||||
},
|
||||
"theme.NavBar.navAriaLabel": {
|
||||
"message": "主导航",
|
||||
"description": "The ARIA label for the main navigation"
|
||||
},
|
||||
"theme.navbar.mobileLanguageDropdown.label": {
|
||||
"message": "选择语言",
|
||||
"description": "The label for the mobile language switcher dropdown"
|
||||
},
|
||||
"theme.NotFound.p1": {
|
||||
"message": "我们找不到您要找的页面。",
|
||||
"description": "The first paragraph of the 404 page"
|
||||
},
|
||||
"theme.NotFound.p2": {
|
||||
"message": "请联系原始链接来源网站的所有者,并告知他们链接已损坏。",
|
||||
"description": "The 2nd paragraph of the 404 page"
|
||||
},
|
||||
"theme.TOCCollapsible.toggleButtonLabel": {
|
||||
"message": "本页总览",
|
||||
"description": "The label used by the button on the collapsible TOC component"
|
||||
},
|
||||
"theme.blog.post.readMore": {
|
||||
"message": "阅读更多",
|
||||
"description": "The label used in blog post item excerpts to link to full blog posts"
|
||||
},
|
||||
"theme.blog.post.readMoreLabel": {
|
||||
"message": "阅读 {title} 的全文",
|
||||
"description": "The ARIA label for the link to full blog posts from excerpts"
|
||||
},
|
||||
"theme.blog.post.readingTime.plurals": {
|
||||
"message": "阅读需 {readingTime} 分钟",
|
||||
"description": "Pluralized label for \"{readingTime} min read\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
|
||||
},
|
||||
"theme.docs.breadcrumbs.home": {
|
||||
"message": "主页面",
|
||||
"description": "The ARIA label for the home page in the breadcrumbs"
|
||||
},
|
||||
"theme.docs.sidebar.collapseButtonTitle": {
|
||||
"message": "收起侧边栏",
|
||||
"description": "The title attribute for collapse button of doc sidebar"
|
||||
},
|
||||
"theme.docs.sidebar.collapseButtonAriaLabel": {
|
||||
"message": "收起侧边栏",
|
||||
"description": "The title attribute for collapse button of doc sidebar"
|
||||
},
|
||||
"theme.docs.sidebar.navAriaLabel": {
|
||||
"message": "文档侧边栏",
|
||||
"description": "The ARIA label for the sidebar navigation"
|
||||
},
|
||||
"theme.docs.sidebar.closeSidebarButtonAriaLabel": {
|
||||
"message": "关闭导航栏",
|
||||
"description": "The ARIA label for close button of mobile sidebar"
|
||||
},
|
||||
"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel": {
|
||||
"message": "← 回到主菜单",
|
||||
"description": "The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"
|
||||
},
|
||||
"theme.docs.sidebar.toggleSidebarButtonAriaLabel": {
|
||||
"message": "切换导航栏",
|
||||
"description": "The ARIA label for hamburger menu button of mobile navigation"
|
||||
},
|
||||
"theme.docs.sidebar.expandButtonTitle": {
|
||||
"message": "展开侧边栏",
|
||||
"description": "The ARIA label and title attribute for expand button of doc sidebar"
|
||||
},
|
||||
"theme.docs.sidebar.expandButtonAriaLabel": {
|
||||
"message": "展开侧边栏",
|
||||
"description": "The ARIA label and title attribute for expand button of doc sidebar"
|
||||
},
|
||||
"theme.ErrorPageContent.tryAgain": {
|
||||
"message": "重试",
|
||||
"description": "The label of the button to try again rendering when the React error boundary captures an error"
|
||||
},
|
||||
"theme.common.skipToMainContent": {
|
||||
"message": "跳到主要内容",
|
||||
"description": "The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation"
|
||||
},
|
||||
"theme.tags.tagsPageTitle": {
|
||||
"message": "标签",
|
||||
"description": "The title of the tag list page"
|
||||
},
|
||||
"theme.unlistedContent.title": {
|
||||
"message": "未列出页",
|
||||
"description": "The unlisted content banner title"
|
||||
},
|
||||
"theme.unlistedContent.message": {
|
||||
"message": "此页面未列出。搜索引擎不会对其索引,只有拥有直接链接的用户才能访问。",
|
||||
"description": "The unlisted content banner message"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"title": {
|
||||
"message": "博客",
|
||||
"description": "The title for the blog used in SEO"
|
||||
},
|
||||
"description": {
|
||||
"message": "博客",
|
||||
"description": "The description for the blog used in SEO"
|
||||
},
|
||||
"sidebar.title": {
|
||||
"message": "最近文章",
|
||||
"description": "The label for the left sidebar"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"version.label": {
|
||||
"message": "Next",
|
||||
"description": "The label for version current"
|
||||
},
|
||||
"sidebar.docsSidebar.category.🤖 LLM 支持": {
|
||||
"message": "🤖 LLM 支持",
|
||||
"description": "The label for category 🤖 LLM 支持 in sidebar docsSidebar"
|
||||
},
|
||||
"sidebar.docsSidebar.category.🚧 故障排除": {
|
||||
"message": "🚧 故障排除",
|
||||
"description": "The label for category 🚧 故障排除 in sidebar docsSidebar"
|
||||
},
|
||||
"sidebar.apiSidebar.category.Backend": {
|
||||
"message": "Backend",
|
||||
"description": "The label for category Backend in sidebar apiSidebar"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# Python 文档
|
||||
|
||||
部署后文档将会显示在这里。
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"items": ["python/python"],
|
||||
"label": "后端",
|
||||
"type": "category"
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
sidebar_position: 7
|
||||
---
|
||||
|
||||
# 📚 杂项
|
||||
|
||||
## ⭐️ 研究策略
|
||||
|
||||
通过 LLM 完全复制生产级应用程序是一个复杂的任务。我们的策略包含以下几个方面:
|
||||
|
||||
1. **核心技术研究:** 专注于基础研究,以理解和改进代码生成和处理的技术方面。
|
||||
2. **专家能力:** 通过数据策划、训练方法等方式增强核心组件的有效性。
|
||||
3. **任务规划:** 开发错误检测、代码库管理和优化的能力。
|
||||
4. **评价:** 建立全面的评价指标,以更好地理解和改进我们的模型。
|
||||
|
||||
## 🚧 默认代理
|
||||
|
||||
- 我们当前的默认代理是 CodeActAgent,具备生成代码和处理文件的能力。我们正在开发其他代理实现,包括 [SWE Agent](https://swe-agent.com/)。您可以[在这里阅读我们当前的代理集合](./agents)。
|
||||
|
||||
## 🤝 如何贡献
|
||||
|
||||
OpenDevin 是一个社区驱动的项目,我们欢迎每个人的贡献。无论您是开发人员、研究人员,还是对用 AI 提升软件工程领域有兴趣,只要您愿意参与,我们都有很多方式可供选择:
|
||||
|
||||
- **代码贡献:** 帮助我们开发核心功能、前端界面或沙箱解决方案。
|
||||
- **研究和评价:** 贡献您对 LLM 在软件工程领域理解的见解,参与评估模型,或提出改进建议。
|
||||
- **反馈和测试:** 使用 OpenDevin 工具集,报告错误,建议功能,或提供可用性方面的反馈。
|
||||
|
||||
详情请查阅[此文件](https://github.com/OpenDevin/OpenDevin/blob/main/CONTRIBUTING.md)。
|
||||
|
||||
## 🤖 加入我们的社区
|
||||
|
||||
我们现在有一个 Slack 工作区,用于合作建设 OpenDevin,还设有一个 Discord 服务器,用于讨论与该项目、LLM、代理等相关的任何事情。
|
||||
|
||||
- [Slack 工作区](https://join.slack.com/t/opendevin/shared_invite/zt-2jsrl32uf-fTeeFjNyNYxqSZt5NPY3fA)
|
||||
- [Discord 服务器](https://discord.gg/ESHStjSjD4)
|
||||
|
||||
如果您愿意贡献,请随时加入我们的社区。让我们一起简化软件工程!
|
||||
|
||||
🐚 **少写代码,用 OpenDevin 做更多的事情。**
|
||||
|
||||
[](https://star-history.com/#OpenDevin/OpenDevin&Date)
|
||||
|
||||
## 🛠️ 技术选型
|
||||
|
||||
OpenDevin 使用了一系列强大的框架和库,提供了坚实的开发基础。以下是项目中使用的关键技术:
|
||||
|
||||
       
|
||||
|
||||
请注意,这些技术选型仍在进行中,随着项目的发展,可能会添加新的技术或移除现有的技术。我们努力采用最适合、最高效的工具,以增强 OpenDevin 的能力。
|
||||
|
||||
## 📜 许可证
|
||||
|
||||
根据 MIT 许可证分发。详见[我们的许可证](https://github.com/OpenDevin/OpenDevin/blob/main/LICENSE)了解更多信息。
|
||||
@@ -0,0 +1,134 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# 🧠 Agents and Capabilities
|
||||
|
||||
## CodeAct Agent
|
||||
|
||||
### 描述
|
||||
|
||||
该Agent实现了CodeAct的思想([论文](https://arxiv.org/abs/2402.01030),[推特](https://twitter.com/xingyaow_/status/1754556835703751087)),将LLM agents的**行为**合并到一个统一的**代码**动作空间中,以实现_简化_和_性能_(详情见论文)。
|
||||
|
||||
概念理念如下图所示。在每个回合,Agent可以:
|
||||
|
||||
1. **对话**:用自然语言与人类交流,进行澄清、确认等。
|
||||
2. **CodeAct**:选择通过执行代码来完成任务
|
||||
|
||||
- 执行任何有效的Linux `bash`命令
|
||||
- 使用[交互式Python解释器](https://ipython.org/)执行任何有效的 `Python`代码。这是通过`bash`命令模拟的,详细信息请参见插件系统。
|
||||
|
||||

|
||||
|
||||
### 插件系统
|
||||
|
||||
为了使CodeAct agent在仅能访问`bash`动作空间时更强大,CodeAct agent利用了OpenDevin的插件系统:
|
||||
|
||||
- [Jupyter插件](https://github.com/OpenDevin/OpenDevin/tree/main/opendevin/runtime/plugins/jupyter):通过bash命令实现IPython执行
|
||||
- [SWE-agent工具插件](https://github.com/OpenDevin/OpenDevin/tree/main/opendevin/runtime/plugins/swe_agent_commands):为软件开发任务引入的强大bash命令行工具,由[swe-agent](https://github.com/princeton-nlp/swe-agent)提供。
|
||||
|
||||
### 演示
|
||||
|
||||
https://github.com/OpenDevin/OpenDevin/assets/38853559/f592a192-e86c-4f48-ad31-d69282d5f6ac
|
||||
|
||||
_CodeActAgent使用`gpt-4-turbo-2024-04-09`执行数据科学任务(线性回归)的示例_
|
||||
|
||||
### 动作
|
||||
|
||||
`Action`,
|
||||
`CmdRunAction`,
|
||||
`IPythonRunCellAction`,
|
||||
`AgentEchoAction`,
|
||||
`AgentFinishAction`,
|
||||
`AgentTalkAction`
|
||||
|
||||
### 观测
|
||||
|
||||
`CmdOutputObservation`,
|
||||
`IPythonRunCellObservation`,
|
||||
`AgentMessageObservation`,
|
||||
`UserMessageObservation`
|
||||
|
||||
### 方法
|
||||
|
||||
| 方法 | 描述 |
|
||||
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `__init__` | 使用`llm`和一系列信息`list[Mapping[str, str]]`初始化Agent |
|
||||
| `step` | 使用CodeAct Agent执行一步操作,包括收集前一步的信息并提示模型执行命令。 |
|
||||
|
||||
### 进行中的工作 & 下一步
|
||||
|
||||
[] 支持Web浏览
|
||||
[] 完成CodeAct agent提交Github PR的工作流程
|
||||
|
||||
## Monologue Agent
|
||||
|
||||
### 描述
|
||||
|
||||
Monologue Agent利用长短期记忆来完成任务。
|
||||
长期记忆存储为LongTermMemory对象,模型使用它来搜索过去的示例。
|
||||
短期记忆存储为Monologue对象,模型可以根据需要进行压缩。
|
||||
|
||||
### 动作
|
||||
|
||||
`Action`,
|
||||
`NullAction`,
|
||||
`CmdRunAction`,
|
||||
`FileWriteAction`,
|
||||
`FileReadAction`,
|
||||
`BrowseURLAction`,
|
||||
`GithubPushAction`,
|
||||
`AgentThinkAction`
|
||||
|
||||
### 观测
|
||||
|
||||
`Observation`,
|
||||
`NullObservation`,
|
||||
`CmdOutputObservation`,
|
||||
`FileReadObservation`,
|
||||
`BrowserOutputObservation`
|
||||
|
||||
### 方法
|
||||
|
||||
| 方法 | 描述 |
|
||||
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `__init__` | 使用长期记忆和内部独白初始化Agent |
|
||||
| `_add_event` | 将事件附加到Agent的独白中,如独白过长自动与摘要一起压缩 |
|
||||
| `_initialize` | 使用`INITIAL_THOUGHTS`列表为agent提供其能力的上下文以及如何导航`/workspace` |
|
||||
| `step` | 通过添加最近的动作和观测修改当前状态,然后提示模型考虑其接下来的动作。 |
|
||||
|
||||
## Planner Agent
|
||||
|
||||
### 描述
|
||||
|
||||
Planner agent利用特殊的提示策略为解决问题创建长期计划。
|
||||
在每一步中,Agent会获得其先前的动作-观测对、当前任务以及基于上一次操作提供的提示。
|
||||
|
||||
### 动作
|
||||
|
||||
`NullAction`,
|
||||
`CmdRunAction`,
|
||||
`BrowseURLAction`,
|
||||
`GithubPushAction`,
|
||||
`FileReadAction`,
|
||||
`FileWriteAction`,
|
||||
`AgentThinkAction`,
|
||||
`AgentFinishAction`,
|
||||
`AgentSummarizeAction`,
|
||||
`AddTaskAction`,
|
||||
`ModifyTaskAction`
|
||||
|
||||
### 观测
|
||||
|
||||
`Observation`,
|
||||
`NullObservation`,
|
||||
`CmdOutputObservation`,
|
||||
`FileReadObservation`,
|
||||
`BrowserOutputObservation`
|
||||
|
||||
### 方法
|
||||
|
||||
| 方法 | 描述 |
|
||||
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `__init__` | 使用`llm`初始化Agent |
|
||||
| `step` | 检查当前步骤是否完成,如果是则返回`AgentFinishAction`。否则,创建计划提示并发送给模型进行推理,将结果作为下一步动作。 |
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
# 🏛️ 系统架构概览
|
||||
|
||||
这是系统架构的高层概览。系统分为两个主要组件:前端和后端。前端负责处理用户交互并显示结果。后端负责处理业务逻辑并执行代理。
|
||||
|
||||

|
||||
|
||||
此概览简化显示了主要组件及其交互。有关后端架构的更详细视图,请参见[后端架构](#backend-architecture-zh-Hans)部分。
|
||||
|
||||
# 后端架构 {#backend-architecture-zh-Hans}
|
||||
|
||||
_**免责声明**:后端架构正在进行中,可能会有所变化。下图显示了基于图表页脚中的提交内容的当前后端架构。_
|
||||
|
||||

|
||||
|
||||
<details>
|
||||
<summary>更新此图表</summary>
|
||||
<div>
|
||||
后端架构图的生成部分是自动化的。
|
||||
图表是使用 py2puml 工具从代码中的类型提示生成的。
|
||||
然后人工审核、调整并导出为 PNG 和 SVG。
|
||||
|
||||
## 前提条件
|
||||
|
||||
- 能运行 python 环境,其中 opendevin 可以执行(根据存储库根目录中的 README.md 文件中的说明)
|
||||
- 安装了 [py2puml](https://github.com/lucsorel/py2puml)
|
||||
|
||||
## 步骤
|
||||
|
||||
1. 通过从存储库根目录运行以下命令自动生成图表:
|
||||
`py2puml opendevin opendevin > docs/architecture/backend_architecture.puml`
|
||||
|
||||
2. 在 PlantUML 编辑器中打开生成的文件,例如使用 PlantUML 扩展的 Visual Studio Code 或 [PlantText](https://www.planttext.com/)
|
||||
|
||||
3. 审查生成的 PUML 并对图表进行所有必要的调整(添加缺失部分、修正错误、改进定位)。
|
||||
_py2puml 根据代码中的类型提示创建图表,因此缺失或不正确的类型提示可能导致图表不完整或不正确。_
|
||||
|
||||
4. 审查新旧图表之间的差异,并手动检查更改是否正确。
|
||||
_确保不移除过去手动添加到图表中的和仍然相关的部分。_
|
||||
|
||||
5. 将用于生成图表的提交哈希添加到图表页脚。
|
||||
|
||||
6. 将图表导出为 PNG 和 SVG 文件,并替换 `docs/architecture` 目录中的现有图表。这可以通过(例如 [PlantText](https://www.planttext.com/))完成。
|
||||
|
||||
</div>
|
||||
</details>
|
||||
@@ -0,0 +1,107 @@
|
||||
# 💿 如何创建自定义 Docker 沙箱
|
||||
|
||||
默认的 OpenDevin 沙箱包含一个[最小化 ubuntu 配置](https://github.com/OpenDevin/OpenDevin/blob/main/containers/sandbox/Dockerfile)。您的应用场景可能需要在默认状态下安装额外的软件。本指南将教您如何通过使用自定义 Docker 映像来实现这一目标。
|
||||
|
||||
## 环境设置
|
||||
|
||||
确保您能够首先通过 [Development.md](https://github.com/OpenDevin/OpenDevin/blob/main/Development.md) 运行 OpenDevin。
|
||||
|
||||
## 创建您的 Docker 映像
|
||||
|
||||
接下来,您必须创建一个自定义的 Docker 映像,该映像是基于 Debian 或 Ubuntu 的。例如,如果我们希望 OpenDevin 能够访问 "node" 可执行文件,我们可以使用以下 `Dockerfile`:
|
||||
|
||||
```bash
|
||||
# 从最新版 ubuntu 开始
|
||||
FROM ubuntu:latest
|
||||
|
||||
# 运行必要的更新
|
||||
RUN apt-get update && apt-get install
|
||||
|
||||
# 安装 node
|
||||
RUN apt-get install -y nodejs
|
||||
```
|
||||
|
||||
然后构建您选择的映像,例如“custom_image”。为此可以在目录中创建文件夹并将 `Dockerfile` 放入其中,并在该目录内运行以下命令:
|
||||
|
||||
```bash
|
||||
docker build -t custom_image .
|
||||
```
|
||||
|
||||
这将生成一个名为 ```custom_image``` 的新映像,并使其可用于 Docker 服务引擎。
|
||||
|
||||
> 注意:在本文档描述的配置中,OpenDevin 将在沙箱内部以“opendevin”用户身份运行。因此,通过 Dockerfile 安装的所有包应可供系统上的所有用户使用,而不仅仅是 root 用户。
|
||||
|
||||
> 使用 `apt-get` 上面安装的 node 是为所有用户安装的。
|
||||
|
||||
## 在 config.toml 文件中指定自定义映像
|
||||
|
||||
在 OpenDevin 的配置通过顶层的 `config.toml` 文件发生。在 OpenDevin 目录下创建一个 ```config.toml``` 文件,并输入以下内容:
|
||||
|
||||
```
|
||||
[core]
|
||||
workspace_base="./workspace"
|
||||
persist_sandbox=false
|
||||
run_as_devin=true
|
||||
sandbox_container_image="custom_image"
|
||||
```
|
||||
|
||||
> 确保 `sandbox_container_image` 设置为您前一步中自定义映像的名称。
|
||||
|
||||
## 运行
|
||||
|
||||
通过运行 ```make run``` 在顶层目录下运行 OpenDevin。
|
||||
|
||||
导航至 ```localhost:3001``` 并检查所需依赖是否可用。
|
||||
|
||||
在上述示例的情况下,终端中运行 `node -v` 会输出 `v18.19.1`。
|
||||
|
||||
恭喜您!
|
||||
|
||||
## 技术解释
|
||||
|
||||
相关代码定义在 [ssh_box.py](https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/runtime/docker/ssh_box.py) 和 [image_agnostic_util.py](https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/runtime/docker/image_agnostic_util.py) 中。
|
||||
|
||||
特别是 ssh_box.py 检查配置对象中的 ```config.sandbox_container_image```,然后尝试使用 [get_od_sandbox_image](https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/runtime/docker/image_agnostic_util.py#L72),在 image_agnostic_util.py 定义中进行检索。
|
||||
|
||||
初次使用自定义映像时,该映像将不会被找到,因此将被构建(在后续运行中已构建的映像将被查找并返回)。
|
||||
|
||||
自定义映像是通过 `_build_sandbox_image()` 构建的,在 [image_agnostic_util.py](https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/runtime/docker/image_agnostic_util.py#L29) 中,使用您的 custom_image 作为基础,并为 OpenDevin 配置环境。例如:
|
||||
|
||||
```python
|
||||
dockerfile_content = (
|
||||
f'FROM {base_image}\n'
|
||||
'RUN apt update && apt install -y openssh-server wget sudo\n'
|
||||
'RUN mkdir -p -m0755 /var/run/sshd\n'
|
||||
'RUN mkdir -p /opendevin && mkdir -p /opendevin/logs && chmod 777 /opendevin/logs\n'
|
||||
'RUN wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"\n'
|
||||
'RUN bash Miniforge3-$(uname)-$(uname -m).sh -b -p /opendevin/miniforge3\n'
|
||||
'RUN bash -c ". /opendevin/miniforge3/etc/profile.d/conda.sh && conda config --set changeps1 False && conda config --append channels conda-forge"\n'
|
||||
'RUN echo "export PATH=/opendevin/miniforge3/bin:$PATH" >> ~/.bashrc\n'
|
||||
'RUN echo "export PATH=/opendevin/miniforge3/bin:$PATH" >> /opendevin/bash.bashrc\n'
|
||||
).strip()
|
||||
```
|
||||
|
||||
> 注意:映像名称通过 [_get_new_image_name()](https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/runtime/docker/image_agnostic_util.py#L63) 修改,并且是后续运行中搜索的修改后的名称。
|
||||
|
||||
## 故障排除 / 错误
|
||||
|
||||
### 错误:```useradd: UID 1000 is not unique```
|
||||
|
||||
如果在控制台输出中看到此错误,说明 OpenDevin 尝试在沙箱中以 UID 1000 创建 opendevin 用户,但该 UID 已经被映像中的其他部分使用(不知何故)。要解决这个问题,请更改 config.toml 文件中的 sandbox_user_id 字段为不同的值:
|
||||
|
||||
```
|
||||
[core]
|
||||
workspace_base="./workspace"
|
||||
persist_sandbox=false
|
||||
run_as_devin=true
|
||||
sandbox_container_image="custom_image"
|
||||
sandbox_user_id="1001"
|
||||
```
|
||||
|
||||
### 端口使用错误
|
||||
|
||||
如果您看到关于端口被占用或不可用的错误,请尝试删除所有正在运行的 Docker 容器(通过运行 `docker ps` 和 `docker rm` 相关容器),然后重新运行 ```make run```。
|
||||
|
||||
## 讨论
|
||||
|
||||
对于其他问题或疑问,请加入 [Slack](https://join.slack.com/t/opendevin/shared_invite/zt-2jsrl32uf-fTeeFjNyNYxqSZt5NPY3fA) 或 [Discord](https://discord.gg/ESHStjSjD4),并提问!
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
---
|
||||
|
||||
# ✅ 提供反馈
|
||||
|
||||
在使用 OpenDevin 时,你无疑会遇到一些情况,某些地方工作得很好,而另一些地方则可能不尽如人意。我们鼓励你在使用 OpenDevin 时提供反馈,这不仅有助于开发团队改善应用,更为重要的是,可以创建一个开放的编码代理训练样例语料库——Share-OpenDevin!
|
||||
|
||||
## 📝 如何提供反馈
|
||||
|
||||
提供反馈很简单!在使用 OpenDevin 时,你可以在任意时刻按下点赞或点踩按钮。你将被要求提供你的电子邮件地址(例如,以便我们在需要进一步询问时联系你),你可以选择公开或私密地提供反馈。
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/5rFx-StMVV0?si=svo7xzp6LhGK_GXr" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
|
||||
|
||||
## 📜 数据许可与隐私
|
||||
|
||||
* **公开** 数据将与 OpenDevin 本身一样以 MIT 许可协议发布,并可被社区用来训练和测试模型。显然,你能够公开的反馈对整个社区来说更有价值,因此当你不涉及敏感信息时,我们鼓励你选择这个选项!
|
||||
* **私密** 数据将仅与 OpenDevin 团队分享,用于改进 OpenDevin。
|
||||
@@ -0,0 +1,111 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# 💻 OpenDevin
|
||||
|
||||
OpenDevin 是一个**自主 AI 软件工程师**,能够执行复杂的工程任务,并在软件开发项目中积极与用户合作。
|
||||
这个项目是完全开源的,所以你可以随意使用和修改它。
|
||||
|
||||
:::tip
|
||||
在 [GitHub](https://github.com/OpenDevin/OpenDevin) 上探索 OpenDevin 的代码库或加入我们的社区!
|
||||
|
||||
<a href="https://github.com/OpenDevin/OpenDevin/graphs/contributors">
|
||||
<img
|
||||
src="https://img.shields.io/github/contributors/opendevin/opendevin?style=for-the-badge"
|
||||
alt="Contributors"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/OpenDevin/OpenDevin/network/members">
|
||||
<img
|
||||
src="https://img.shields.io/github/forks/opendevin/opendevin?style=for-the-badge"
|
||||
alt="Forks"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/OpenDevin/OpenDevin/stargazers">
|
||||
<img
|
||||
src="https://img.shields.io/github/stars/opendevin/opendevin?style=for-the-badge"
|
||||
alt="Stargazers"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/OpenDevin/OpenDevin/issues">
|
||||
<img
|
||||
src="https://img.shields.io/github/issues/opendevin/opendevin?style=for-the-badge"
|
||||
alt="Issues"
|
||||
/>
|
||||
</a>
|
||||
<br></br>
|
||||
<a href="https://github.com/OpenDevin/OpenDevin/blob/main/LICENSE">
|
||||
<img
|
||||
src="https://img.shields.io/github/license/opendevin/opendevin?style=for-the-badge"
|
||||
alt="MIT License"
|
||||
/>
|
||||
</a>
|
||||
<br></br>
|
||||
<a href="https://join.slack.com/t/opendevin/shared_invite/zt-2jsrl32uf-fTeeFjNyNYxqSZt5NPY3fA">
|
||||
<img
|
||||
src="https://img.shields.io/badge/Slack-Join%20Us-red?logo=slack&logoColor=white&style=for-the-badge"
|
||||
alt="Join our Slack community"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://discord.gg/ESHStjSjD4">
|
||||
<img
|
||||
src="https://img.shields.io/badge/Discord-Join%20Us-purple?logo=discord&logoColor=white&style=for-the-badge"
|
||||
alt="Join our Discord community"
|
||||
/>
|
||||
</a>
|
||||
:::
|
||||
|
||||
## 🛠️ 入门指南
|
||||
|
||||
运行 OpenDevin 最简单的方法是在 Docker 容器中。它在 Docker 的最新版本 `26.0.0` 上运行效果最佳。
|
||||
你必须使用 Linux、Mac OS 或 Windows 上的 WSL。
|
||||
|
||||
要在 Docker 容器中启动 OpenDevin,请在终端中运行以下命令:
|
||||
|
||||
:::warning
|
||||
运行以下命令时,`./workspace` 中的文件可能会被修改或删除。
|
||||
:::
|
||||
|
||||
```bash
|
||||
WORKSPACE_BASE=$(pwd)/workspace
|
||||
docker run -it \
|
||||
--pull=always \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e PERSIST_SANDBOX="true" \
|
||||
-e SSH_PASSWORD="make something up here" \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-p 3000:3000 \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
--name opendevin-app-$(date +%Y%m%d%H%M%S) \
|
||||
ghcr.io/opendevin/opendevin:0.6
|
||||
```
|
||||
|
||||
你会发现 OpenDevin 在 [http://localhost:3000](http://localhost:3000) 运行,并可以访问 `./workspace`。要让 OpenDevin 操作你的代码,请将代码放在 `./workspace` 中。
|
||||
|
||||
OpenDevin 只会访问这个工作区文件夹。它在一个安全的 docker 沙盒中运行,不会影响你系统的其他部分。
|
||||
|
||||
:::tip
|
||||
如果你想使用**(不稳定!)**最新版本,可以使用 `ghcr.io/opendevin/opendevin:main` 作为镜像(最后一行)。
|
||||
:::
|
||||
|
||||
有关开发工作流程,请参阅 [Development.md](https://github.com/OpenDevin/OpenDevin/blob/main/Development.md)。
|
||||
|
||||
遇到问题了吗?查看我们的 [故障排除指南](https://docs.all-hands.dev/modules/usage/troubleshooting)。
|
||||
|
||||
:::warning
|
||||
OpenDevin 目前正在开发中,但你已经可以运行 alpha 版本来查看端到端系统的运作情况。
|
||||
:::
|
||||
|
||||
[contributors-shield]: https://img.shields.io/github/contributors/opendevin/opendevin?style=for-the-badge
|
||||
[contributors-url]: https://github.com/OpenDevin/OpenDevin/graphs/contributors
|
||||
[forks-shield]: https://img.shields.io/github/forks/opendevin/opendevin?style=for-the-badge
|
||||
[forks-url]: https://github.com/OpenDevin/OpenDevin/network/members
|
||||
[stars-shield]: https://img.shields.io/github/stars/opendevin/opendevin?style=for-the-badge
|
||||
[stars-url]: https://github.com/OpenDevin/OpenDevin/stargazers
|
||||
[issues-shield]: https://img.shields.io/github/issues/opendevin/opendevin?style=for-the-badge
|
||||
[issues-url]: https://github.com/OpenDevin/OpenDevin/issues
|
||||
[license-shield]: https://img.shields.io/github/license/opendevin/opendevin?style=for-the-badge
|
||||
[license-url]: https://github.com/OpenDevin/OpenDevin/blob/main/LICENSE
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user