-
Notifications
You must be signed in to change notification settings - Fork 3
fix llm content filter error #757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe changes involve updates to three files. In Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Suggested reviewers
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
daras_ai_v2/base.py
(1 hunks)daras_ai_v2/language_model.py
(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
daras_ai_v2/base.py (1)
widgets/base_header.py (3)
render_breadcrumbs_with_author
(46-74)render_header_title
(17-25)render_help_button
(28-43)
daras_ai_v2/language_model.py (1)
daras_ai_v2/exceptions.py (1)
UserError
(58-65)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Analyze (python)
- GitHub Check: test (3.10.12, 1.8.3)
🔇 Additional comments (2)
daras_ai_v2/base.py (1)
77-81
: LGTM – import consolidation improves readabilityThe grouped import keeps related functions together without altering behavior. No issues spotted.
daras_ai_v2/language_model.py (1)
1488-1489
: LGTM! Import refactor improves stability.Moving from
openai._types
to the mainopenai
module forNOT_GIVEN
import is a good change, as private modules (prefixed with_
) can change without notice. The directopenai
import is also needed for the exception handling below.
i think this goes in capture_openai_content_policy_violation |
cf4be5f
to
0f6d0bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
daras_ai_v2/safety_checker.py (1)
10-10
: Tighten copy and fix grammar in safety message.Prefer “content” over “contents,” and simplify phrasing.
-SAFTY_CHECKER_MSG = "Your request was rejected as a result of our safety system. Your input may contain contents that are not allowed by our safety system." +SAFETY_CHECKER_MSG = "Your request was rejected by our safety system. Your input may contain content that is not allowed."
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
daras_ai_v2/language_model.py
(2 hunks)daras_ai_v2/safety_checker.py
(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- daras_ai_v2/language_model.py
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: nikochiko
PR: GooeyAI/gooey-server#757
File: daras_ai_v2/language_model.py:1553-1577
Timestamp: 2025-08-06T14:38:42.116Z
Learning: For OpenAI content filtering in chat completions (LLMs), the primary error code is "content_filter". The "content_policy_violation" error code appears to be primarily associated with image models rather than chat completions.
Learnt from: nikochiko
PR: GooeyAI/gooey-server#757
File: daras_ai_v2/language_model.py:1553-1577
Timestamp: 2025-08-06T14:38:42.116Z
Learning: For OpenAI content filtering in chat completions: "content_policy_violation" typically appears when the prompt is blocked before processing, while "content_filter" can appear for both blocked prompts and blocked completions/responses. Both error codes are relevant for chat/LLM endpoints, not just image models.
📚 Learning: 2025-08-06T14:38:42.116Z
Learnt from: nikochiko
PR: GooeyAI/gooey-server#757
File: daras_ai_v2/language_model.py:1553-1577
Timestamp: 2025-08-06T14:38:42.116Z
Learning: For OpenAI content filtering in chat completions: "content_policy_violation" typically appears when the prompt is blocked before processing, while "content_filter" can appear for both blocked prompts and blocked completions/responses. Both error codes are relevant for chat/LLM endpoints, not just image models.
Applied to files:
daras_ai_v2/safety_checker.py
📚 Learning: 2025-08-06T14:38:42.116Z
Learnt from: nikochiko
PR: GooeyAI/gooey-server#757
File: daras_ai_v2/language_model.py:1553-1577
Timestamp: 2025-08-06T14:38:42.116Z
Learning: For OpenAI content filtering in chat completions (LLMs), the primary error code is "content_filter". The "content_policy_violation" error code appears to be primarily associated with image models rather than chat completions.
Applied to files:
daras_ai_v2/safety_checker.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Analyze (python)
- GitHub Check: test (3.10.12, 1.8.3)
Q/A checklist
How to check import time?
You can visualize this using tuna:
To measure import time for a specific library:
To reduce import times, import libraries that take a long time inside the functions that use them instead of at the top of the file:
Legal Boilerplate
Look, I get it. The entity doing business as “Gooey.AI” and/or “Dara.network” was incorporated in the State of Delaware in 2020 as Dara Network Inc. and is gonna need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Dara Network Inc can use, modify, copy, and redistribute my contributions, under its choice of terms.