AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(backend/copilot): keep Otto and expert replies short (#15216)
Ubbef2c683cf2b48
diff --git a/autogpt_platform/backend/backend/copilot/expert_context.py b/autogpt_platform/backend/backend/copilot/expert_context.pyindex d31e515bb1..81883330e9 100644--- a/autogpt_platform/backend/backend/copilot/expert_context.py+++ b/autogpt_platform/backend/backend/copilot/expert_context.py@@ -167,6 +167,8 @@ def render_expert_identity_suffix(expert: Expert) -> str:f"available to you, but you always speak and act as {name}: "f"never present yourself as Otto, and if asked who you are, "f"you are {name}.\n"+ f"Your voice preferences shape your tone, not your length: follow "+ f"the reply style rules above even when your samples do otherwise.\n"f"</expert_identity>")diff --git a/autogpt_platform/backend/backend/copilot/prompting.py b/autogpt_platform/backend/backend/copilot/prompting.pyindex 29aa4a91ba..77d970a8ee 100644--- a/autogpt_platform/backend/backend/copilot/prompting.py+++ b/autogpt_platform/backend/backend/copilot/prompting.py@@ -17,6 +17,27 @@ from backend.blocks.desktop._api import DISPLAY# individual tool schema.SHARED_TOOL_NOTES = """\+### Reply style+Write like a sharp colleague texting back, not like a report. This holds for+Otto and for every expert: an expert's voice sets its tone, never its length+or these rules.+- Lead with the answer or the result. No preamble ("Great question", "Sure, I+ can help"), no recap of what the user said, no closing offers ("Let me know+ if…").+- Default to 1 to 3 sentences. Go longer only when the user asks for detail or+ the content itself is long: code, a draft they asked for, a list of results.+- Never write an em dash or an en dash in a reply, a draft or a message you+ send for the user. Use a comma, colon, period or parentheses instead, and+ "to" for ranges ("3 to 5"). Plain hyphens in words like "follow-up" are+ fine.+- No headers, tables or bullet lists for an answer that fits in a short+ paragraph.+- After tool calls, give the outcome in a line or two, not a step-by-step of+ what you ran. The user already sees the tool calls.+- Ask at most one question at a time, and only when you are truly blocked.+- A first greeting is two lines at most: who you are and one thing you can do+ for them.+### MathFormulas render as LaTeX in replies and `.md` files: `$…$` inline, `$$…$$` for display; a plain price like `$5` stays text.diff --git a/autogpt_platform/backend/backend/copilot/prompting_test.py b/autogpt_platform/backend/backend/copilot/prompting_test.pyindex 0c7b1fd2a2..5323e0b9e9 100644--- a/autogpt_platform/backend/backend/copilot/prompting_test.py+++ b/autogpt_platform/backend/backend/copilot/prompting_test.py@@ -315,6 +315,27 @@ class TestSchedulingGuidance:assert "### Scheduling future work" in prompting.SHARED_TOOL_NOTES+class TestReplyStyle:+ # The base prompt comes from Langfuse in production, so the style rules+ # ride SHARED_TOOL_NOTES, which both engines append for Otto and experts.+ @pytest.mark.parametrize("use_e2b", [False, True])+ def test_sdk_supplement_carries_the_reply_style_rules(self, use_e2b):+ result = prompting.get_sdk_supplement(use_e2b=use_e2b)+ assert "### Reply style" in result+ assert "Default to 1 to 3 sentences." in result+ assert "Never write an em dash or an en dash" in result++ def test_baseline_mode_gets_the_same_rules(self):+ assert "### Reply style" in prompting.SHARED_TOOL_NOTES+ assert "never its length" in prompting.SHARED_TOOL_NOTES++ def test_the_rules_do_not_model_the_dashes_they_forbid(self):+ start = prompting.SHARED_TOOL_NOTES.index("### Reply style")+ end = prompting.SHARED_TOOL_NOTES.index("### Math")+ section = prompting.SHARED_TOOL_NOTES[start:end]+ assert "—" not in section and "–" not in section++class TestMathGuidance:@pytest.mark.parametrize("use_e2b", [False, True])def test_sdk_supplement_tells_the_model_formulas_render(self, use_e2b):