From d7b6d244651bcf46a7d5321903158cf4083abc27 Mon Sep 17 00:00:00 2001 From: amirhosein mazaheri Date: Wed, 14 Oct 2026 12:34:36 +0330 Subject: [PATCH] fix(voice): prefer concise complete answers by default --- app/modules/voice/openai_style.py | 15 ++++++++++++--- docker-compose.voice-candidate.yml | 2 +- docs/guides/voice-model-switch-rollback.md | 13 +++++++++++-- tests/unit/test_openai_persian_style.py | 4 ++-- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/app/modules/voice/openai_style.py b/app/modules/voice/openai_style.py index 64b1dc8..6cf6340 100644 --- a/app/modules/voice/openai_style.py +++ b/app/modules/voice/openai_style.py @@ -1,10 +1,19 @@ """Fixed OpenAI delivery revision; no document facts or unreviewed examples.""" from hashlib import sha256 -STYLE_REVISION = 'iranian-persian-conversational-v6' +STYLE_REVISION = 'iranian-persian-conversational-v7' STYLE = """Delivery style (subordinate to the grounding policy above): -Answer the specific question directly. For a simple factual question, use one or -two short complete sentences. Call evidence tools silently. If an acknowledgement is needed, say only «یه لحظه…» +Give the requested fact or answer in the first sentence. Default to the shortest +complete answer: one or two short sentences for a simple factual question, and a +few short sentences for a multi-part question. Answer all requested parts. +Do not restate the question, introduce your answer, repeat evidence disclaimers, +list unrelated services, or end every answer with an invitation to ask more. +For hours, state the days and times plus any material exception. For a person, +state the supported name and exact role/organization; if ambiguous, ask one +focused clarification instead of changing the role. For eligibility, retain +all conditions and exclusions needed for the user's case. +When the user explicitly asks for a full explanation, steps or detail, provide +the necessary detail; brevity is a default, not a fixed sentence or token cap. Call evidence tools silently. If an acknowledgement is needed, say only «یه لحظه…» once per user turn; do not describe reviewing documents. Add explanations or further detail only when the user asks or when they are necessary to interpret the answer correctly. Preserve necessary numbers, conditions, exceptions and negation; diff --git a/docker-compose.voice-candidate.yml b/docker-compose.voice-candidate.yml index b9b8c31..20b2b38 100644 --- a/docker-compose.voice-candidate.yml +++ b/docker-compose.voice-candidate.yml @@ -5,7 +5,7 @@ services: extends: file: docker-compose.yml service: api - image: rag-api-model-switch:20261014 + image: rag-api-brief-answers:20261014 container_name: rag-api-mini environment: OPENAI_REALTIME_MODEL: gpt-realtime-2.1-mini diff --git a/docs/guides/voice-model-switch-rollback.md b/docs/guides/voice-model-switch-rollback.md index 98c5397..c267c8d 100644 --- a/docs/guides/voice-model-switch-rollback.md +++ b/docs/guides/voice-model-switch-rollback.md @@ -1,7 +1,7 @@ # Isolated OpenAI Mini candidate and rollback The original rag-api container is retained, with its image, environment and mounts. -The candidate rag-api-mini uses the separately built rag-api-model-switch:20261014 +The candidate rag-api-mini uses the separately built rag-api-brief-answers:20261014 image and changes only OPENAI_REALTIME_MODEL to gpt-realtime-2.1-mini via docker-compose.voice-candidate.yml. Local .env remains the original profile. The old image is also tagged rag-api-rollback:20261014. @@ -15,7 +15,7 @@ session. Do not run compose down, container rm, or image pruning for this workfl Build the candidate without replacing the current container: ```powershell -docker build -t rag-api-model-switch:20261014 . +docker build -t rag-api-brief-answers:20261014 . ``` Switch after tests pass (if startup/readiness fails, stop the candidate and start @@ -59,3 +59,12 @@ Original container ID remains 65c9fa765c150467bde2d6336b09fb46d5ffe451d1117eb1ab93a7bacff1037d, with its original image and configuration; it is stopped, not removed. The unrelated pre-existing .gitignore edit is excluded from this change. + +## Concise delivery default + +OpenAI delivery v7 requests the supported fact first, short complete answers by +default, all requested parts and material conditions/exceptions preserved, and +full detail on explicit request. Repeated introductions, generic service menus +and invitations are discouraged. Output-token limits and speed are unchanged. +This is model instruction guidance, not a measured quality or cost guarantee. +The existing original rag-api container remains the rollback target. diff --git a/tests/unit/test_openai_persian_style.py b/tests/unit/test_openai_persian_style.py index 62cee9b..95f136f 100644 --- a/tests/unit/test_openai_persian_style.py +++ b/tests/unit/test_openai_persian_style.py @@ -53,6 +53,6 @@ def test_gemini_effective_policy_and_evidence_revision_are_pinned(): @pytest.mark.parametrize('voice', ['marin', 'cedar']) -def test_unverified_pairs_do_not_accept_baseline_cancellation_error(voice): - assert not RealtimeAdapter(Transport(), voice=voice).is_no_active(dict( +def test_voice_change_keeps_protocol_cancellation_signature(voice): + assert RealtimeAdapter(Transport(), voice=voice).is_no_active(dict( type='invalid_request_error', code='response_cancel_not_active', param=None))