πŸ•‰οΈ 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.


GitHub Hugging Face License Python

πŸ“– 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

  1. Fork the repository

  2. Create a feature branch:

    git checkout -b feature/amazing-feature
    
  3. Commit your changes:

    git commit -m "Add amazing feature"
    
  4. Push to the branch:

    git push origin feature/amazing-feature
    
  5. Open 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


πŸ™ 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

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ 1 Ask for provider support