Giter Club home page Giter Club logo

ai-agents-code-editing's Introduction

On The Importance of Reasoning for Context Retrieval in Repository-Level Code Editing

This repository contains the code for the paper "On The Importance of Reasoning for Context Retrieval in Repository-Level Code Editing".

We provide a comprehensive evaluation of the context retrieval task with different reasoning strategies.

This framework can be further extended to evaluate other context retrieval models for code editing.

How to Use

Installation

This project uses poetry for dependency management. To install the dependencies, run:

poetry install

To activate the virtual environment, run:

poetry shell

Quick Start

To run the experiments, use the following command:

export PYTHONPATH=.
export CE_DATA_PATH=cache_dir

python code_editing/scripts/run_agent.py

Our framework uses the hydra library for configuration management. You can customize the configuration by modifying the code_editing/scripts/conf directory.

To run the experiments with a specific configuration, use the following command:

python code_editing/scripts/run_agent.py -cn <config_name> tools=<toolkit> data_source=<data_source>

Available configuration names are:

  • baseline (bm25 retrieval with unmodified query)
  • agent (tool call criterion)
  • agent_cl (context length criterion)
  • agent_sr (self reflection criterion)
  • acr (AutoCodeRover)
  • my_acr (AutoCodeRover with langchain-based retrieval)

In addition, different toolkits and data sources can be specified, such as:

  • retrieval_search (langchain-based retrieval, bm25 by default)
  • acr_toolkit (AST tools from AutoCodeRover)

By default, SWE-Bench_Lite is used as the data source.

For example, to run the experiments with Self-Reflection stopping criterion and AST tools from AutoCodeRover on full SWE-Bench dataset, use the following command:

python code_editing/scripts/run_agent.py -cn agent_sr tools=acr_toolkit data_source=swe_bench data_source.lite=false

More details can be found in the code_editing/scripts/conf and code_editing/configs directories.

Evaluation

To evaluate the results, use the following command:

python code_editing/scripts/evaluate.py input_path=/path/to/inference.jsonl

The evaluation script will output the evaluation metrics for the inference results. To configure the evaluation, modify the code_editing/scripts/conf/evaluation.yaml file.

License

This project is licensed under the MIT License - see the LICENSE file for details.

ai-agents-code-editing's People

Contributors

waleko avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.