mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
fix(realtime): instruct LLM to say exact guardrail message verbatim
The previous prompt gave the LLM creative freedom to paraphrase the guardrail violation message. Now it instructs the LLM to repeat the exact configured message word for word. Made-with: Cursor
This commit is contained in:
parent
7a5f486c21
commit
7807e36b40
1 changed files with 4 additions and 6 deletions
|
|
@ -363,13 +363,11 @@ class RealTimeStreaming:
|
|||
},
|
||||
})
|
||||
)
|
||||
# Ask the LLM to voice the guardrail message so the user
|
||||
# hears it as audio in voice sessions (not just text).
|
||||
# Ask the LLM to voice the exact guardrail message so the
|
||||
# user hears it as audio in voice sessions (not just text).
|
||||
guardrail_prompt = (
|
||||
f"The user's last message was blocked by a content guardrail "
|
||||
f"before it reached you. Briefly inform the user in a helpful "
|
||||
f"and empathetic tone: {error_msg}. "
|
||||
f"Do not repeat the blocked content."
|
||||
f"Say exactly the following message to the user, word for word, "
|
||||
f"do not add anything else: {error_msg}"
|
||||
)
|
||||
await self._send_to_backend(json.dumps({
|
||||
"type": "conversation.item.create",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue