You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Openai might return content moderation related query if user asks something explicit
explore this code
try:
# Call your LLM chain
for chunk in chain_with_history.stream({"query": input_text}, config=config):
if hasattr(chunk, 'content'):
yield chunk.content
full_response.append(chunk.content)
except ValueError as e:
# Check if the error message indicates content filtering
if "content filter being triggered" in str(e).lower():
yield "I’m sorry, but I cannot provide an answer to that request."
return
else:
raise
The text was updated successfully, but these errors were encountered:
Openai might return content moderation related query if user asks something explicit
explore this code
try:
# Call your LLM chain
for chunk in chain_with_history.stream({"query": input_text}, config=config):
if hasattr(chunk, 'content'):
yield chunk.content
full_response.append(chunk.content)
except ValueError as e:
# Check if the error message indicates content filtering
if "content filter being triggered" in str(e).lower():
yield "I’m sorry, but I cannot provide an answer to that request."
return
else:
raise
The text was updated successfully, but these errors were encountered: