feat(reply): cap spoken replies at a single sentence
Replies stayed long because the prompt stack gave conflicting length signals: the persona said "one sentence (two at the very most)" AND told the model to "state the answer in a sentence, then add a dry observation" (a 2nd sentence), while voice_style said "two to three sentences maximum". The model followed the longest. Make all three sources agree on exactly one sentence: the persona's aside must now fold into the same sentence as a trailing clause (never a 2nd sentence), voice_style caps at one sentence, and agents/llm.md says 한 문장. Shorter replies also cut Edge-TTS latency, since synth time scales with text length. Specs (prompts.spec.md) and docs/llm_contexts.md updated; deterministic prompt-contract tests added.
This commit is contained in:
@@ -44,6 +44,22 @@ class TestBuildSystemPrompt:
|
||||
assert "in the user's language" not in prompt
|
||||
assert "in Korean" in prompt
|
||||
|
||||
def test_persona_enforces_single_sentence(self):
|
||||
# Spoken replies must be one sentence (TTS latency scales with text
|
||||
# length, and the user asked for one-sentence answers). The persona must
|
||||
# state the single-sentence rule and must NOT carry the old "two at the
|
||||
# very most" allowance that let the model run long.
|
||||
prompt = build_system_prompt("Jarvis")
|
||||
assert "single short sentence" in prompt
|
||||
assert "Never write a second sentence" in prompt
|
||||
assert "two at the very most" not in prompt
|
||||
|
||||
def test_persona_aside_does_not_authorise_a_second_sentence(self):
|
||||
# The dry aside must fold into the one sentence, not become a 2nd one.
|
||||
prompt = build_system_prompt("Jarvis")
|
||||
assert "SINGLE sentence" in prompt
|
||||
assert "never add it as " in prompt
|
||||
|
||||
|
||||
class TestOutputLanguageDirective:
|
||||
"""A deployment may lock replies to a single language via OUTPUT_LANGUAGE.
|
||||
|
||||
Reference in New Issue
Block a user