fix(openai): prompt engineering and transcript model
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
# OpenAI Persian delivery Phase 2 ? 2026-10-11
|
||||
|
||||
Implementation: fixed OpenAI delivery revision `iranian-persian-professional-v1`
|
||||
composed after the unchanged shared POLICY. Gemini uses exactly POLICY as before.
|
||||
OpenAI reservations freeze `style_revision` and `effective_instructions_digest`
|
||||
(SHA-256 of exact UTF-8 effective instructions) alongside Phase 1 audio settings.
|
||||
Missing or changed fields make an old reservation unusable before provider opening;
|
||||
replay retains its identity and stored snapshot. Use a fresh reservation after a
|
||||
prompt, revision, or voice change. No public event/DTO or migration changes.
|
||||
|
||||
Style asks for respectful conversational Iranian Persian, clear technical terms,
|
||||
short complete sentences, moderate pacing and clause pauses. It distinguishes
|
||||
insufficient evidence from technical failure, preserves facts and negation, and
|
||||
remains subordinate to fresh retrieval and untrusted-source rules. No behavioral
|
||||
examples were added: reviewer-approved examples and attribution are unavailable.
|
||||
This is prompt configuration, not measured speech quality or model compliance.
|
||||
|
||||
## Fixed comparison protocol and listener rubric
|
||||
|
||||
Use `docs/evaluation/openai-persian-delivery-comparison.json` as the locked run
|
||||
manifest. Model is `gpt-realtime-mini`; ASR is Phase 1 default whisper-1/fa,
|
||||
VAD .5/300/500 ms, no noise reduction, runtime-owned responses/interruptions.
|
||||
Compare marin first, then cedar, with shimmer as control. All three use the same
|
||||
exact effective instructions and approved input set. This is a voice-only
|
||||
experiment; ASR/model comparisons belong to other phases. Do not silently
|
||||
substitute unavailable models or inputs. Capture the full execution profile,
|
||||
prompt digest, input hashes, run/session IDs, and environment for every run.
|
||||
|
||||
Before any calls, a human freezes approved recordings/dialogue inputs, binds
|
||||
any document questions to authorized ready selected originals and reviewed
|
||||
critical facts, and records an input-set identifier and digest. Include greetings,
|
||||
ambiguity, no_evidence, error, technical terms, numbers, dates, conditions,
|
||||
exclusions, negation, and fresh-retrieval follow-ups. Do not invent expected facts.
|
||||
Every voice uses new sessions with identical inputs/order and reset context;
|
||||
record session readiness acknowledgment and exact profile. Keep recordings only
|
||||
as approved evaluation assets, never production recording/history.
|
||||
|
||||
An operator keeps a separate voice-to-clip mapping, strips voice names from
|
||||
listener filenames and metadata, randomizes presentation order independently for
|
||||
at least three native Iranian Persian listeners, and collects independent scores
|
||||
before revealing mappings. Score naturalness, pronunciation, and conversational
|
||||
professionalism separately: 1 unusable; 2 frequent distracting problems; 3
|
||||
understandable with noticeable problems; 4 natural with minor issues; 5 consistently
|
||||
natural and professional. Record pacing and clarification/failure accuracy comments.
|
||||
Require each dimension mean >=4/5 for the selected voice, with all three listeners
|
||||
covering the same clips. Report sample/listener counts, missing ratings and means
|
||||
per voice; missing scores are not zero and cannot establish passage. A separate
|
||||
human fact review must find no changed critical values, conditions, or negation.
|
||||
Report p50/p95 latency and observed usage/cost availability separately.
|
||||
|
||||
## Compatibility and interruption gate
|
||||
|
||||
The classifier is unchanged: only gpt-realtime-mini/shimmer with structured
|
||||
invalid_request_error/response_cancel_not_active and absent/null param is verified.
|
||||
Marin/cedar are unverified. Never accept them by substring or inferred similarity.
|
||||
An explicit bounded probe authorization must specify pairs, connection/response
|
||||
limits, timeouts and spend budget before any compatibility provider calls.
|
||||
Capture sanitized structured type/code/param and cancellation event correlation,
|
||||
terminal status ordering and matching item/content/played-position truncation ack.
|
||||
Never log raw audio, transcripts, credentials or document/provider payloads.
|
||||
Only matching actual candidate evidence authorizes a classifier extension.
|
||||
|
||||
Then exercise the main application runtime: interruption during generation and
|
||||
retrieval, completed generation with undrained playback, terminal-before-error
|
||||
and terminal-after-error races, rapid repeated speech starts, final played-position
|
||||
updates (including zero), duplicate/late acknowledgments, missing terminal/incorrect
|
||||
truncation failures, stop/disconnect, replay/profile rejection and stale selection/
|
||||
access barriers. Require correlated cancellation, independent terminal confirmation,
|
||||
frozen played position and exact truncation acknowledgment before next response.
|
||||
Synthetic fixtures establish regression behavior only, not real compatibility.
|
||||
|
||||
## Acceptance report
|
||||
|
||||
Implementation status: implemented except pending human-reviewed examples.
|
||||
Acceptance status: not_run; Phase 2 remains open. Listener scores for all voices:
|
||||
not_run. Candidate cancellation probes/runtime interruption evidence: not_run.
|
||||
New provider connections/calls: 0; paid evaluation budget consumed: 0.
|
||||
Historical shimmer evidence remains limited to the context-sync repair report;
|
||||
it does not prove Persian delivery or every active interruption scenario.
|
||||
Missing prerequisites: approved examples, frozen human inputs, three native
|
||||
listeners, explicit bounded provider authorization, and actual application/browser
|
||||
interruption evidence. No selected voice promotion, deployment or defaults change.
|
||||
|
||||
Prompt structure follows [official voice prompting guidance](https://developers.openai.com/api/docs/guides/voice-prompting).
|
||||
Use [Realtime voice guidance](https://developers.openai.com/api/docs/guides/realtime-conversations)
|
||||
when checking candidate availability; documentation is not empirical compatibility.
|
||||
|
||||
## Executed regression evidence
|
||||
|
||||
- `.venv/Scripts/python -m pytest tests/unit/test_openai_persian_style.py tests/unit/test_openai_speech_configuration.py tests/unit/test_live_context_sync.py tests/unit/test_realtime_phase1.py tests/unit/test_realtime_repairs.py tests/unit/test_realtime_remaining.py tests/unit/test_gemini_live.py -q -p no:cacheprovider --tb=short`: final 338 passed in 50.27 s. Initial 337 passed/1 failed was a new test's incorrect Gemini setup-shape assumption, corrected to inspect emitted instructions.
|
||||
- `.venv/Scripts/python -m pytest tests/integration/test_openai_speech_profile.py -m postgres --require-postgres -q -p no:cacheprovider --tb=short`: 10 passed in 107.86 s, zero skips. Isolated task-created pgvector container `rag-persian-phase2-20261011-test`, loopback 55441, dedicated `rag_persian_phase2_test`; existing immutable migrations applied by fixtures. Container and anonymous storage removed afterward. No full PostgreSQL suite claim.
|
||||
- `.venv/Scripts/python -m pytest -m "not postgres" -q -p no:cacheprovider --tb=short`: stopped before completion while the existing environment-isolation driver ran a captured second full suite. No pass claim.
|
||||
- `.venv/Scripts/python -m pytest -m "not postgres" -k "not test_ordinary_suite_ignores_ambient_ingestion_configuration" -q -p no:cacheprovider --tb=short`: 1880 passed, 3 Windows symlink skips, 426 deselected (PostgreSQL plus the duplicate-suite driver), 1 failed, 25 deprecation warnings, 189.36 s. Unchanged `test_real_large_escaped_json_keeps_concurrent_loop_active[4499]` measured 187.67 ms against its 100 ms heartbeat bound.
|
||||
- `.venv/Scripts/python -m pytest tests/unit/test_json_processing.py -q -p no:cacheprovider --tb=short`: 8 passed, 1 failed in 11.53 s. The 4499 case passed; the 10000 case measured 234.46 ms against 100 ms. Timing instability remains unresolved; no limits or ingestion code were changed and no definitive cause is claimed.
|
||||
- Static checks: shared POLICY equals HEAD byte-for-byte as a Python string; Gemini adapter diff is empty; cancellation classifier AST equals HEAD; manifest matches effective configuration; new/extended Python files parse; `git diff --check` passed.
|
||||
|
||||
Affected Phase 2 sources: `app/modules/voice/openai_style.py`,
|
||||
`app/infrastructure/realtime.py`, `app/modules/voice/configuration.py`,
|
||||
`tests/unit/test_openai_persian_style.py`, and the existing working-tree
|
||||
`tests/integration/test_openai_speech_profile.py`. Documentation: this handoff,
|
||||
comparison JSON/rating CSV, API catalog and reference map. Existing Phase 1
|
||||
configuration/transcript/runtime edits were preserved; no Phase 3/4 work added.
|
||||
|
||||
These results establish deterministic adapter/runtime coverage and targeted
|
||||
persistence behavior, not listener scores, actual model grounding compliance,
|
||||
marin/cedar cancellation compatibility, or release readiness.
|
||||
Reference in New Issue
Block a user