Skip to content

Initial Changes #21

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hardikpatelse
Copy link
Owner

#20

@Copilot Copilot AI review requested due to automatic review settings July 27, 2025 13:03
@hardikpatelse hardikpatelse linked an issue Jul 27, 2025 that may be closed by this pull request
3 tasks
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new RAG (Retrieval-Augmented Generation) chat mode to the AI chatbot system. The change introduces a "Knowledge-Based (RAG)" chat mode with ID 5 and mode identifier "rag".

  • Adds a new database migration to insert the RAG chat mode data
  • Updates the DbContext seed data to include the new chat mode
  • Updates the model snapshot to reflect the new data and EF Core version

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
20250727122511_AddRAGChatMode.cs New migration file that adds the RAG chat mode to the ChatModes table
ChatBotDbContext.cs Updates seed data to include the new RAG chat mode entry
ChatBotDbContextModelSnapshot.cs Updates model snapshot with new chat mode and EF Core version change
Files not reviewed (1)
  • AIChatBot.API/Migrations/20250727122511_AddRAGChatMode.Designer.cs: Language not supported
Comments suppressed due to low confidence (1)

AIChatBot.API/Migrations/ChatBotDbContextModelSnapshot.cs:20

  • The ProductVersion has been downgraded from "9.0.7" to "8.0.0". This appears to be a regression to an older Entity Framework Core version. Verify that this version change is intentional and that all EF Core features used in the project are compatible with version 8.0.0.
                .HasAnnotation("ProductVersion", "8.0.0")

@hardikpatelse
Copy link
Owner Author

hardikpatelse commented Jul 27, 2025

🚀 RAG-Based Chat — Task Breakdown

STEP 1: 📚 Document Upload & Chunking

  • Add a file/document upload API (RagDocumentsController)
  • Store uploaded docs (PDF, TXT, etc.) in blob or structured text
  • Use chunking logic (e.g., 500 tokens per chunk) to segment documents
  • Store vectorizable chunks in a new RagDocumentChunk table

STEP 2: 🧠 Embeddings & Vector DB Setup

  • Use OpenAI, Cohere, or HuggingFace to generate embeddings for each chunk
  • Store embeddings in a simple vector DB (can start with in-memory + SQLite, then move to Qdrant/Weaviate if needed)
  • Define EmbeddingService to abstract vector store logic

STEP 3: 🔎 RAG Retrieval Logic

  • When user asks a question, generate embedding of the query
  • Use cosine similarity to match top-k relevant chunks
  • Inject those chunks as context in the prompt to LLM
  • Integrate this flow in ChatService and AgentService

STEP 4: 💬 Augmented Prompt Construction

  • Modify the message builder to prepend RAG results as system context
  • Clearly separate system messages vs user messages

STEP 5: 🔄 Frontend Enhancements

  • Create new UI tab for “Knowledge Base”
  • Add document upload form (accepts PDF, TXT)
  • Display uploaded documents in a list with status (embedded/not)
  • Option to chat with a specific document

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.

Implement EAG (Enhanced Augmented Generation) in AIChatBot
1 participant