-
Notifications
You must be signed in to change notification settings - Fork 9
Chatbot: Latest changes for workshop notebook #921
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
Conversation
WalkthroughA new function for generating plain-language explanations of manual guidance using an LLM was introduced. The main orchestrator function was refactored to include comprehensive error handling with try-except blocks, and its logic for constructing final answers was updated to utilize the new explanation function when appropriate. Prompt instructions for telemetry questions were expanded for clarity. The user interaction cell now features a different example question and enhanced output formatting using styled HTML for improved readability. Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 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:
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 (
|
|
@amotl please review and merge. |
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: 3
🧹 Nitpick comments (3)
topic/chatbot/table-augmented-generation/workshop/telemetry-diagnostics-assistant.ipynb (3)
1241-1245:sql2precedence can override LLM output unintentionally
sql2is first initialised with a manual-lookup query whenneeds_manualis true, but later may be overwritten byparsed_sql2from the model (or vice-versa):sql2 = patch_cratedb_sql(parsed_sql2) if parsed_sql2 else sql2If the model emits an empty
SQL 2:block the original manual query survives; if it emits a syntactically invalid but non-empty block it will replace your safe fallback and potentially fail execution.Recommend validating the parsed SQL before overwriting:
if parsed_sql2 and "SELECT" in parsed_sql2.upper(): sql2 = patch_cratedb_sql(parsed_sql2)
1264-1269: Manual-only questions can ignore telemetry contextYour current precedence chain:
- needs_manual ➔
explain_manual_guidance(...)- elif df1 not empty ➔ telemetry explanation
- else ➔ raw answer
A question such as “Is machine 4 overheating?” triggers both telemetry and manual context, yet only the manual explanation is returned. Consider merging both:
if needs_manual and anomaly_text: manual_part = explain_manual_guidance(...) telemetry_part = ( explain_result_with_llm(question, df1) if df1 is not None else "" ) final_answer = f"{telemetry_part}\n\n{manual_part}".strip()
1312-1369: HTML output is susceptible to accidental markup injection
joined_outputmay contain angle brackets (e.g., user question “<script>…”) which will be interpreted by the browser because you interpolate directly into an HTML string.
Although in a notebook the risk is lower, it is safer to escape the content:import html ... joined_output_html = html.escape(joined_output) display(HTML(f""" <div style="..."> {joined_output_html} </div>"""))
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
topic/chatbot/table-augmented-generation/workshop/telemetry-diagnostics-assistant.ipynb(7 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Python: 3.10 CrateDB: nightly on ubuntu-latest
topic/chatbot/table-augmented-generation/workshop/telemetry-diagnostics-assistant.ipynb
Show resolved
Hide resolved
topic/chatbot/table-augmented-generation/workshop/telemetry-diagnostics-assistant.ipynb
Show resolved
Hide resolved
topic/chatbot/table-augmented-generation/workshop/telemetry-diagnostics-assistant.ipynb
Show resolved
Hide resolved
|
@amotl please review and merge. |
amotl
left a comment
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.
Hi Wierd, thanks for the patch. I've added some comments that try to relate to the suggestions submitted by CodeRabbit. Thanks for addressing them.
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
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.
It looks like CI is succeeding on your patch, and @coderabbitai also does no longer display any admonitions or suggestions, so we figure it will be good to go. Thanks again!
Summary of the changes / Why this is an improvement
Checklist