Skip to content

Fix/rag service fallback safety disclaimer - #1643

Open
Nareshkumawat-star wants to merge 9 commits into
viru0909-dev:mainfrom
Nareshkumawat-star:fix/rag-service-fallback-safety-disclaimer
Open

Fix/rag service fallback safety disclaimer#1643
Nareshkumawat-star wants to merge 9 commits into
viru0909-dev:mainfrom
Nareshkumawat-star:fix/rag-service-fallback-safety-disclaimer

Conversation

@Nareshkumawat-star

Copy link
Copy Markdown

Description

Fixes a high-severity legal misinformation risk where Vakil Friend AI generated fabricated IPC/BNS section numbers and case citations when the lawgpt-service RAG microservice was offline or unreachable.

Issue Resolved

Closes #1622

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Security & Trust/Safety Enhancement

Key Changes Made

  1. RAG Fallback Signal (RagService.java):
    • Updated findRelevantContext to return a RAG_UNAVAILABLE signal when lawgpt-service connection fails.
  2. System Prompt Safety Enforcement (VakilFriendService.java):
    • Injected mandatory system instructions when RAG is offline, requiring the AI to open with: "I'm unable to retrieve verified legal references right now", disallowing section number citations, and recommending official legal counsel.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the CodeBlooded's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @Nareshkumawat-star, thanks for contributing to Nyay Setu! 🎉

I have automatically:

  • 👤 Assigned this PR to you.
  • 🏷️ Applied the gssoc:approved label.

Our workflows will now analyze your changes to classify:

  • 📈 PR Difficulty: level:*
  • 🧩 PR Type: type:*
  • 🌟 PR Quality: quality:*

Tip

Ensure your PR description references the issue it resolves (e.g. Closes #123). This allows the bot to inherit any additional labels from that issue!

Happy coding! 🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Vakil Friend (AI Assistant) returns hallucinated IPC section numbers when RAG service is unavailable

1 participant