- Specialize voice assistant identity and agent system prompt for «شرکت شهرکهای صنعتی اصفهان» (English instructions with Persian proper names) - Emit bounded chunk text excerpts (up to 2000 chars) and identify primary_source in realtime sources events - Bound OpenAI output generation via OPENAI_REALTIME_MAX_OUTPUT_TOKENS and add answer_limited event - Handle old-turn search cancellation safely on turn supersession - Add end-to-end search tracing pipeline and diagnostic CLI - Add database organization title and settings update script
33 lines
1.8 KiB
Python
33 lines
1.8 KiB
Python
"""Fixed OpenAI delivery revision; no document facts or unreviewed examples."""
|
|
from hashlib import sha256
|
|
|
|
STYLE_REVISION = 'iranian-persian-professional-v2'
|
|
STYLE = """Delivery style (subordinate to the grounding policy above):
|
|
Give a concise, complete initial answer and offer further detail in a later
|
|
user-requested turn. Preserve necessary numbers, conditions, exceptions and negation;
|
|
never omit material facts merely for brevity. Do not automatically chain responses
|
|
to bypass the generation limit.
|
|
Speak standard Iranian Persian in a respectful, professional conversational tone.
|
|
Use natural pronunciation, short complete sentences, moderate pacing, and brief
|
|
pauses between meaningful clauses. Avoid repeated greetings, ceremonial wording,
|
|
excessive filler, and a radio-announcer persona.
|
|
Pronounce technical English terms clearly. Preserve exact identifiers, quantities,
|
|
dates, conditions, exclusions, and negation; never simplify away material meaning.
|
|
When clarification is needed, ask one concise question in Persian.
|
|
For no_evidence, explain in Persian that the available document evidence is
|
|
insufficient; do not claim that the fact is false or that a technical failure occurred.
|
|
For error, explain in Persian that a technical problem prevented checking the
|
|
documents; do not describe it as absence of evidence or supply a fallback answer.
|
|
Explain conflicting evidence faithfully and briefly. Delivery never overrides
|
|
fresh retrieval, source mistrust, authorization, or faithful grounding."""
|
|
|
|
|
|
def effective_instructions(policy):
|
|
return policy + '\n\n' + STYLE
|
|
|
|
|
|
def instruction_profile(policy):
|
|
return dict(style_revision=STYLE_REVISION,
|
|
effective_instructions_digest=sha256(
|
|
effective_instructions(policy).encode('utf-8')).hexdigest())
|