Skip to content

Agnii555/buffetbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BuffettBot - Warren Buffett Investment Advisor

πŸ€– An AI-powered chatbot that provides investment wisdom based on Warren Buffett's teachings and philosophy.

πŸš€ Features

  • πŸ’¬ Interactive Chat: Natural conversation interface for investment questions
  • πŸ” Semantic Search: AI-powered search through 4,996+ Warren Buffett Q&A pairs
  • 🧠 Contextual Responses: RAG (Retrieval-Augmented Generation) for accurate answers
  • πŸ“š Source Transparency: View the exact knowledge used for each response
  • πŸ“Š Investment Categories: Organized wisdom across multiple investment topics
  • πŸŽ›οΈ Customizable: Adjust response length, context depth, and model settings

πŸ—οΈ Architecture

  • Embeddings: sentence-transformers/all-MiniLM-L6-v2 for semantic search
  • Vector Database: FAISS for fast similarity search
  • Language Model: Google FLAN-T5 (base + optional fine-tuned version)
  • Frontend: Streamlit for interactive web interface
  • Data: 4,996+ curated Warren Buffett Q&A pairs

πŸ“‹ Quick Setup

Prerequisites

  • Python 3.8+
  • 2GB+ RAM
  • Internet connection (for initial model downloads)

Installation

  1. Clone and setup:

    git clone <repository>
    cd buffett-bot
  2. Install dependencies:

    pip install -r requirements.txt
  3. Add your data:

    # Place Dataset_Warren_Buffet_Clean.csv in the data/ folder
    cp Dataset_Warren_Buffet_Clean.csv data/
  4. Run the application:

    streamlit run app/streamlit_app.py

🎯 Usage Examples

Ask BuffettBot questions like:

  • Value Investing: "Why is margin of safety important in investing?"
  • Business Analysis: "How do you evaluate company management quality?"
  • Market Philosophy: "What's your view on market timing vs time in market?"
  • Risk Management: "How do you think about portfolio diversification?"
  • Company Evaluation: "What makes a business worth owning forever?"
  • Investment Strategy: "When should I sell a stock?"

πŸ”§ Advanced Features

Model Comparison

  • Compare responses from base FLAN-T5 vs fine-tuned BuffettBot
  • Switch between models in real-time
  • See performance differences

Fine-Tuning (Optional)

# Train a specialized model on Buffett's teachings (takes 30-60 minutes)
python scripts/train_model.py

Custom Configuration

  • Adjust response length and creativity
  • Control number of context documents
  • Toggle context visibility
  • Export chat conversations

πŸ“ Project Structure

buffett-bot/
β”œβ”€β”€ README.md
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ .env.example
β”œβ”€β”€ data/
β”‚   └── Dataset_Warren_Buffet_Clean.csv
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ embeddings.py      # Sentence transformer wrapper
β”‚   β”œβ”€β”€ retriever.py       # FAISS semantic search
β”‚   └── generator.py       # FLAN-T5 response generation
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ config.py          # Project configuration
β”‚   └── data_processor.py  # Dataset handling
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ streamlit_app.py   # Main application
β”‚   └── components/
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ chat_interface.py  # Chat UI components
β”‚       └── sidebar.py         # Sidebar components
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ setup_models.py    # Download and cache models
β”‚   β”œβ”€β”€ build_index.py     # Build FAISS search index
β”‚   └── train_model.py     # Fine-tune on Buffett data
└── saved_models/          # Cached models and indices
    β”œβ”€β”€ embeddings/
    β”œβ”€β”€ fine_tuned/
    └── faiss_index/

πŸ› οΈ Development

Running Tests

python -m pytest tests/

Building Search Index

python scripts/build_index.py

Setting up Models

python scripts/setup_models.py

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“„ License

This project is for educational purposes. Please respect OpenAI's usage policies and Warren Buffett's intellectual property.

⚠️ Disclaimer

Important: This chatbot is for educational and informational purposes only. It is not intended to provide financial advice or investment recommendations. Always consult with qualified financial advisors before making investment decisions.

πŸ”— Acknowledgments

  • Warren Buffett for his timeless investment wisdom
  • Hugging Face for the transformers library
  • OpenAI for inspiration in conversational AI
  • Streamlit for the excellent web framework

About

πŸ€– AI Investment Advisor powered by Warren Buffett's wisdom - Chat assistant + Stock analyzer with UI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages