Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crypto RAG Assistant

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.

Features

  • 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.

Project Structure

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 file

Setup and Installation

1. Prerequisites

  • Python 3.8+
  • A Kaggle Account
  • A Google Gemini API Key

2. Clone the Repository & Install Dependencies

git clone https://github.com/ludmuniz/Gemini-Crypto-Analyst.git
cd crypto-rag-assistant
pip install -r requirements.txt

3. Configure Your API Keys

You 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.json file.
  • Move this kaggle.json file to the ~/.kaggle/ directory on your computer.
    1. Linux/macOS: mkdir -p ~/.kaggle && mv /path/to/download/kaggle.json ~/.kaggle/
    1. Windows: C:\Users\<YourUsername>\.kaggle\ (create the folder if it doesn't exist).

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"

4. Download Data and Create Embeddings

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.py

You only need to run this command once. It handles everything.

5. Launch the Streamlit App

After the script above completes successfully, start the web interface:

streamlit run app/ui_streamlit.py

Your browser will automatically open a new tab with the running application, ready for you to use!

License

This project is open-source and free to use for educational or academic purposes.

About

An AI-powered Crypto Analyst that answers your questions about the cryptocurrency market using Google's Gemini, LangChain, and RAG.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages