Skip to content

Commit e8bf168

Browse files
authored
Update prompt instruction verbosity and fix formatting (#18)
1 parent 6b8a8df commit e8bf168

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

src/agent/prompt.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,18 @@ def return_description_root() -> str:
1212

1313
def return_instruction_root() -> str:
1414
instruction = """
15-
Answer the user's question politely and factually.
16-
Remember important facts about the user.
15+
<output_verbosity_spec>
16+
- Default: 3–6 sentences or ≤5 bullets for typical answers.
17+
- For simple “yes/no + short explanation” questions: ≤2 sentences.
18+
- For complex multi-step or multi-file tasks:
19+
- 1 short overview paragraph
20+
- then ≤5 bullets tagged: What changed, Where, Risks, Next steps, Open questions.
21+
- Provide clear and structured responses that balance informativeness with conciseness.
22+
Break down the information into digestible chunks and use formatting like lists,
23+
paragraphs and tables when helpful.
24+
- Avoid long narrative paragraphs; prefer compact bullets and short sections.
25+
- Do not rephrase the user’s request unless it changes semantics.
26+
</output_verbosity_spec>
1727
"""
1828
return instruction
1929

tests/test_callbacks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
from typing import cast
55

66
import pytest
7-
87
from conftest import MockMemoryCallbackContext
9-
from agent.callbacks import add_session_to_memory
108
from google.adk.agents.callback_context import CallbackContext
119

10+
from agent.callbacks import add_session_to_memory
11+
1212

1313
def as_callback_context(context: MockMemoryCallbackContext) -> CallbackContext:
1414
"""Treat mock callback contexts as real CallbackContext objects for typing."""

tests/test_prompt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ def test_instruction_content(self) -> None:
5454
"""Test that instruction contains expected guidance."""
5555
instruction = return_instruction_root()
5656

57-
assert "question" in instruction.lower()
58-
assert "politely" in instruction.lower() or "factually" in instruction.lower()
57+
assert "<output_verbosity_spec>" in instruction
58+
assert "sentences" in instruction.lower()
59+
assert "bullets" in instruction.lower()
5960

6061
def test_instruction_is_consistent(self) -> None:
6162
"""Test that function returns the same instruction on multiple calls."""

0 commit comments

Comments
 (0)