Skip to content

Paraguanads/rag-assistant-telegram

Repository files navigation

E1DIGITAL RAG Assistant

A robust, production-ready Retrieval-Augmented Generation (RAG) assistant designed to provide accurate, context-aware answers based exclusively on your documentation.

Overview

This assistant is built to eliminate AI hallucinations by implementing a strict "Context-Only" policy. It uses vector search via ChromaDB to retrieve relevant information from your documents and leverages Azure OpenAI to generate precise answers, while being strictly prohibited from using external training data.

Key Features

  • Strict RAG Architecture: Answers are generated only from the provided knowledge base.

  • Hallucination Prevention: Includes a similarity threshold mechanism to ignore irrelevant queries.

  • Professional Observability: Integrated logging to monitor system metrics (CPU, Memory, and Query Performance).

  • Modular Design: Easy to maintain and extend.

  • Configurable Behavior: Custom roles and instructions via JSON configuration.

Technical Architecture

  • Retrieval: ChromaDB with a document chunking strategy (500-character chunks with 50-character overlap).

  • Generation: Azure OpenAI (gpt-4.1-mini) with a temperature set to 0 for deterministic output.

  • Observability: Custom logger tracking process health and query relevance.

Prerequisites

  • Python 3.10+

  • Azure OpenAI Service

  • Telegram Bot Token

Installation

Clone the repository:

git clone https://github.com/E1DIGITALPF/e1digital-rag-assistant.git
cd e1digital-rag-assistant

Set up environment variables:

Create a .env file in the root directory:

TELEGRAM_BOT_TOKEN=your_telegram_token
AZURE_OPENAI_API_KEY=your_azure_key
AZURE_OPENAI_ENDPOINT=your_azure_endpoint
AZURE_OPENAI_DEPLOYMENT=gpt-4.1-mini

Install dependencies:

pip install -r requirements.txt

Initialize Knowledge Base:

Place your documents in the source folder and run the ingestion script:

python build_knowledge_base.py

Run the bot:

python main.py

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

About

A robust, production-ready Retrieval-Augmented Generation (RAG) assistant

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors