Skip to content

KiranDevStud/Numerical-Reasoning-Assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Numerical Reasoning Assistant

An AI-powered assistant designed to solve complex mathematical reasoning problems using RAG (Retrieval-Augmented Generation). It leverages the GSM8K dataset, Google Gemini for both embeddings and reasoning, and provides a Python execution environment to verify results.

Features

  • RAG-based Reasoning: Uses relevant examples from the GSM8K dataset to improve solution accuracy.
  • Python Execution: Automatically extracts and runs Python code generated by the LLM to verify numerical answers.
  • Quota Management: Automatically falls back to direct solving if embedding API limits are reached.
  • Interactive UI: Built with Streamlit for a seamless user experience.

Prerequisites

  • Python 3.9+
  • A Google API Key (for Gemini)

Installation

  1. Clone the repository:

  2. Set up a virtual environment:

    python -m venv .venv
    .\.venv\Scripts\Activate.ps1  #windows
  3. Install dependencies:

    pip install -r requirements.txt
  4. Configure Environment Variables: Create a .env file in the root directory and add your Google API key:

    GOOGLE_API_KEY=your_api_key_here

Data Ingestion

Before running the app, you need to populate the vector database with the GSM8K dataset. You can downlaod the GSM8K dataset from here.

  1. Ensure the dataset (train-00000-of-00001.parquet) is available at the path specified in data_ingestion.py.
  2. Run the ingestion script:
    python data_ingestion.py
    Note: This process uses Gemini embeddings and includes sleeps to respect rate limits.

Running the Application

Start the Streamlit dashboard:

streamlit run app.py

Open the provided URL in your browser to start solving math problems!

Project Structure

  • app.py: The main Streamlit application.
  • rag_chain.py: Core logic for RAG and LLM integration.
  • data_ingestion.py: Script to load and persist data to ChromaDB.
  • requirements.txt: List of Python dependencies.
  • chroma_db/: Directory containing the persisted vector database.
  • .env: Environment variables (API keys).

About

An AI-powered assistant designed to solve complex mathematical reasoning problems using RAG (Retrieval-Augmented Generation). It leverages the GSM8K dataset, Google Gemini for both embeddings and reasoning, and provides a Python execution environment to verify results.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages