ποΈ Gita Assistant: AI Spiritual Guide based on Bhagavad Gita
"Your personal AI guide to the timeless wisdom of Bhagavad Gita"
βYoga is the journey of the self, through the self, to the self.β β Bhagavad Gita
An AI-powered spiritual assistant inspired by the timeless wisdom of the Bhagavad Gita, designed to provide guidance, self-reflection, and mindfulness through teachings of Lord Krishna.
π Model Description
The Gita Assistant is an AI-powered spiritual guide that provides personalized advice and solutions based on the sacred teachings of the Bhagavad Gita. This is a fully independent model fine-tuned specifically for understanding and responding to spiritual queries using Gita wisdom.
- Developed by: Shubhagaman
- Model type: RAG (Retrieval Augmented Generation) System
- Language(s): English, Hindi, Sanskrit (Multilingual support)
- License: MIT
- Finetuned from:
sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 - Repository: Gita Assistant
- Embeddings Model: Gita Embeddings
π― What This Model Does
The Gita Assistant helps users find spiritual guidance by:
- π Understanding spiritual questions in multiple languages
- π Retrieving relevant passages from Bhagavad Gita
- π Providing contextual advice based on ancient wisdom
- π§ Offering practical solutions for modern life problems
ποΈ Model Architecture
This project consists of two main components:
1. Gita Assistant (This Repository)
- Purpose: Main application and user interface
- Contains:
- RAG pipeline implementation
- FAISS search index (
geeta_finetuned.index) - Gita text chunks (
geeta_chunks.pkl) - Application code and examples
2. Gita Embeddings (Separate Repository)
- Purpose: Specialized text embedding model
- Features:
- Fine-tuned on Bhagavad Gita content
- Multilingual understanding (English, Hindi, Sanskrit)
- Domain-optimized for spiritual texts
π Quick Start
Installation
pip install sentence-transformers faiss-cpu torch transformers numpy
π Training Data
Model Fine-tuned On:
- Primary Source: Complete text of Bhagavad Gita
- Languages: English and Hindi translations
- Chapters: All 18 chapters with 700 verses
Training Approach:
- Domain-specific fine-tuning
- Multilingual sentence embeddings
- Spiritual context optimization
π Intended Use Cases
β Appropriate Uses
- Personal spiritual guidance and self-reflection
- Academic study of the Bhagavad Gita
- Counseling and mental well-being support
- Cultural and religious education
- Meditation and mindfulness practices
β Limitations
- Not a substitute for professional psychological help
- Limited to Gita teachings (does not cover other scriptures)
- Cultural context may vary across interpretations
- AI-generated guidance should be considered supplementary
β οΈ Ethical Considerations
- Spiritual Sensitivity: Treats religious content with utmost respect
- Cultural Context: Acknowledges diverse interpretations
- Privacy: No personal data collection or storage
- Transparency: Clearly identifies as AI-generated guidance
π§ Technical Details
π§ Model Specifications
- Base Architecture: Transformer-based embeddings
- Embedding Dimensions: 384
- Max Sequence Length: 512 tokens
- Supported Languages: English, Hindi, Sanskrit
π File Structure
Gita-assistant/
βββ app.py # Main application code
βββ geeta_chunks.pkl # Gita text chunks
βββ geeta_finetuned.index # FAISS search index
βββ requirements.txt # Dependencies
βββ README.md # This file
βββ examples/ # Usage examples
βββ basic_usage.py
βββ advanced_usage.py
π¦ Dependencies
python sentence-transformers>=2.2.2 faiss-cpu>=1.7.4 torch>=1.9.0 transformers>=4.21.0 numpy>=1.21.0
π Example Interactions
π§ Example 1: Life Guidance
User Question:
"I'm feeling lost in my career, what should I do?"
Gita Assistant Response:
Based on the wisdom of Bhagavad Gita:
- "You have the right to perform your prescribed duties, but you are not entitled to the fruits of your actions." (Chapter 2, Verse 47)
- "Perform your duty equipoised, O Arjuna, abandoning all attachment to success or failure." (Chapter 2, Verse 48)
- "It is better to engage in one's own occupation, even though one may perform it imperfectly, than to accept another's occupation and perform it perfectly." (Chapter 18, Verse 47)
Remember: The Gita teaches us to focus on our duties without attachment to results.
π§ Example 2: Emotional Support
User Question:
"How to handle anger and frustration?"
Gita Assistant Response:
Based on the wisdom of Bhagavad Gita:
- "From anger comes delusion, from delusion confusion of memory, from confusion of memory loss of intellect, and from loss of intellect one perishes." (Chapter 2, Verse 63)
- "A person who is not disturbed by the incessant flow of desires can achieve peace." (Chapter 2, Verse 70)
- "When a person gives up all varieties of desire for sense gratification, which arise from mental concoction, and when his mind finds satisfaction in the self alone, then he is said to be in pure transcendental consciousness." (Chapter 2, Verse 55)
Remember: The Gita teaches us to focus on our duties without attachment to results.
π Updating and Improving the Model
β Adding New Training Data
from sentence_transformers import SentenceTransformer, InputExample, losses
from torch.utils.data import DataLoader
import pickle
# Load your current model
model = SentenceTransformer('Shubhagaman/Gita-embeddings')
# Prepare new training examples
with open('geeta_chunks.pkl', 'rb') as f:
chunks = pickle.load(f)
train_examples = []
for chunk in chunks[:500]:
train_examples.append(InputExample(texts=[chunk, chunk]))
# Fine-tune further
train_dataloader = DataLoader(train_examples, shuffle=True, batch_size=8)
train_loss = losses.MultipleNegativesRankingLoss(model)
model.fit(
train_objectives=[(train_dataloader, train_loss)],
epochs=1,
show_progress_bar=True
)
# Save updated model
model.save_pretrained('./Gita-embeddings-updated')
π§± Recreating Search Index
import faiss
import numpy as np
# After updating embeddings, recreate FAISS index
def create_new_index(model, chunks, index_path='geeta_updated.index'):
embeddings = model.encode(chunks)
dimension = embeddings.shape[1]
index = faiss.IndexFlatIP(dimension)
faiss.normalize_L2(embeddings)
index.add(embeddings.astype('float32'))
faiss.write_index(index, index_path)
print(f"β
New index created with {index.ntotal} vectors")
return index
π Training Data
Model Fine-tuned On:
- Primary Source: Complete text of Bhagavad Gita
- Languages: English and Hindi translations
- Chapters: All 18 chapters with 700 verses
Training Approach:
- Domain-specific fine-tuning
- Multilingual sentence embeddings
- Spiritual context optimization
π Intended Use Cases
β Appropriate Uses
- Personal spiritual guidance and self-reflection
- Academic study of the Bhagavad Gita
- Counseling and mental well-being support
- Cultural and religious education
- Meditation and mindfulness practices
β Limitations
- Not a substitute for professional psychological help
- Limited to Gita teachings (does not cover other scriptures)
- Cultural context may vary across interpretations
- AI-generated guidance should be considered supplementary
β οΈ Ethical Considerations
- Spiritual Sensitivity: Treats religious content with utmost respect
- Cultural Context: Acknowledges diverse interpretations
- Privacy: No personal data collection or storage
- Transparency: Clearly identifies as AI-generated guidance
π§ Technical Details
π§ Model Specifications
- Base Architecture: Transformer-based embeddings
- Embedding Dimensions: 384
- Max Sequence Length: 512 tokens
- Supported Languages: English, Hindi, Sanskrit
π File Structure
Gita-assistant/
βββ app.py # Main application code
βββ geeta_chunks.pkl # Gita text chunks
βββ geeta_finetuned.index # FAISS search index
βββ requirements.txt # Dependencies
βββ README.md # This file
βββ examples/ # Usage examples
βββ basic_usage.py
βββ advanced_usage.py
π¦ Dependencies
python
sentence-transformers>=2.2.2
faiss-cpu>=1.7.4
torch>=1.9.0
transformers>=4.21.0
numpy>=1.21.0
π Example Interactions
π§ Example 1: Life Guidance
User Question:
"I'm feeling lost in my career, what should I do?"
Gita Assistant Response:
Based on the wisdom of Bhagavad Gita:
- "You have the right to perform your prescribed duties, but you are not entitled to the fruits of your actions." (Chapter 2, Verse 47)
- "Perform your duty equipoised, O Arjuna, abandoning all attachment to success or failure." (Chapter 2, Verse 48)
- "It is better to engage in one's own occupation, even though one may perform it imperfectly, than to accept another's occupation and perform it perfectly." (Chapter 18, Verse 47)
Remember: The Gita teaches us to focus on our duties without attachment to results.
π§ Example 2: Emotional Support
User Question:
"How to handle anger and frustration?"
Gita Assistant Response:
Based on the wisdom of Bhagavad Gita:
- "From anger comes delusion, from delusion confusion of memory, from confusion of memory loss of intellect, and from loss of intellect one perishes." (Chapter 2, Verse 63)
- "A person who is not disturbed by the incessant flow of desires can achieve peace." (Chapter 2, Verse 70)
- "When a person gives up all varieties of desire for sense gratification, which arise from mental concoction, and when his mind finds satisfaction in the self alone, then he is said to be in pure transcendental consciousness." (Chapter 2, Verse 55)
Remember: The Gita teaches us to focus on our duties without attachment to results.
π Updating and Improving the Model
β Adding New Training Data
from sentence_transformers import SentenceTransformer, InputExample, losses
from torch.utils.data import DataLoader
import pickle
# Load your current model
model = SentenceTransformer('Shubhagaman/Gita-embeddings')
# Prepare new training examples
with open('geeta_chunks.pkl', 'rb') as f:
chunks = pickle.load(f)
train_examples = []
for chunk in chunks[:500]:
train_examples.append(InputExample(texts=[chunk, chunk]))
# Fine-tune further
train_dataloader = DataLoader(train_examples, shuffle=True, batch_size=8)
train_loss = losses.MultipleNegativesRankingLoss(model)
model.fit(
train_objectives=[(train_dataloader, train_loss)],
epochs=1,
show_progress_bar=True
)
# Save updated model
model.save_pretrained('./Gita-embeddings-updated')
π§± Recreating Search Index
import faiss
import numpy as np
# After updating embeddings, recreate FAISS index
def create_new_index(model, chunks, index_path='geeta_updated.index'):
embeddings = model.encode(chunks)
dimension = embeddings.shape[1]
index = faiss.IndexFlatIP(dimension)
faiss.normalize_L2(embeddings)
index.add(embeddings.astype('float32'))
faiss.write_index(index, index_path)
print(f"β
New index created with {index.ntotal} vectors")
return index
π€ Contributing
We welcome contributions from:
- Spiritual scholars and practitioners
- AI/ML developers
- Multilingual translators
- Open-source enthusiasts
Contribution Guidelines
Fork the repository
Create a feature branch:
git checkout -b feature/amazing-featureCommit your changes:
git commit -m "Add amazing feature"Push to the branch:
git push origin feature/amazing-featureOpen a Pull Request
π Citation
If you use this model in your research or application, please cite:
@software{gita_assistant_2025,
title = {Gita Assistant: AI Spiritual Guide based on Bhagavad Gita},
author = {Shubhagaman},
year = {2024},
url = {https://huggingface.co/Shubhagaman/Gita-assistant},
note = {Multilingual RAG system for spiritual guidance}
}
π Support
- Issues: GitHub Issues
- Discussions: Hugging Face Discussions
- Email: [[email protected]]
π Acknowledgments
- The eternal wisdom of Bhagavad Gita
- Hugging Face for the open-source ecosystem
- SentenceTransformers library
- The spiritual community for guidance and feedback
π License
This project is licensed under the MIT License β see the LICENSE file for details.
β¨ May this assistant help you on your spiritual journey. β¨ ποΈ Lokah Samastah Sukhino Bhavantu β "May all beings be happy and free"
π Related Repositories
- Gita Embeddings Model β The specialized embedding model used by this assistant
- Bhagavad Gita Dataset β The training dataset used for fine-tuning
π Latest Updates
- v1.0 (Current): Initial release with multilingual support
- Planned: Enhanced answer generation, more languages, mobile app
Last updated: December 2024