Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the /v1/chat/completions endpoint by revising the example request body in Swagger UI and enforcing a required ChatCompletionRequest body in the endpoint signature.
- Updated the example schema to include "messages", "max_tokens", and "temperature" parameters.
- Changed the API endpoint from accepting an optional ChatCompletionRequest via manual fallback parsing to requiring it via Body(...).
Comments suppressed due to low confidence (2)
webscout/Provider/OPENAI/api.py:612
- The removal of the manual parsing fallback means that invalid or missing request bodies will now rely on Pydantic validation. Please add tests to validate proper error responses for invalid input scenarios to ensure robust request handling.
chat_request: ChatCompletionRequest = Body(...)
webscout/Provider/OPENAI/api.py:598
- The updated schema example now excludes fields like 'model', 'choices', and 'usage'. Please ensure that the API documentation is updated accordingly to reflect the new example schema and parameter expectations.
"messages": [
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/v1/chat/completionsexample body so Swagger UI shows proper parametersChatCompletionRequestbody inchat_completionsTesting
ruff check webscout/Provider/OPENAI/api.py | head -n 5ruff check webscout/Provider/OPENAI/api.py | tail -n 20