- Project Overview
- Components
- Prerequisites
- Installation Steps
- Usage
- API Documentation
- Troubleshooting
- Future Improvements
- Code of Conduct
- License
RAG (Retrieval-Augmented Generation) Transformer is an intelligent AI assistant that combines advanced machine learning techniques to provide contextually rich, informative responses across multiple knowledge domains:
- Intelligent Knowledge Retrieval: Searches through a diverse dataset of machine learning, science fiction, and cosmic content
- Context-Aware Responses: Generates answers that are not just accurate, but contextually relevant
- Multidomain Intelligence: Bridges insights from:
- Machine Learning Concepts
- Science Fiction Movies
- Cosmic and Astronomical Observations
- Advanced Prompting: Uses few-shot examples and domain-specific templates for better responses
- Knowledge Graph Visualization: Creates visual representations of relationships between concepts
- Web Interface: User-friendly Streamlit interface with analytics and knowledge base exploration
- API Server: FastAPI-based API for integration with other applications
- Multiple Model Support: Integrates with Hugging Face, OpenAI, and Anthropic models
- Deployment Options: Docker, AWS, and GCP deployment utilities
The system uses a sophisticated multi-step process:
- Query Processing: Parse and analyze the user query
- Document Retrieval: Find relevant documents in the knowledge base
- Context Preparation: Combine retrieved documents into a context
- Response Generation: Generate a response using the context and query
- Response Evaluation: Assess and improve the quality of the response
- Embedding Model:
all-MiniLM-L6-v2
- Generation Models:
google/flan-t5-small
, OpenAI GPT, Anthropic Claude - Indexing: FAISS semantic search
- Data Sources: TMDB and NASA APIs, Wikipedia, Web content
- Web Framework: Streamlit, FastAPI
- Deployment: Docker, AWS ECS, Google Cloud Run
- Interactive query interface
- Knowledge graph visualization
- Performance analytics
- Multi-model support
- Diverse knowledge base
- Real-time response generation
- Cloud deployment options
The RAG pipeline consists of the following steps:
- Query Processing: Parse and analyze the user query
- Document Retrieval: Find relevant documents in the knowledge base
- Context Preparation: Combine retrieved documents into a context
- Response Generation: Generate a response using the context and query
- Response Evaluation: Assess and improve the quality of the response
The knowledge graph visualizes relationships between concepts in the knowledge base:
- Entity Extraction: Identify entities in the documents
- Relation Extraction: Determine relationships between entities
- Graph Construction: Create a graph of entities and relationships
- Community Detection: Identify clusters of related entities
- Visualization: Create a visual representation of the graph
The system supports multiple language models:
- Hugging Face Models: Local models for generation
- OpenAI Models: GPT models via API
- Anthropic Models: Claude models via API
- Python 3.8+
- Git
- Terminal/Command Line
- Docker (optional, for containerized deployment)
git clone https://github.com/synthara-company/rag.git
cd rag
python3 -m venv venv
source venv/bin/activate # On macOS/Linux
# venv\Scripts\activate # On Windows
pip install -r requirements.txt
Create a .env
file in the project root with the following content:
TMDB_API_KEY=your_tmdb_api_key
NASA_API_KEY=your_nasa_api_key
OPENAI_API_KEY=your_openai_api_key # Optional
ANTHROPIC_API_KEY=your_anthropic_api_key # Optional
python sci_fi_dataset_collector.py
python rag_pipeline.py
python advanced_rag_pipeline.py
streamlit run advanced_web_interface.py
python api_server.py
python knowledge_graph_visualizer.py
cd deployment
docker-compose up -d
Once the API server is running, access the API documentation at:
http://localhost:8000/docs
- Ensure all dependencies are installed
- Check Python version compatibility
- Verify API keys in .env file
- For Docker issues, check Docker logs and ensure ports are available
- For model loading issues, try using a smaller model by modifying the configuration
- Integration with more powerful language models
- Enhanced knowledge graph visualization
- Support for multi-modal content (images, audio)
- User authentication and personalization
- Improved performance and scalability
Respect Others: Always treat others with kindness and respect. Do not engage in any form of bullying, harassment, or discrimination.
No Hate Speech: Do not post or share content that is offensive, hateful, or discriminatory towards any individual or group based on race, gender, religion, ethnicity, or sexual orientation.
No Trolling or Spamming: Do not post irrelevant or disruptive content. This includes spamming, posting off-topic content, or engaging in trolling activities that disrupt the community.
No Illegal Activities: Do not share, promote or engage in illegal activities. This includes sharing links to illegal downloads, discussing illegal activities, or selling illicit substances.
Keep It Clean: Do not post or share explicit, adult or overly violent content.
Be Relevant and Constructive: Make sure your posts are relevant to the current topic or thread. Constructive criticism is welcome, but offensive or mean-spirited comments are not.
Use Appropriate Language: Avoid swearing, offensive language, or sexually explicit language.
No Sharing Personal Information: Do not share your own or other members' personal information, such as addresses, phone numbers, or other confidential information.
Respect Intellectual Property: Do not post anything that infringes on anyone's intellectual property rights. Always credit the original source of the content.
No Promotion or Advertising: Do not advertise or promote commercial products or services without permission from the moderators.
Follow the Moderators: Listen to and respect decisions made by the moderators. They have the right to warn, kick, or ban users who violate the rules.
No Duplicate Accounts: Each user is allowed only one account.
This project is licensed under the MIT License - see the LICENSE file for details.