-
Notifications
You must be signed in to change notification settings - Fork 679
fix: cryptic error message for empty messages list in /chat/completions #2067 #2067
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
fix: cryptic error message for empty messages list in /chat/completions #2067 #2067
Conversation
- Add proper validation for empty messages array - Return clear error message instead of cryptic internal error - Fixes ai-dynamo#2064"
|
👋 Hi heisenberglit! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
WalkthroughA new validation function was introduced to ensure that the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Handler
participant Validator
Client->>Handler: POST /chat/completions (with request)
Handler->>Validator: validate_chat_completion_required_fields(request)
alt messages empty
Validator-->>Handler: Err (400 Bad Request)
Handler-->>Client: Respond with error
else messages present
Validator-->>Handler: Ok
Handler->>Handler: Continue processing (template, engine, etc.)
Handler-->>Client: Respond with completion
end
Estimated code review effort1 (~4 minutes) Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🔇 Additional comments (2)
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. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
|
Thanks for the contribution @heisenberglit ! |
Overview:
This PR addresses issue #2064 where the /chat/completions endpoint returns a cryptic internal error when receiving an empty messages array. The fix adds proper validation and returns a clear, user-friendly error message instead.
Details:
Added validation: Check for empty messages array before processing the request
Improved error handling: Return HTTP 400 with descriptive error message instead of internal server error
Where should the reviewer start?
Added a function to validate chat completion required field in llm->http->service->openai.rs
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
/chat/completionsrequests with emptymessageslist has cryptic error message #2064Summary by CodeRabbit