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.
Fix/enable thinking #180
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
Uh oh!
There was an error while loading. Please reload this page.
Fix/enable thinking #180
Changes from all commits
c2bc69104a97449ec8d73File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
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.
Catching a generic
Exceptionand silently passing can hide unexpected errors and make debugging difficult. It's better to catch a more specific exception. Bothray.serve.get_app_handleandray.serve.get_deploymentraiseray.serve.exceptions.RayServeException(or a subclass) when the app/deployment is not found. Consider catching this specific exception instead. You'll need to import it.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.
Using
print()for logging in a library is generally discouraged as it offers no configuration for consumers of the library. Please use Python'sloggingmodule instead. This allows for log levels, different handlers, and formatting. You'll need toimport loggingat the top of the 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.
The
configdictionary is modified in-place on line 20, which can cause unexpected side effects for the caller. It's safer to work on a copy. Please create a copy of the dictionary before it's potentially modified.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.
This section is vulnerable to a high-severity prompt injection attack because the
historyparameter is used without validation, allowing attackers to manipulate the LLM's behavior. Additionally, the currentif/elif/elsechain for dispatching methods is cumbersome and could be refactored for better maintainability and extensibility. Implement strict validation forhistoryand consider refactoring the method dispatch usinggetattrwith an allowlist of methods.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.
The
__call__method, which serves as the HTTP entry point for the Ray Serve deployment, lacks any authentication or authorization checks. When deployed, this endpoint may be exposed to the network, allowing unauthorized users to access the LLM service. This can lead to unauthorized resource consumption, potential abuse of the model, and associated costs.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.
Returning raw exception messages (
str(e)) directly to the user can lead to information leakage, potentially exposing sensitive internal details. While catchingExceptionis fine, ensure error messages are sanitized before being returned. Additionally, it's crucial to log the full exception traceback internally for debugging purposes.