Skip to content

akcode7/nasa_hackathon_rag

Repository files navigation

NASA Research Assistant - RAG Chatbot

An AI-powered research assistant that helps explore NASA research papers using Retrieval-Augmented Generation (RAG) technology. Built with Next.js, Pinecone vector database, and Google's Gemini Flash model.

Features

  • 🚀 NASA Research Database: Access to comprehensive NASA research papers and studies
  • 🤖 AI-Powered Chat: Intelligent responses using Google Gemini Flash model
  • 🔍 Vector Search: Advanced semantic search through Pinecone vector database
  • 📊 Research Categories: Organized exploration tabs for different research areas:
    • Astrobiology & Life Sciences
    • Mars Research & Exploration
    • Exoplanet Discovery & Analysis
    • Space Medicine & Human Factors
  • 🎨 Modern UI: Responsive design with NASA-themed styling and dark mode
  • 📱 Mobile Friendly: Optimized for all device sizes

Prerequisites

Before you begin, ensure you have:

  • Node.js 18+ installed
  • Pinecone account with vector database indexes already uploaded
  • Google AI API key for Gemini Flash model

Environment Setup

  1. Clone the repository:
git clone https://github.com/akcode7/nasa_hackathon_rag.git
cd nasa_hackathon_rag
  1. Install dependencies:
npm install
  1. Create .env.local file with your API keys:
# Pinecone Configuration
PINECONE_API_KEY=your_pinecone_api_key_here
PINECONE_INDEX_NAME=your_nasa_index_name_here

# Google Gemini API Configuration
GOOGLE_API_KEY=your_gemini_api_key_here

# App Configuration
NODE_ENV=development

API Keys Setup

Pinecone Setup

  1. Sign up at Pinecone
  2. Create a new index with your NASA research data
  3. Copy your API key and index name to .env.local

Google Gemini API Setup

  1. Visit Google AI Studio
  2. Create a new API key
  3. Add it to your .env.local file

Running the Application

  1. Start the development server:
npm run dev
  1. Open http://localhost:3000 in your browser

Data Sources

This project is designed to work with NASA research papers from:

Usage

  1. Start a Conversation: Ask questions about NASA research, space biology, or planetary science
  2. Explore Categories: Use the suggestion tabs to explore different research areas
  3. View Sources: Each AI response includes references to relevant research papers
  4. Follow Suggestions: Click on suggested questions to dive deeper into topics

Project Structure

src/
├── app/
│   ├── api/
│   │   ├── chat/          # Chat API endpoint
│   │   └── suggestions/   # Suggestions API endpoint
│   ├── layout.js          # Root layout
│   └── page.js           # Main page
├── components/
│   └── ChatInterface.js   # Main chat UI component
└── lib/
    ├── pinecone.js       # Pinecone vector DB integration
    └── gemini.js         # Gemini AI integration

Key Features Implementation

RAG Pipeline

  1. Query Processing: User questions are processed and optimized
  2. Vector Search: Relevant research papers retrieved from Pinecone
  3. Context Building: Research context assembled for AI model
  4. Response Generation: Gemini Flash generates informed responses
  5. Source Attribution: Citations and sources provided with answers

Suggestion System

  • Dynamic suggestions based on active research category
  • AI-generated exploration prompts
  • Curated questions covering major NASA research themes

Deployment

Vercel Deployment

  1. Push your code to GitHub
  2. Connect your repository to Vercel
  3. Add environment variables in Vercel dashboard
  4. Deploy automatically

Other Platforms

The app can be deployed on any Node.js hosting platform. Ensure environment variables are configured properly.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Troubleshooting

Common Issues

API Keys Not Working:

  • Verify all environment variables are set correctly
  • Check API key permissions and quotas

Pinecone Connection Issues:

  • Ensure your Pinecone index name is correct
  • Verify your vector database has data uploaded

No Research Results:

  • Check if your Pinecone index contains NASA research data
  • Verify index metadata structure matches the expected format

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • NASA for providing research data and inspiration
  • Pinecone for vector database technology
  • Google for Gemini AI model
  • Next.js team for the excellent framework

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors