-
Notifications
You must be signed in to change notification settings - Fork 102
Disable streaming output when calling robusta AI (tools streaming sti… #503
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
…ll working), and enabled structured output (response format) In addition, there was a bug if the prometheus_url doesn't have trailing '/' Fixed it to support mimir
WalkthroughThe changes introduce a Pydantic validator to ensure the Prometheus URL always ends with a trailing slash and adjust URL construction to prevent double slashes. In the server logic, conditional handling for the "Robusta" model in the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Server
participant Investigation
participant AI
Client->>Server: POST /api/stream/investigate
Server->>Investigation: get_investigation_context(..., structured_output=True)
Server->>AI: call_stream(..., robusta_ai=False)
AI-->>Server: Streamed response
Server-->>Client: Streamed response
sequenceDiagram
participant User
participant PrometheusConfig
User->>PrometheusConfig: Set prometheus_url
PrometheusConfig->>PrometheusConfig: ensure_trailing_slash (validator)
Note right of PrometheusConfig: Appends '/' if missing
✨ Finishing Touches
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
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: 0
🧹 Nitpick comments (1)
server.py (1)
151-153
: Consider a more maintainable approach than commenting out code.While commenting out code achieves the immediate goal of disabling Robusta-specific logic, consider either removing the commented code entirely or implementing a feature flag if this behavior might need to be toggled in the future.
Apply this diff to clean up the commented code:
- # Disabled the logic for streaming & structured output with robusta AI - # robusta_ai = req.model == "Robusta" - # is_structured_output = not robusta_ai -
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
holmes/plugins/toolsets/prometheus/prometheus.py
(3 hunks)server.py
(1 hunks)
🧰 Additional context used
🪛 Pylint (3.3.7)
holmes/plugins/toolsets/prometheus/prometheus.py
[error] 53-53: Method 'ensure_trailing_slash' should have "self" as first argument
(E0213)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build (3.12)
- GitHub Check: Pre-commit checks
🔇 Additional comments (5)
holmes/plugins/toolsets/prometheus/prometheus.py (3)
11-11
: LGTM: Required import for field validator.The import addition is necessary for the new Pydantic field validator.
52-56
: LGTM: Proper URL normalization implementation.The field validator correctly ensures the prometheus_url always has a trailing slash, which addresses the bug mentioned in the PR objectives regarding mimir compatibility.
Note: The pylint warning about method signature is a false positive - Pydantic v2 field validators correctly use
cls
as the first parameter for class methods.🧰 Tools
🪛 Pylint (3.3.7)
[error] 53-53: Method 'ensure_trailing_slash' should have "self" as first argument
(E0213)
314-314
: LGTM: Proper urljoin usage with validator.Removing the leading slash from the relative path works correctly with
urljoin
and the new trailing slash validator, preventing double slashes in the constructed URL.server.py (2)
156-156
: LGTM: Structured output always enabled.Hardcoding
True
for structured output aligns with the PR objective to enable structured output. The change is clear and straightforward.
160-160
: LGTM: Robusta streaming disabled.Hardcoding
False
for the robusta_ai parameter effectively disables streaming when calling Robusta AI, which aligns with the PR objective while maintaining tools streaming functionality.
…ll working), and enabled structured output (response format)
In addition, there was a bug if the prometheus_url doesn't have trailing '/' Fixed it to support mimir