From a1d521c5e22df9622e6330b305bd278170860b4c Mon Sep 17 00:00:00 2001 From: AI Christianson Date: Wed, 18 Dec 2024 12:29:01 -0500 Subject: [PATCH] improve programmer prompt --- CHANGELOG.md | 1 + ra_aid/llm.py | 3 ++- ra_aid/tools/fuzzy_find.py | 4 +--- ra_aid/tools/programmer.py | 3 +++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee5e82e..472de97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix one shot completion signaling. - Clean up error outputs. - Update prompt for better performance on large/monorepo projects. +- Update programmer prompt so we don't use it to delete files. ## [0.6.2] - Allow shell commands to be run in read-only mode. diff --git a/ra_aid/llm.py b/ra_aid/llm.py index 73f492a..0ad4358 100644 --- a/ra_aid/llm.py +++ b/ra_aid/llm.py @@ -69,7 +69,8 @@ def initialize_expert_llm(provider: str = "openai", model_name: str = "o1-previe elif provider == "anthropic": return ChatAnthropic( api_key=os.getenv("EXPERT_ANTHROPIC_API_KEY"), - model_name=model_name + model_name=model_name, + max_tokens=200000 ) elif provider == "openrouter": return ChatOpenAI( diff --git a/ra_aid/tools/fuzzy_find.py b/ra_aid/tools/fuzzy_find.py index c1457ab..1a1dc6e 100644 --- a/ra_aid/tools/fuzzy_find.py +++ b/ra_aid/tools/fuzzy_find.py @@ -1,8 +1,6 @@ -from pathlib import Path -from typing import List, Tuple, Optional +from typing import List, Tuple import fnmatch from git import Repo -from git.exc import InvalidGitRepositoryError from fuzzywuzzy import process from langchain_core.tools import tool from rich.console import Console diff --git a/ra_aid/tools/programmer.py b/ra_aid/tools/programmer.py index 1f893d0..e5bed51 100644 --- a/ra_aid/tools/programmer.py +++ b/ra_aid/tools/programmer.py @@ -28,6 +28,9 @@ def run_programming_task(input: RunProgrammingTaskInput) -> Dict[str, Union[str, If any new files are created, remember to emit them using the emit_related_files tool once this tool completes. Additionally, before invoking this tool, make sure all existing related files have been emitted using the emit_related_files tool. + + The programmer can add or modify files, but cannot remove them. Use the run_shell_command tool to remove files. + If you need the programmer to reference files you intend to delete, delete them after the programmer finises their work. Args: instructions: Instructions for the programming task