Skip to content

Integrate semantic retrieval into the AI chat layer - #316

Open
dhruvi-16-me wants to merge 4 commits into
AOSSIE-Org:devfrom
dhruvi-16-me:semantic-retrieval-ai
Open

dhruvi-16-me wants to merge 4 commits into
AOSSIE-Org:devfrom
dhruvi-16-me:semantic-retrieval-ai

Conversation

@dhruvi-16-me

Copy link
Copy Markdown
Contributor

Summary

This PR integrates the existing semantic retrieval pipeline into Ell-ena's AI chat flow.

The changes replace broad workspace context injection with targeted semantic retrieval and introduce Riverpod-based state management for retrieval results and AI context.

Changes

Semantic Retrieval

  • Integrated the existing Week 13 rag_search pipeline into the AI chat flow.
  • Reused the existing retrieval infrastructure without introducing a duplicate search implementation.
  • Added typed retrieval results with explicit handling for successful, empty, and failed retrievals.
  • Added safe error handling to prevent internal database errors or sensitive information from being exposed.

Targeted AI Context

  • Removed the previous loading of all assigned tasks and tickets during chat initialization.

  • Removed unused userTasks and userTickets parameters from the AI flow.

  • Gemini now receives only the workspace records relevant to the user's query.

  • Excluded embeddings, similarity scores, and unnecessary database fields from the AI context.

  • Preserved essential non-RAG context, including:

    • Current date
    • Team members
    • Conversation history
    • System guidelines
    • Tool schemas

Riverpod State Management

  • Introduced Riverpod-based state management for the chat and retrieval flow.

  • chatControllerProvider manages:

    • Conversation messages
    • Processing state
    • Retrieval status
    • Retrieval results
    • Retrieval errors
    • AI context
  • Made ragRetrieverProvider overridable in tests, allowing retrieval logic to be tested without requiring a live database.

  • Prevented duplicate retrieval calls during a single chat request.

Tool Context Optimization

  • Reduced query_tasks and query_tickets responses to only the fields required by the AI.
  • Preserved record IDs where required by modification tools.
  • Removed unnecessary database data from Gemini prompts.

Testing

Added and updated tests covering:

  • RAG result mapping
  • AI context construction
  • Irrelevant result exclusion
  • Empty retrieval handling
  • Retrieval error handling
  • Prompt construction without RAG results
  • ChatController success, empty, error, and conversation-history states

Validation

  • flutter test17 tests passed
  • flutter analyze — no new errors
  • ✅ Dart formatting applied

✅ Checklist

  • I have read the contributing guidelines.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if applicable).
  • Any dependent changes have been merged and published in downstream modules.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • main
  • develop

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1eaf5d38-6e95-405a-9efe-13b55fa50a01

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@dhruvi-16-me dhruvi-16-me changed the title Integrate semantic retrieval into the AI chat layer ( Integrate semantic retrieval into the AI chat layer Aug 11, 2026
@dhruvi-16-me dhruvi-16-me added the gsoc Part of Google Summer of Code Season label Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gsoc Part of Google Summer of Code Season

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant