Skip to content

Conversation

@nikunjJuspay
Copy link
Contributor

@nikunjJuspay nikunjJuspay commented Oct 30, 2025

Fixed Prompt Issues :

  • Making data from internet when actual. If data is not there don’t make the data
  • Showing Day label in normal line charts also which is wrong should be shown only in comparisons charts.
  • If it’s a single data point never show a ling graph / only show stat cards

Summary by CodeRabbit

  • New Features

    • Chart visualizations now support actual date and time labels for improved clarity
    • Period-over-period comparison charts display all periods on a single chart for easier analysis
    • Single data points are now handled with appropriate chart type selection
  • Bug Fixes

    • System now provides clear error messages when required tools or data are unavailable instead of attempting workarounds

@coderabbitai
Copy link

coderabbitai bot commented Oct 30, 2025

Walkthrough

The changes refine charting rules in the voice agent's system prompt by replacing generic weekly comparison labels with flexible single-series and period-over-period comparison rules, and introducing single-point handling guidance. A new error-handling rule for unavailable tools and data is also added.

Changes

Cohort / File(s) Summary
Chart Rendering Rules
app/agents/voice/automatic/prompts/system/charts.py
Replaced RULE 8 to permit actual date/time labels on single-series line charts instead of generic Day-based labels. Added RULE 9 for period-over-period comparisons requiring all periods on a single chart with granularity-based x-axis labels. Added RULE 10 for single-point scenarios, restricting them to single-stat charts.
Tool & Data Availability
app/agents/voice/automatic/prompts/system/tool_scope.py
Added new error-handling directive under Error & Clarification section: when required tools or data are unavailable, immediately reject the request, avoid prompting for data, clearly state the unavailable capability, and never assume or answer when data is missing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify rule clarity: Ensure RULE 8, RULE 9, and RULE 10 are unambiguous and do not conflict with existing chart rendering logic.
  • Confirm precedence: Check that RULE 9 fallback to RULE 8 for single-period scenarios is correctly handled.
  • Test error messaging: Validate that the new tool availability directive produces appropriate rejection messages without user prompting.

Possibly related PRs

  • Fixed weekly comparison in linechart #282: Modifies RULE 8 in the same charts.py file; this PR replaces that weekly-comparison rule with new single-series and period-comparison rules, making these changes directly interdependent.

Poem

A rabbit charts with care and grace,
New rules now guide each data place,
Single points find their home at last,
Periods align, no longer vast,
When tools are gone, we speak up clear— 🐰📊

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title "Prompt Issues Fixes" is related to the changeset as it involves fixes to system prompt files. However, the title is vague and generic, using non-descriptive terms that fail to convey the specific nature of the changes. While it indicates that prompt-related issues are being addressed, it does not communicate the main improvements: preventing data fabrication, fixing Day-label handling in comparison charts, and adding single-point chart handling. A teammate reviewing the PR history would not be able to understand what problems are being solved from the title alone. Consider revising the title to be more specific and descriptive of the actual changes, such as "Fix data fabrication and chart labeling in system prompts" or "Update chart and tool scope prompts for data validation and labeling rules." This would help team members quickly understand the scope and purpose of the changes when scanning PR history.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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 (3)
app/agents/voice/automatic/prompts/system/charts.py (3)

82-85: Clarify the definition of "single-series line chart".

While RULE 8 correctly addresses the PR objective of using actual dates for normal line charts, the term "single-series" could be ambiguous. Consider explicitly stating whether this means:

  • One metric/line over time (vs multiple lines in RULE 9's period-over-period comparison)
  • Or another specific criterion

This would help the LLM agent distinguish when to apply RULE 8 vs RULE 9 more reliably.


86-92: Consider edge case: period comparisons with single data points.

RULE 9 handles period-over-period comparisons, but what happens when each period has only one data point? The precedence between RULE 9 (comparison) and RULE 10 (single point → single-stat) isn't explicit.

Consider adding guidance for this scenario, such as: "For comparisons where each period has only one data point, use a bar chart with period labels rather than a line chart or single-stat."


93-97: Clarify guidance for multiple metrics at a single time point.

Line 96 states: "use bar/donut for comparison or Single-stat for primary metric" but the choice criteria between these options is unclear.

Consider providing explicit guidance such as:

  • "If comparing multiple metrics: use bar chart"
  • "If highlighting a primary metric with secondary context: use Single-stat"

This would reduce ambiguity for the LLM agent and ensure consistent chart selection.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b7b13e and e8176d6.

📒 Files selected for processing (2)
  • app/agents/voice/automatic/prompts/system/charts.py (1 hunks)
  • app/agents/voice/automatic/prompts/system/tool_scope.py (1 hunks)
🔇 Additional comments (1)
app/agents/voice/automatic/prompts/system/tool_scope.py (1)

44-49: LGTM! Clear data availability rules added.

The new "Tool & Data Availability" section effectively addresses the PR objective of preventing data fabrication. The directive to reject queries immediately when proper data is unavailable is unambiguous and includes helpful example phrases.

1. Exactly one (category, value) pair OR one time period with one metric → Single-stat chart
2. Never use line/bar/donut charts for single data points (unless charting fails - see RULE 5)
3. Multiple metrics at one time point ≠ time-series; use bar/donut for comparison or Single-stat for primary metric
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@swaroopvarma1 swaroopvarma1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check comments

2. Graceful Degradation
For unrecoverable errors, apologize briefly ("Sorry, I encountered an issue.") and ask how to proceed.
3. Tool & Data Availability
- If you do not have the appropriate tool or data to fulfill a request, politely reject it immediately
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can cause issues.
Example: If you ask what is my GMV for Euler only merchant they don't have any current GMV tool, but right now it can intelligently fetch GMV using other tools like payment analytics.
Such more similar cases may arise, which will limit user interactions.

Can you also share some sessions where it is causing issues currently for this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants