From 2948089806d4465dc7cae264e0f4951cb6af2230 Mon Sep 17 00:00:00 2001 From: Rita Aleksziev Date: Tue, 19 Nov 2024 14:07:53 +0100 Subject: [PATCH] Read patch generation instructions from file --- .../infrastructure/llm/prompts/patch_gen_instructions.txt | 3 +++ evals/eval_swe_bench.py | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) create mode 100644 cognee/infrastructure/llm/prompts/patch_gen_instructions.txt diff --git a/cognee/infrastructure/llm/prompts/patch_gen_instructions.txt b/cognee/infrastructure/llm/prompts/patch_gen_instructions.txt new file mode 100644 index 000000000..1553753ab --- /dev/null +++ b/cognee/infrastructure/llm/prompts/patch_gen_instructions.txt @@ -0,0 +1,3 @@ +I need you to solve this issue by looking at the provided knowledge graph and +generating a single patch file that I can apply directly to this repository using git apply. +Please respond with a single patch file in the following format. \ No newline at end of file diff --git a/evals/eval_swe_bench.py b/evals/eval_swe_bench.py index c0ab6d67e..e5b8643c1 100644 --- a/evals/eval_swe_bench.py +++ b/evals/eval_swe_bench.py @@ -12,6 +12,7 @@ from cognee.api.v1.cognify.code_graph_pipeline import code_graph_pipeline from cognee.api.v1.search import SearchType from cognee.infrastructure.databases.graph import get_graph_engine from cognee.infrastructure.llm.get_llm_client import get_llm_client +from cognee.infrastructure.llm.prompts import read_query_prompt from evals.eval_utils import download_instances @@ -29,12 +30,7 @@ async def generate_patch_with_cognee(instance, search_type=SearchType.CHUNKS): graph_str = f.read() problem_statement = instance['problem_statement'] - instructions = ( - "I need you to solve this issue by looking at the provided knowledge graph and by " - + "generating a single patch file that I can apply directly to this repository " - + "using git apply. Please respond with a single patch " - + "file in the following format." - ) + instructions = read_query_prompt("patch_gen_instructions.txt") prompt = "\n".join([ instructions,