From 0fd1388c31ddfbe21ea4663168ed276bba42b6de Mon Sep 17 00:00:00 2001 From: James Vorderbruggen Date: Mon, 29 Jul 2024 20:58:05 -0500 Subject: [PATCH] Use a more capable LLM and modify prompts a bit. --- assets/test_class.py | 13 ------------- main.py | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 17 deletions(-) delete mode 100644 assets/test_class.py diff --git a/assets/test_class.py b/assets/test_class.py deleted file mode 100644 index f2cfe3a..0000000 --- a/assets/test_class.py +++ /dev/null @@ -1,13 +0,0 @@ -class ExampleClass(object): - - def __init__(self, x: int, y: int) -> None: - pass - - def add(self) -> int: - pass - - def distance(self, neighbor: "ExampleClass") -> int: - pass - - def multiply(self) -> int: - pass \ No newline at end of file diff --git a/main.py b/main.py index 192cd19..7531939 100644 --- a/main.py +++ b/main.py @@ -31,7 +31,10 @@ def chat( Do not say 'here is the python code' Do not surround your response with quotes or backticks. DO NOT EVER USE ``` in your output. + You should maintain any comments that were provided in the class skeleton. + You should maintain the exact method signatures provided in the class skeleton. Your output MUST be valid, runnable python code and NOTHING else. + Your output MUST NOT include any usage of testing tools like unittest, pytest, mock, etc. {code_gen_agent.class_skeleton} """ ) @@ -51,8 +54,11 @@ def chat( prompt=f""" You are an expert at interpreting the results of unit tests, and providing insight into what they mean. You should be descriptive about what variables are incorrect, and in what way. - You should include information about which methods should be modified, and in what way. - You should generally not provide code. + You should include information about which methods should be modified, and in what way (without providing code.) + You should not provide code. + You should NEVER attempt to modify the tests, or give advice to modify the tests. + Give results in a bulleted list, with one bullet for each method that fails tests. + Keep insights very brief, providing a maximum of 3 sentences about each method that failed a test. Please provide insights about the following test results: {test_interpreter.latest_test_results} Those results were produced by the following code: @@ -65,7 +71,7 @@ def chat( code_attempt = code_gen_agent.respond( prompt=f""" You are an expert at writing Python code. - Consider the following code, and test results. + Consider the following code, and the following test results. Here is the code: {code_gen_agent.previous_code_attempt} Here are the test results: @@ -80,7 +86,10 @@ def chat( Do not surround your response with quotes or backticks. DO NOT EVER USE ``` in your output. Your response should NEVER start or end with ``` + You should maintain any comments that were provided in the code. + You should maintain the exact method signatures provided in the code. Your output MUST be valid, runnable python code and NOTHING else. + Your output MUST NOT include any usage of testing tools like unittest, pytest, mock, etc. """ ) if not solved: @@ -126,7 +135,8 @@ def main( llama3 = ChatAgentConfig( llm=lr.language_models.OpenAIGPTConfig( - chat_model="ollama/llama3:latest", + chat_model="ollama/llama3.1:latest", + chat_context_length=128000 ), vecdb=None )