StockBot is an intelligent chatbot designed to provide accurate answers related to stock market queries. Built on the Retrieval Augmented Generation (RAG) structure, StockBot leverages the power of two cutting-edge language models: Gemini Pro and Llama-2-7B. With its vast knowledge base encompassing PDFs and documents, StockBot delivers precise responses to user inquiries, making it an indispensable tool for investors and traders alike.
-
Advanced Models: StockBot harnesses the capabilities of Gemini Pro and Llama-2-7B models, enabling it to understand complex queries and generate informative responses.
-
Knowledge Base: StockBot's knowledge base comprises PDFs and documents related to the stock market, ensuring comprehensive coverage of relevant information.
-
Accurate Embeddings: By employing the "hkunlp/instructor-lar" embedding model, StockBot delivers accurate storage and contextually relevant answers to user queries.
-
Data Management: Leveraging DataStax as the database solution, StockBot efficiently manages and retrieves information, ensuring smooth operation even with large volumes of data.
-
User-friendly Interface: StockBot features a sleek and intuitive user interface built using ReactJs and Material UI, providing users with a seamless experience.
-
Backend Processing: Powered by Python FastAPI, StockBot's backend handles the heavy lifting of processing queries and generating responses, ensuring robust performance.
- HTML, CSS
- JavaScript
- ReactJs
- Material UI
- Python
- FastAPI
- Langchain
- Datastax AstraDB (Vector Database)
- FAISS
- TheBloke/Llama-2-7B-chat-GPTQ
- Google Gemini Pro
- hkunlp/instructor-large
git clone https://github.com/Ans155/StockBot.git
cd StockBot
To deploy StockBot locally, follow these steps:
Python is required to run StockBot. If you don't have Python installed, follow these steps:
Download the latest Python installer from the official Python website.
Run the installer and make sure to check the box that says Add Python to PATH
during installation.
You can install Python using Homebrew, a package manager for macOS, with the following command in the terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then install Python:
brew install python
It's recommended to use a virtual environment to avoid conflicts with other projects or system-wide Python packages.
First, ensure you have pip installed (it comes with Python if you're using version 3.4 and above). Install virtualenv by running:
pip install virtualenv
Navigate to your project's directory in the terminal. Run the following command to create a virtual environment named venv (you can name it anything you like):
Python -m virtualenv venv
- On Windows, activate the virtual environment by running:
venv\Scripts\activate
- On macOS and Linux, activate it with:
source venv/bin/activate
Once your virtual environment is activated, you'll see its name in the terminal prompt. Now you're ready to use StockBot.
With the virtual environment activated, you can now install the required packages for StockBot. This is done using the pip
package manager. Follow these steps:
- Navigate to the directory containing the
requirements.txt
file in the terminal. - Run the following command to install the required packages:
cd server
pip install -r requirements.txt
Obtain a Google Gemini API key and create a DataStax AstraDB account. Configure a new database and set DataStax AstraDB token, DataStax AstraDB API endpoint, and Google Gemini API key as environment variables.
To ingest data into StockBot, follow these steps:
- Navigate to the
server
directory in the terminal. - Locate the
upload.py
script. - Run the following command to execute the script:
Python upload.py
To run the FastAPI backend server for StockBot, follow these steps:
- Navigate to the
server
directory in the terminal. - Locate the
test.py
script. - Run the following command to start the FastAPI server:
uvicorn app:test --reload
This command will start the FastAPI server, allowing StockBot to process user queries and generate responses. Once the server is up and running, StockBot is ready to use.
Install dependencies for the client:
cd client
npm install
Start the client :
In the client directory, run npm start to start the React app. Access the app in your browser at http://localhost:3000.
To test the functionalities of our app, utilize the provided .ipynb
files. Open StockBot_using_LLAMA_2.ipynb
for StockBot with Llama2 LLM or Bot_using_GeminiAPI.ipynb
for StockBot with Gemini LLM in Google Colab or any other virtual environment of your choice to experiment with the app.