This project is a multi-agent collaboration chatbot designed to answer questions related to stock markets using multiple tools and APIs. It intelligently combines:
- LanceDB: For retrieving information from uploaded PDF documents.
- Polygon API: For real-time finance-related data.
- Tavily Search: For advanced internet search capabilities.
The chatbot is powered by Streamlit, providing an intuitive web interface for uploading documents and asking questions.
-
PDF Document Knowledge Base:
- Upload stock market-related PDF files to build a knowledge base.
- Extracts and indexes document content using LanceDB for quick retrieval.
-
Tool Integration:
- LanceDB: Used for answering questions based on uploaded PDFs.
- Polygon API: Fetches real-time finance-related data (e.g., stock prices, company financials).
- Bing Search: Retrieves news and additional web content.
- Tavily Search: Provides an advanced internet search experience.
-
Fallback Mechanism:
- The chatbot first attempts to answer questions using the uploaded documents.
- If no relevant answer is found, it intelligently switches to other tools (e.g., Polygon API, Bing, or Tavily).
-
Streamlit Interface:
- User-friendly interface to upload documents, ask questions, and get responses.
Users must upload PDF files related to the stock market to build a document-based knowledge base. These documents are processed and split into manageable chunks for efficient retrieval.
- Document-Based Retrieval:
- The chatbot first searches the uploaded PDFs for an answer using LanceDB.
- Fallback to Other Tools:
- If no relevant information is found in the documents, the chatbot uses:
- Polygon API: For finance-related real-time data (e.g., stock prices, financial statements).
- Bing or Tavily: For internet-based queries or news.
- If no relevant information is found in the documents, the chatbot uses:
- Upload a PDF file containing information about the stock market.
- Ask questions like:
- "What is gap up & down in share ? Answer is featched using RAG- Lancedb Tool
- "What are the financial statements of AAPL ?" Answer is fetched using the Polygon Tool
- "Latest news about the S&P 500?"
- Answer is retrieved using Tavily Tool
Ensure you have Python installed and set up a virtual environment. Then, install the required libraries:
pip install -r requirements.txt
Obtain API keys for:
- Polygon API https://polygon.io/docs/stocks/getting-started
- Tavily Search API https://tavily.com/getting-started
Add these keys to your environment variables or configuration file.
- Clone the repository.
- Navigate to the project directory.
- Run the Streamlit application:
streamlit run main.py
- Open the provided URL in your browser.