Skip to content

πŸ™Œ OpenHands: AI-Driven Development

(test) Include message separators in mock prompts (#1855)

Boxuan Li735fbbfe3e32
diff --git a/opendevin/llm/llm.py b/opendevin/llm/llm.py
index 8d9b53a5dd..a3209aba68 100644
--- a/opendevin/llm/llm.py
+++ b/opendevin/llm/llm.py
@@ -24,6 +24,8 @@ from opendevin.core.logger import opendevin_logger as logger
__all__ = ['LLM']
+message_separator = '\n\n----------\n\n'
+
class LLM:
"""
@@ -182,7 +184,7 @@ class LLM:
messages = args[1]
debug_message = ''
for message in messages:
- debug_message += '\n\n----------\n\n' + message['content']
+ debug_message += message_separator + message['content']
llm_prompt_logger.debug(debug_message)
resp = completion_unwrapped(*args, **kwargs)
message_back = resp['choices'][0]['message']['content']
diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py
index ef2207d363..603994a9aa 100644
--- a/tests/integration/conftest.py
+++ b/tests/integration/conftest.py
@@ -7,6 +7,8 @@ from functools import partial
import pytest
from litellm import completion
+from opendevin.llm.llm import message_separator
+
script_dir = os.path.dirname(os.path.realpath(__file__))
workspace_path = os.getenv('WORKSPACE_BASE')
@@ -102,7 +104,7 @@ def mock_completion(*args, test_name, **kwargs):
messages = kwargs['messages']
message_str = ''
for message in messages:
- message_str += message['content']
+ message_str += message_separator + message['content']
if os.environ.get('FORCE_APPLY_PROMPTS') == 'true':
# this assumes all response_(*).log filenames are in numerical order, starting from one
cur_id += 1
diff --git a/tests/integration/mock/PlannerAgent/test_edits/prompt_001.log b/tests/integration/mock/PlannerAgent/test_edits/prompt_001.log
index 6440ad976c..3e16c53e09 100644
--- a/tests/integration/mock/PlannerAgent/test_edits/prompt_001.log
+++ b/tests/integration/mock/PlannerAgent/test_edits/prompt_001.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_edits/prompt_002.log b/tests/integration/mock/PlannerAgent/test_edits/prompt_002.log
index 8f7f244691..69a37da818 100644
--- a/tests/integration/mock/PlannerAgent/test_edits/prompt_002.log
+++ b/tests/integration/mock/PlannerAgent/test_edits/prompt_002.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_edits/prompt_003.log b/tests/integration/mock/PlannerAgent/test_edits/prompt_003.log
index 5e193ae165..56f8b4f370 100644
--- a/tests/integration/mock/PlannerAgent/test_edits/prompt_003.log
+++ b/tests/integration/mock/PlannerAgent/test_edits/prompt_003.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_edits/prompt_004.log b/tests/integration/mock/PlannerAgent/test_edits/prompt_004.log
index 83f0748c3e..23509a31fe 100644
--- a/tests/integration/mock/PlannerAgent/test_edits/prompt_004.log
+++ b/tests/integration/mock/PlannerAgent/test_edits/prompt_004.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_edits/prompt_005.log b/tests/integration/mock/PlannerAgent/test_edits/prompt_005.log
index 2834f470f7..ae0e222b14 100644
--- a/tests/integration/mock/PlannerAgent/test_edits/prompt_005.log
+++ b/tests/integration/mock/PlannerAgent/test_edits/prompt_005.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_edits/prompt_006.log b/tests/integration/mock/PlannerAgent/test_edits/prompt_006.log
index 5bffe317a2..03fb196126 100644
--- a/tests/integration/mock/PlannerAgent/test_edits/prompt_006.log
+++ b/tests/integration/mock/PlannerAgent/test_edits/prompt_006.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_edits/prompt_007.log b/tests/integration/mock/PlannerAgent/test_edits/prompt_007.log
index 002955c592..e68d3c9b4b 100644
--- a/tests/integration/mock/PlannerAgent/test_edits/prompt_007.log
+++ b/tests/integration/mock/PlannerAgent/test_edits/prompt_007.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_edits/prompt_008.log b/tests/integration/mock/PlannerAgent/test_edits/prompt_008.log
index eed253e564..6fdab06f49 100644
--- a/tests/integration/mock/PlannerAgent/test_edits/prompt_008.log
+++ b/tests/integration/mock/PlannerAgent/test_edits/prompt_008.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_edits/prompt_009.log b/tests/integration/mock/PlannerAgent/test_edits/prompt_009.log
index d5259aa536..76dd879730 100644
--- a/tests/integration/mock/PlannerAgent/test_edits/prompt_009.log
+++ b/tests/integration/mock/PlannerAgent/test_edits/prompt_009.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_edits/prompt_010.log b/tests/integration/mock/PlannerAgent/test_edits/prompt_010.log
index c47084e35e..88c58066f5 100644
--- a/tests/integration/mock/PlannerAgent/test_edits/prompt_010.log
+++ b/tests/integration/mock/PlannerAgent/test_edits/prompt_010.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_001.log b/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_001.log
index 90512d0843..e6f19f9135 100644
--- a/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_001.log
+++ b/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_001.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_002.log b/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_002.log
index f88d817233..69885927c1 100644
--- a/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_002.log
+++ b/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_002.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_003.log b/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_003.log
index 81771e3a18..1bee8674fd 100644
--- a/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_003.log
+++ b/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_003.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_004.log b/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_004.log
index cf0d079f5e..808b6f5004 100644
--- a/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_004.log
+++ b/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_004.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
diff --git a/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_005.log b/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_005.log
index 5d3531f57e..4d53aaa560 100644
--- a/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_005.log
+++ b/tests/integration/mock/PlannerAgent/test_write_simple_script/prompt_005.log
@@ -1,4 +1,8 @@
+
+----------
+
+
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.