RAG Module¶
Overview¶
The RAG (Retrieval Augmented Generation) module enhances AI responses by retrieving relevant information from documents to provide context-aware answers. It implements a retrieval-augmented generation pipeline.
Module Structure¶
rag/
├── rag.module.ts # Module definition and configuration
├── rag.service.ts # Core RAG implementation
└── dto/ # Data transfer objects
└── rag-service.dto.ts # DTOs for RAG service operations
Key Components¶
RagModule¶
The root module that configures RAG services.
- Imports: None
- Providers: RagService
- Exports: RagService
RagService¶
Implements the RAG pipeline: - Question reformulation for improved retrieval - Document retrieval from vector store - Context-aware answer generation - Integration with LangChain and Pinecone services
DTOs¶
Data transfer objects for RAG service operations: - QuestionResponseSchema: Defines the structure for question responses
Dependencies¶
The RAG module depends on: - LangchainModule: For LLM interaction - VectorstoreModule: For document retrieval from vector database