(
repo_path: str,
commit: str,
language: str = "python",
clone_dir: str = "data/repos",
save_trajectories_path: Optional[str] = DEFAULT_TRAJECTORIES_PATH,
db_path: Optional[str] = None,
index_path: Optional[str] = "data/indexes",
llm_configs: Optional[dict] = None,
image_name: Optional[str] = DEFAULT_IMAGE_NAME,
)
| 17 | logger = setup_logger() |
| 18 | |
| 19 | def Setup( |
| 20 | repo_path: str, |
| 21 | commit: str, |
| 22 | language: str = "python", |
| 23 | clone_dir: str = "data/repos", |
| 24 | save_trajectories_path: Optional[str] = DEFAULT_TRAJECTORIES_PATH, |
| 25 | db_path: Optional[str] = None, |
| 26 | index_path: Optional[str] = "data/indexes", |
| 27 | llm_configs: Optional[dict] = None, |
| 28 | image_name: Optional[str] = DEFAULT_IMAGE_NAME, |
| 29 | ): |
| 30 | if not os.path.exists(DEFAULT_PATCHES_DIR): |
| 31 | os.makedirs(DEFAULT_PATCHES_DIR) |
| 32 | |
| 33 | # initialize the github repository |
| 34 | gh_token = os.environ.get("GITHUB_TOKEN", None) |
| 35 | is_local, repo_path = check_local_or_remote(repo_path) |
| 36 | repo_dir = clone_repo(repo_path, commit, clone_dir, gh_token, logger) if not is_local else repo_path |
| 37 | repo_dir = os.path.join(os.getcwd(), repo_dir) |
| 38 | |
| 39 | if save_trajectories_path and not os.path.exists(save_trajectories_path): |
| 40 | os.makedirs(save_trajectories_path) |
| 41 | |
| 42 | # Set up the tool kernel |
| 43 | jupyter_executor, docker_executor = initialize_tools(repo_dir, db_path, index_path, language, image_name) |
| 44 | |
| 45 | logger.info("Initialized tools") |
| 46 | # Set up the navigator, executor and generator agent (the system) |
| 47 | summarizer = load_summarizer() |
| 48 | |
| 49 | user_proxy = UserProxyAgent( |
| 50 | name="Admin", |
| 51 | system_message="A human admin. Interact with the planner to discuss the plan to resolve a codebase-related query.", |
| 52 | human_input_mode="ALWAYS", |
| 53 | code_execution_config=False, |
| 54 | default_auto_reply="", |
| 55 | max_consecutive_auto_reply=0 |
| 56 | ) |
| 57 | |
| 58 | navigator = load_agent_navigator( |
| 59 | llm_configs["nav"], |
| 60 | jupyter_executor, |
| 61 | system_nav, |
| 62 | summarizer |
| 63 | ) |
| 64 | |
| 65 | editor = load_agent_editor( |
| 66 | llm_configs["edit"], |
| 67 | jupyter_executor, |
| 68 | system_edit, |
| 69 | repo_dir |
| 70 | ) |
| 71 | |
| 72 | executor = load_agent_executor( |
| 73 | llm_configs["exec"], |
| 74 | docker_executor, |
| 75 | system_exec, |
| 76 | summarizer |
no test coverage detected