Go to file
Xingyao Wang 1b54800a29 [Agent] Improve edits by adding back edit_file_by_line (#2722)
* add replace-based block edit & preliminary test case fix

* further fix the insert behavior

* make edit only work on first occurence

* bump codeact version since we now use new edit agentskills

* update prompt for new agentskills

* update integration tests

* make run_infer.sh executable

* remove code block for edit_file

* update integration test for prompt changes

* default to not use hint for eval

* fix insert emptyfile bug

* throw value error when `to_replace` is empty

* make `_edit_or_insert_file` return string so we can try to fix some linter errors (best attempt)

* add todo

* update integration test

* fix sandbox test for this PR

* fix inserting with additional newline

* rename to edit_file_by_replace

* add back `edit_file_by_line`

* update prompt for new editing tool

* fix integration tests

* bump codeact version since there are more changes

* add back append file

* fix current line for append

* fix append unit tests

* change the location where we show edited line no to agent and fix tests

* update integration tests

* fix global window size affect by open_file bug

* fix global window size affect by open_file bug

* increase window size to 300

* add file beginning and ending marker to avoid looping

* expand the editor window to better display edit error for model

* refractor to breakdown edit to internal functions

* reduce window to 200

* move window to 100

* refractor to cleanup some logic into _calculate_window_bounds

* fix integration tests

* fix sandbox test on new prompt

* update demonstration with new changes

* fix integration

* initialize llm inside process_instance to circumvent "AttributeError: Can't pickle local object"

* update kwargs

* retry for internal server error

* fix max iteration

* override max iter from config

* fix integration tests

* remove edit file by line

* fix integration tests

* add instruction to avoid hanging

* Revert "add instruction to avoid hanging"

This reverts commit 06fd2c5938.

* handle content policy violation error

* fix integration tests

* fix typo in prompt - the window is 100

* update all integration tests

---------

Co-authored-by: Graham Neubig <neubig@gmail.com>
Co-authored-by: Xingyao Wang <xingyao@all-hands.dev>
2024-07-11 15:30:20 +00:00
2024-03-16 22:46:04 +08:00

Contributors Forks Stargazers Issues MIT License
Join our Slack community Join our Discord community CodeCov
Logo

OpenDevin: Code Less, Make More

Check out the documentation Evaluation Benchmark

Welcome to OpenDevin, a platform for autonomous software engineers, powered by AI and LLMs.

OpenDevin agents collaborate with human developers to write code, fix bugs, and ship features.

App screenshot

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. 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:

Warning

When you run the following command, files in ./workspace may be modified or deleted.

WORKSPACE_BASE=$(pwd)/workspace
docker run -it \
    --pull=always \
    -e SANDBOX_USER_ID=$(id -u) \
    -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

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 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.

Are you having trouble? Check out our Troubleshooting Guide.

🚀 Documentation

To learn more about the project, and for tips on using OpenDevin, check out our documentation.

There you'll find resources on how to use different LLM providers (like ollama and Anthropic's Claude), troubleshooting resources, and advanced configuration options.

🤝 How to Contribute

OpenDevin is a community-driven project, and we welcome contributions from everyone. Whether you're a developer, a researcher, or simply enthusiastic about advancing the field of software engineering with AI, there are many ways to get involved:

  • Code Contributions: Help us develop new agents, core functionality, the frontend and other interfaces, or sandboxing solutions.
  • Research and Evaluation: Contribute to our understanding of LLMs in software engineering, participate in evaluating the models, or suggest improvements.
  • Feedback and Testing: Use the OpenDevin toolset, report bugs, suggest features, or provide feedback on usability.

For details, please check CONTRIBUTING.md.

🤖 Join Our Community

Whether you're a developer, a researcher, or simply enthusiastic about OpenDevin, we'd love to have you in our community. Let's make software engineering better together!

  • Slack workspace - Here we talk about research, architecture, and future development.
  • Discord server - This is a community-run server for general discussion, questions, and feedback.

📈 Progress

Star History Chart

📜 License

Distributed under the MIT License. See LICENSE for more information.

📚 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}
}
Languages
Python 73.9%
TypeScript 24.8%
Jinja 0.6%
JavaScript 0.3%
Makefile 0.1%
Other 0.2%