Skip to content

Implement RAG (Retrieval-Augmented Generation) Feature for Blog Posts #19

Description

@atullya

Implement a Retrieval-Augmented Generation (RAG) system for the blog platform to allow users to ask AI-powered questions about individual blog posts.

The feature should:

Generate embeddings for blog content
Store blog chunks using pgvector in PostgreSQL
Retrieve relevant chunks for a given question
Use Gemini AI to generate grounded answers
Provide an interactive chat widget on blog detail pages

RagService (Main Orchestrator)
AskAsync(RagQuery)

Flow:

Embed user question
Retrieve top-k chunks for the current post
Build context from chunks
Call Gemini chat model with grounded system prompt
Return answer + source chunks

System prompt:

You are a helpful assistant that only answers questions based on the provided blog post content.
If the answer is not in the content, say you don't know.
Never make up information.
Always cite which part of the blog you got the answer from.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions