Skip to content

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– Thunaivan โ€” AI Galaxy Chatbot

Thunaivan is a multilingual AI chatbot designed to provide intelligent, helpful, and natural conversations across knowledge, education, programming, science, mathematics, technology, writing, and creative tasks.

๐ŸŒŒ About Thunaivan

Thunaivan means "Companion" in Tamil.

The goal of this project is to build an AI companion that can understand user questions, maintain conversation context, retrieve useful information, and provide clear and helpful responses.

Thunaivan is currently being developed as a Flask-based AI chatbot and is planned to evolve into a RAG-powered intelligent assistant with a custom knowledge base, semantic search, conversation memory, multimodal capabilities, and voice interaction.


โœจ Current Features

  • ๐Ÿ’ฌ AI-powered conversations
  • ๐ŸŒ Multilingual communication
  • ๐Ÿ‡ฌ๐Ÿ‡ง English
  • ๐Ÿ‡ฎ๐Ÿ‡ณ Tamil
  • ๐Ÿ‡ฎ๐Ÿ‡ณ Hindi
  • ๐Ÿ‡ฎ๐Ÿ‡ณ Telugu
  • ๐Ÿ‡ฎ๐Ÿ‡ณ Kannada
  • ๐Ÿ‡ฎ๐Ÿ‡ณ Malayalam
  • ๐Ÿง  Context-aware conversations
  • ๐Ÿ“š General knowledge assistance
  • ๐ŸŽ“ Educational assistance
  • ๐Ÿ’ป Programming assistance
  • ๐Ÿ”ข Mathematics and problem solving
  • ๐Ÿ”ฌ Science explanations
  • ๐Ÿ“ Writing assistance
  • ๐Ÿ’ก Creative ideas
  • ๐ŸŒŒ Galaxy-themed user interface
  • ๐Ÿ“ฑ Responsive web interface
  • โšก Flask backend
  • ๐Ÿ” Environment-based API key configuration

๐Ÿง  What Can Thunaivan Do?

Thunaivan is designed to help users with:

  • General questions
  • Programming and coding
  • Computer science
  • Artificial intelligence
  • Machine learning
  • Mathematics
  • Science
  • Education
  • Technology
  • Writing
  • Summarization
  • Explanation of difficult concepts
  • Problem solving
  • Creative brainstorming
  • Project ideas
  • Learning assistance

The chatbot attempts to respond in the same language as the user whenever possible.


๐Ÿง  RAG โ€” Retrieval-Augmented Generation

One of the main future upgrades for Thunaivan is Retrieval-Augmented Generation (RAG).

Traditional AI systems depend mainly on the knowledge available inside the model. RAG allows Thunaivan to retrieve relevant information from an external knowledge base before generating an answer.

Planned RAG Flow

User Question
      โ†“
Question Processing
      โ†“
Semantic Search
      โ†“
Relevant Documents
      โ†“
Context Construction
      โ†“
AI Model
      โ†“
Grounded Answer
      โ†“
Sources

RAG can help Thunaivan provide more relevant and knowledge-grounded responses.


๐Ÿ“š Planned Knowledge Base

The future Thunaivan knowledge base can contain:

  • Educational materials
  • Programming documentation
  • Computer science notes
  • AI/ML resources
  • Mathematics resources
  • Science materials
  • Project documentation
  • PDFs
  • Text files
  • Markdown files
  • Personal notes
  • Technical documentation
  • Trusted reference materials

The knowledge base can be continuously expanded as new information is added.


๐Ÿ”Ž RAG Pipeline

1. Document Collection

PDF / TXT / MD / Documentation
              โ†“
         Knowledge Base

2. Document Processing

Documents will be cleaned and divided into smaller chunks.

Document
   โ†“
Text Extraction
   โ†“
Cleaning
   โ†“
Chunking

3. Embeddings

Each text chunk can be converted into a numerical vector using an embedding model.

Text Chunk
    โ†“
Embedding Model
    โ†“
Vector

4. Vector Database

The vectors can be stored in a vector database such as:

  • FAISS
  • Chroma
  • Pinecone
  • Qdrant
  • Weaviate

5. Retrieval

When a user asks a question, Thunaivan searches for the most relevant information.

Question
   โ†“
Query Embedding
   โ†“
Vector Search
   โ†“
Top Relevant Chunks

6. Generation

The retrieved information is provided to the AI model along with the user's question.

Question + Retrieved Context
              โ†“
           AI Model
              โ†“
         Final Answer

๐ŸŽฏ Improving Prediction Quality

Future versions will focus on improving response quality using:

  • Better prompt engineering
  • RAG
  • Semantic search
  • Hybrid search
  • Query rewriting
  • Query expansion
  • Document reranking
  • Context compression
  • Relevant document selection
  • Source citations
  • Conversation context
  • Response evaluation
  • Knowledge freshness
  • Hallucination reduction

The goal is to retrieve useful information, not simply retrieve a large amount of information.


๐Ÿง  Conversation Memory

A future version will include improved conversation memory.

Example:

User:
What is Python?

Thunaivan:
Python is a high-level programming language.

User:
What are its advantages?

Thunaivan:
Python has several advantages...

The second question can use the context of the previous conversation.

Planned memory features:

  • Short-term conversation memory
  • Conversation summaries
  • Long-term memory
  • User preferences
  • Conversation history
  • Memory controls
  • Conversation search

๐Ÿ“– Source-Aware Responses

RAG can allow Thunaivan to provide references for retrieved information.

Example:

Thunaivan:
Python is a high-level programming language...

Sources:
- Python Documentation
- Programming Knowledge Base
- Custom Learning Materials

This can make responses easier to verify and improve trust in knowledge-based answers.


๐ŸŒ Multilingual AI

Thunaivan is designed to support multiple languages.

Initial Languages

  • English
  • Tamil
  • Hindi
  • Telugu
  • Kannada
  • Malayalam

Future Language Support

More Indian and international languages can be added as the project develops.

The system should detect the user's language and respond appropriately whenever possible.


๐Ÿ—๏ธ Current Architecture

              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚     User      โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                      โ†“
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚   Web UI      โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                      โ†“
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚ Flask Backend โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                      โ†“
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚   AI API      โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                      โ†“
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚ AI Response   โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Planned RAG Architecture

                         User
                          โ†“
                       Web UI
                          โ†“
                    Flask Backend
                          โ†“
                   Query Processing
                          โ†“
                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚ Semantic Search โ”‚
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ†“
                  Knowledge Base
                          โ†“
                 Relevant Context
                          โ†“
                       AI Model
                          โ†“
                    Final Answer
                          โ†“
                       Sources

๐Ÿ› ๏ธ Technology Stack

Backend

  • Python
  • Flask
  • OpenAI API

Frontend

  • HTML
  • CSS
  • JavaScript

Future AI/RAG

  • Embedding Models
  • Vector Databases
  • Semantic Search
  • RAG Pipeline
  • Document Processing
  • Reranking

Development

  • Git
  • GitHub
  • VS Code
  • Python Virtual Environment

๐Ÿ“‚ Planned Project Structure

Thunaivan/
โ”‚
โ”œโ”€โ”€ app.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ .gitignore
โ”‚
โ”œโ”€โ”€ templates/
โ”‚   โ””โ”€โ”€ index.html
โ”‚
โ”œโ”€โ”€ static/
โ”‚   โ”œโ”€โ”€ css/
โ”‚   โ”‚   โ””โ”€โ”€ style.css
โ”‚   โ””โ”€โ”€ js/
โ”‚       โ””โ”€โ”€ script.js
โ”‚
โ”œโ”€โ”€ rag/
โ”‚   โ”œโ”€โ”€ document_loader.py
โ”‚   โ”œโ”€โ”€ chunker.py
โ”‚   โ”œโ”€โ”€ embeddings.py
โ”‚   โ”œโ”€โ”€ retriever.py
โ”‚   โ””โ”€โ”€ pipeline.py
โ”‚
โ”œโ”€โ”€ knowledge_base/
โ”‚   โ”œโ”€โ”€ documents/
โ”‚   โ””โ”€โ”€ processed/
โ”‚
โ””โ”€โ”€ tests/
    โ”œโ”€โ”€ test_chat.py
    โ””โ”€โ”€ test_rag.py

๐Ÿ”ฎ Future Features

๐Ÿค– Advanced AI

  • RAG-based question answering
  • Improved reasoning
  • Better contextual understanding
  • Query rewriting
  • Response verification
  • Multiple AI model support
  • Model selection
  • Hallucination reduction

๐Ÿ“š Knowledge System

  • PDF upload
  • Document ingestion
  • Vector database
  • Semantic search
  • Hybrid search
  • Source citations
  • Knowledge updates
  • Document management

๐Ÿง  Memory

  • Conversation history
  • Long-term memory
  • Conversation summaries
  • User preferences
  • Memory controls
  • Conversation search

๐ŸŽค Voice

Future versions may include:

  • Speech-to-text
  • Text-to-speech
  • Voice conversations
  • Voice commands
  • Multilingual voice support
๐ŸŽค User
   โ†“
Speech-to-Text
   โ†“
Thunaivan AI
   โ†“
Text-to-Speech
   โ†“
๐Ÿ”Š Thunaivan

๐Ÿ–ผ๏ธ Multimodal AI

Planned support for:

  • Image understanding
  • Image questions
  • PDF analysis
  • Screenshot analysis
  • OCR
  • Diagram understanding
  • Document analysis

๐Ÿ’ป Developer Assistant

Future features may include:

  • Code generation
  • Code explanation
  • Debugging
  • Error analysis
  • Code optimization
  • Documentation generation
  • Git/GitHub assistance
  • Multiple programming languages

๐ŸŽ“ Education Mode

Possible features:

  • Step-by-step explanations
  • Study plans
  • Quiz generation
  • Practice questions
  • Flashcards
  • Exam preparation
  • Summaries
  • Personalized learning

๐ŸŒ Web Knowledge

A future version may optionally retrieve current information from trusted online sources.

Possible capabilities:

  • Web search
  • Documentation search
  • Current information lookup
  • News retrieval
  • Source citations

๐ŸŽจ UI Improvements

Future interface improvements include:

  • Responsive mobile design
  • Dark/light themes
  • Animated galaxy background
  • Message animations
  • Markdown rendering
  • Code syntax highlighting
  • Copy response button
  • Regenerate response
  • Stop generation
  • Chat history
  • Conversation search
  • File upload
  • Voice controls

๐Ÿ” Security

Security will be an important part of future development.

Planned protections:

  • Secure API key management
  • Environment variables
  • Input validation
  • Rate limiting
  • Authentication
  • Secure file uploads
  • Access control
  • User data protection
  • Conversation privacy
  • Safe document processing

Never commit API keys or secrets to GitHub.

Example .env:

OPENAI_API_KEY=your_api_key_here

Example .gitignore:

.env
venv/
.venv/
__pycache__/
*.pyc

๐Ÿงช Testing

Future development will include automated testing.

Testing areas:

  • Chat functionality
  • API endpoints
  • RAG retrieval
  • Document processing
  • Multilingual responses
  • Conversation memory
  • Error handling
  • Security
  • Performance

Possible evaluation metrics:

Retrieval
โ†’ Precision
โ†’ Recall
โ†’ Recall@K
โ†’ MRR
โ†’ NDCG

Generation
โ†’ Relevance
โ†’ Correctness
โ†’ Groundedness
โ†’ Completeness
โ†’ Citation Accuracy

๐Ÿ—บ๏ธ Development Roadmap

Phase 1 โ€” Basic Chatbot

  • Flask backend
  • Web interface
  • AI API integration
  • Basic conversation
  • Galaxy-themed UI

Phase 2 โ€” Better Chat Experience

  • Chat history
  • Markdown support
  • Code highlighting
  • Regenerate response
  • Better error handling
  • Mobile optimization

Phase 3 โ€” RAG

  • Document ingestion
  • Text chunking
  • Embeddings
  • Vector database
  • Semantic retrieval
  • Context-aware generation
  • Source citations

Phase 4 โ€” Memory

  • Conversation summaries
  • Long-term memory
  • User preferences
  • Memory controls
  • Conversation search

Phase 5 โ€” Multimodal

  • Image understanding
  • PDF analysis
  • OCR
  • Screenshot analysis
  • Document understanding

Phase 6 โ€” Voice

  • Speech-to-text
  • Text-to-speech
  • Voice conversations
  • Multilingual voice

Phase 7 โ€” Production

  • Authentication
  • Database
  • Rate limiting
  • Monitoring
  • Automated testing
  • Deployment
  • Performance optimization

๐Ÿš€ Getting Started

1. Clone the Repository

git clone https://github.com/YOUR_USERNAME/Thunaivan.git
cd Thunaivan

2. Create Virtual Environment

Windows:

python -m venv venv
venv\Scripts\activate

Linux/macOS:

python3 -m venv venv
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure API Key

Create .env:

OPENAI_API_KEY=your_api_key_here

5. Run Thunaivan

python app.py

Open:

http://127.0.0.1:5000

๐Ÿ“Œ Project Status

๐Ÿšง Thunaivan is currently under active development.

The current version provides the foundation for an AI chatbot. RAG, vector search, advanced memory, multimodal AI, voice interaction, and production infrastructure are planned future improvements.

Features marked as planned are not necessarily available in the current version.


๐ŸŒŸ Vision

The long-term vision of Thunaivan is to become a versatile AI companion that can:

Understand
    โ†“
Retrieve
    โ†“
Reason
    โ†“
Explain
    โ†“
Remember
    โ†“
Assist

The project aims to combine conversational AI with reliable external knowledge, multilingual communication, useful tools, and an intuitive user experience.


๐Ÿค Contributions

Contributions and ideas are welcome.

Future contributions can focus on:

  • RAG
  • AI evaluation
  • UI/UX
  • Multilingual support
  • Voice interaction
  • Document processing
  • Security
  • Testing
  • Performance
  • Accessibility

๐Ÿ“œ License

This project is currently under development.

A suitable open-source license can be added before public distribution.


โญ Support

If you find Thunaivan interesting:

โญ Star the repository ๐Ÿ› Report bugs ๐Ÿ’ก Suggest features ๐Ÿ”ง Contribute improvements ๐Ÿ“š Contribute knowledge sources


Built with Python, Flask, AI, and a vision for a smarter digital companion. ๐ŸŒŒ๐Ÿค–

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages