This project implements an intelligent assistant for cryptocurrency investors using a Retrieval-Augmented Generation (RAG) pipeline with LangChain, Google Gemini, and Streamlit. The assistant automatically downloads historical price data from Kaggle and answers natural language questions about 23 different cryptocurrencies.
Note on Data: The underlying dataset from Kaggle (sudalairajkumar/cryptocurrencypricehistory) contains historical data for various cryptocurrencies, with records for major coins like Bitcoin starting as early as 2014-2021.
- Automated Data Fetching: Downloads and prepares the required dataset from Kaggle with a single command.
- Natural Language Queries: Ask questions in plain English about historical price data.
- RAG Pipeline with Gemini: Uses LangChain to retrieve relevant data chunks and generate informed answers with Google's Gemini LLM.
- Statistical Analysis: Enriches answers with basic stats like volatility and trends.
- Interactive UI: A clean and intuitive web interface built with Streamlit.
crypto-rag-assistant/
├── data/ # Contains CSVs downloaded from Kaggle
├── embeddings/ # Stores the vector database
├── app/ # Main application logic
│ ├── downloader.py # Downloads data from Kaggle
│ ├── ingest.py # Loads and processes CSVs
│ ├── embedder.py # Creates embeddings and stores vectors
│ ├── retriever.py # LangChain retriever configuration
│ ├── chains.py # QA chains using LangChain
│ └── ui_streamlit.py # Streamlit user interface
├── utils/ # Helper functions (stats, plots)
│ └── analysis.py
├── .env # File for your API keys (you must create this)
├── requirements.txt # All project dependencies
└── README.md # This fileSetup and Installation
- Python 3.8+
- A Kaggle Account
- A Google Gemini API Key
git clone https://github.com/ludmuniz/Gemini-Crypto-Analyst.git
cd crypto-rag-assistant
pip install -r requirements.txtYou will need two API keys: one from Kaggle (to download data) and one from Google (for the LLM).
a) Kaggle API Setup
- Log in to your Kaggle account and go to your Account page.
- In the "API" section, click "Create New API Token". This will download a
kaggle.jsonfile. - Move this
kaggle.jsonfile to the~/.kaggle/directory on your computer. -
Linux/macOS: mkdir -p ~/.kaggle && mv /path/to/download/kaggle.json ~/.kaggle/
-
- Windows:
C:\Users\<YourUsername>\.kaggle\(create the folder if it doesn't exist).
- Windows:
b) Google Gemini API Setup
- Create a file named .env in the root of the project (crypto-rag-assistant/) and add your Google API key:
GOOGLE_API_KEY="your_gemini_api_key_here"With your API keys configured, run the following command in your terminal. This script will download the data from Kaggle, process it, and create the vector database. Note: If you have an old embeddings folder from a previous run, delete it before running this command.
python app/embedder.pyYou only need to run this command once. It handles everything.
After the script above completes successfully, start the web interface:
streamlit run app/ui_streamlit.pyYour browser will automatically open a new tab with the running application, ready for you to use!
This project is open-source and free to use for educational or academic purposes.