Skip to content

AmanKushwaha-17/Coder_Rag

Repository files navigation

Code Analysis Assistant 🔍

A powerful RAG (Retrieval-Augmented Generation) system that helps you analyze and understand your codebase using AI. Upload your code files and chat with an intelligent assistant that can answer questions about your code structure, functions, and architecture.

Streamlit LangChain Groq FAISS

🚀 Live Demo

Try it here!

✨ Features

  • 🔍 Smart Code Analysis: Ask questions about your codebase and get detailed explanations
  • 📁 Multi-format Support: Upload Python, JavaScript, Java, C++, HTML, CSS, and more
  • 🤖 Intelligent Routing: Smart query classification (greetings vs code analysis)
  • 🔒 User Isolation: Complete data privacy - each user gets separate storage
  • ⚡ Fast Processing: Powered by Groq's high-speed LLMs
  • 💬 Interactive Chat: Natural conversation with your codebase

🛠️ Tech Stack

  • Frontend: Streamlit
  • AI Framework: LangChain
  • LLM Provider: Groq (Llama 3 models)
  • Vector Database: FAISS
  • Embeddings: HuggingFace Sentence Transformers
  • File Processing: Multiple format support

🔧 Configuration

  1. Get GROQ API Key:

    • Visit Groq Console
    • Sign up/login to your account
    • Navigate to API Keys section
    • Create a new API key
  2. Configure in App:

    • Open the app in your browser
    • Enter your GROQ API key in the sidebar
    • Upload your code files
    • Initialize the system

🎯 Usage

Step-by-Step Guide

  1. 🔑 API Setup

    • Enter your GROQ API key in the sidebar
    • The key is stored only in your current session
  2. 📁 Upload Code Files

    • Use the right panel "Codebase Manager"
    • Upload individual files, folders, or ZIP archives
    • Supported formats: .py, .js, .java, .cpp, .c, .html, .css, .txt, .md, .json, .xml, .yaml, .yml
  3. ⚙️ Process Files

    • Click "Auto Process & Embed" to create embeddings
    • Files are split, embedded, and stored in FAISS vector database
  4. 🔄 Initialize System

    • Click "Initialize System" in the sidebar
    • System loads AI models and connects to your code database
  5. 💬 Start Chatting

    • Ask questions about your code in the chat interface
    • Get detailed analysis with code references

Example Questions

  • "What does the main function do in app.py?"
  • "How is authentication handled in this project?"
  • "Show me all the API endpoints"
  • "Explain the database connection setup"
  • "What dependencies does this project use?"

🔒 Privacy & Security

  • User Isolation: Each user gets separate data storage
  • Session-based: Data tied to browser session
  • Auto-cleanup: User data automatically deleted after 24 hours
  • No Data Sharing: Complete isolation between users
  • Local Processing: File processing happens in your environment

🐛 Troubleshooting

Common Issues

❌ "FAISS index directory not found"

  • Solution: Upload and process code files first

❌ "System not initialized"

  • Solution: Complete all setup steps (API key + files + initialization)

❌ "No API key configured"

  • Solution: Enter valid GROQ API key in sidebar

❌ File upload issues

  • Solution: Check file extensions and encoding (UTF-8)

Performance Tips

  • Start with smaller codebases for faster processing
  • Use specific questions for better results
  • Process files in batches if you have many files

📄 License

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

🙏 Acknowledgments

📞 Support

If you have any questions or need help, please open an issue on GitHub.


Happy Coding! 🚀

If you find this project useful, please give it a ⭐ on GitHub!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages