DevChat โ AI powered project-aware coding assistant
Project description
Copy๐ค DevChat - AI-Powered Local Coding Assistant
DevChat is an intelligent, project-aware coding assistant that understands your entire codebase using RAG (Retrieval-Augmented Generation) technology. Ask questions, get instant answers, and even fix bugs - all from your terminal!
๐ Why DevChat? Traditional AI assistants don't understand your specific project. DevChat indexes your entire codebase, creates semantic embeddings, and gives you context-aware answers specific to YOUR code. โจ Key Features
๐ง Project-Aware Intelligence - Understands your complete codebase context ๐ Smart Code Search - Find functions, classes, and files using natural language ๐ฌ Interactive Chat - Ask questions in plain English ๐ ๏ธ Automatic Bug Fixes - Detects and applies code fixes with approval โก Lightning Fast - Uses FAISS vector search for instant results ๐ฏ Multi-Mode Operation - File-specific, project-wide, and general chat modes ๐ Smart File Detection - Automatically detects which files are relevant ๐ Powered by Groq - Uses fast Llama 3.1 model for responses
๐ฆ Installation Requirements
Python 3.9 or higher Groq API Key (Get one free here)
Install via pip bashpip install devchat-hm Set up your API key bash# Linux/Mac export GROQ_API_KEY="your-groq-api-key-here"
Windows (PowerShell)
$env:GROQ_API_KEY="your-groq-api-key-here"
Windows (CMD)
set GROQ_API_KEY=your-groq-api-key-here
๐ Quick Start
- Run DevChat bashdevchat
- Enter your project path when prompted Enter project path: /path/to/your/project
- Wait for indexing (one-time process) ๐ Indexing project files... โ Indexed: /path/to/your/project/main.py โ Indexed: /path/to/your/project/utils.py ... ๐ค DevChat is ready. Ask questions.
- Start asking questions! ๐งโ๐ป > What does the main.py file do? ๐ค DevChat: The main.py file contains the entry point of the application...
๐งโ๐ป > How is authentication handled? ๐ค DevChat: Authentication is implemented in auth.py using JWT tokens...
๐งโ๐ป > Fix the bug in utils.py line 45 ๐ค DevChat: FILE: utils.py START_LINE: 45 END_LINE: 48 CODE: def process_data(data): if data is None: return [] return [item.strip() for item in data]
Apply fix? (y/n):
๐ฏ How It Works DevChat operates in 3 intelligent modes: 1๏ธโฃ File-Specific Mode When you mention a specific file (e.g., main.py, utils.js), DevChat retrieves only that file's content. ๐งโ๐ป > What functions are in auth.py? 2๏ธโฃ Project-Wide Mode For general project questions, DevChat searches across all indexed files using semantic similarity. ๐งโ๐ป > Where is the database connection configured? 3๏ธโฃ General Chat Mode For non-code questions, DevChat acts like a helpful AI assistant. ๐งโ๐ป > Explain what REST APIs are
๐ ๏ธ Advanced Features Automatic Code Fixes DevChat can detect when you want to modify code and generates precise fixes: ๐งโ๐ป > Fix the error in main.py line 23 - variable 'user' might be None ๐ค DevChat: FILE: main.py START_LINE: 23 END_LINE: 25 CODE: if user is not None: print(user.name) else: print("User not found")
Apply fix? (y/n): y โ Fix applied successfully! Supported Languages DevChat supports the following file types:
Python (.py) JavaScript (.js, .jsx) Java (.java) C/C++ (.c, .cpp, .h) HTML/CSS (.html, .css) JSON (.json) TypeScript (.ts)
Smart Folder Exclusion DevChat automatically ignores:
node_modules/ .git/ pycache/ dist/, build/ .next/ .venv/
๐ง Configuration DevChat uses a simple configuration system. Key settings are in devchat/config.py: pythonclass Config: GROQ_API_KEY = os.getenv("GROQ_API_KEY") MODEL = "llama-3.1-8b-instant" # LLM model EMBEDDING_MODEL = "all-MiniLM-L6-v2" # Embedding model VECTOR_DB_PATH = "devchat.index" # Index storage path Custom Configuration You can modify these settings by creating a custom config: pythonfrom devchat.config import Config
Config.MODEL = "llama-3.1-70b-versatile" # Use a larger model Config.VECTOR_DB_PATH = "custom_index.db" # Custom index location
๐ Technical Architecture โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ User Question โ โโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โผ โโโโโโโโโโโโโโโโโโโโโโโโโ โ Question Analyzer โ โ (File/Project/Chat) โ โโโโโโโโโโโโโฌโโโโโโโโโโโโ โ โโโโโโโโโโโโโโดโโโโโโโโโโโโโ โ โ โผ โผ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ File Search โ โ Vector Store โ โ (Exact) โ โ (Semantic) โ โโโโโโโโฌโโโโโโโโ โโโโโโโโฌโโโโโโโโ โ โ โโโโโโโโโโโโโโฌโโโโโโโโโโโโโ โ โผ โโโโโโโโโโโโโโโโโโโโโโโโโ โ Build Context โ โ (Top-K Documents) โ โโโโโโโโโโโโโฌโโโโโโโโโโโโ โ โผ โโโโโโโโโโโโโโโโโโโโโโโโโ โ LLM (Groq/Llama) โ โ Generate Response โ โโโโโโโโโโโโโฌโโโโโโโโโโโโ โ โผ โโโโโโโโโโโโโโโโโโโโโโโโโ โ Response Parser โ โ (Fix Detection) โ โโโโโโโโโโโโโฌโโโโโโโโโโโโ โ โผ โโโโโโโโโโโโ โ Output โ โโโโโโโโโโโโ Core Components
Indexer (indexer.py) - Scans project and creates document embeddings Vector Store (vectorstore.py) - FAISS-based similarity search RAG (rag.py) - Builds context from relevant documents LLM (llm.py) - Groq API integration for responses Chat Loop (chat.py) - Main interaction logic with 3 modes Editor (editor/) - Code diff, parsing, and patching tools
๐ก Usage Examples Example 1: Understanding Code Structure ๐งโ๐ป > What classes are defined in models.py? ๐ค DevChat: The models.py file defines 3 classes:
- User - Represents user accounts
- Post - Represents blog posts
- Comment - Represents post comments Example 2: Finding API Endpoints ๐งโ๐ป > Where are the API routes defined? ๐ค DevChat: API routes are defined in routes/api.py:
- GET /api/users - Fetch all users
- POST /api/users - Create new user
- GET /api/posts - Fetch all posts Example 3: Debugging Errors ๐งโ๐ป > Why am I getting "KeyError: 'user_id'" in app.py? ๐ค DevChat: In app.py line 34, you're accessing request.form['user_id'] without checking if it exists. Use request.form.get('user_id') instead to avoid KeyError. Example 4: Code Modification ๐งโ๐ป > Update the database connection timeout to 30 seconds in config.py ๐ค DevChat: FILE: config.py START_LINE: 12 END_LINE: 12 CODE: DB_TIMEOUT = 30 # seconds
Apply fix? (y/n): y โ Fix applied successfully!
๐ Best Practices
- Be Specific โ "Tell me about the code" โ "What does the authenticate() function in auth.py do?"
- Mention File Names Including file names helps DevChat give precise answers: ๐งโ๐ป > How does error handling work in utils.py?
- Use Action Keywords for Fixes Keywords like "fix", "update", "change", "modify" trigger fix mode: ๐งโ๐ป > Fix the indentation error in main.py line 45
- Ask Follow-up Questions DevChat maintains context within a session: ๐งโ๐ป > What does the User class do? ๐ค DevChat: [explains User class]
๐งโ๐ป > Show me the init method ๐ค DevChat: [shows init method]
๐ค Contributing Contributions are welcome! Here's how you can help: Reporting Issues Found a bug? Open an issue with:
Description of the problem Steps to reproduce Expected vs actual behavior Your Python version and OS
Feature Requests Have an idea? Open a feature request describing:
The feature you'd like Why it would be useful How it might work
Pull Requests
Fork the repository Create a feature branch (git checkout -b feature/amazing-feature) Make your changes Write/update tests if applicable Commit your changes (git commit -m 'Add amazing feature') Push to your fork (git push origin feature/amazing-feature) Open a Pull Request
๐ License This project is licensed under the MIT License - see the LICENSE file for details.
๐จโ๐ป Author Hemanth Meher
๐ง Email: hemanthimandi5@gmail.com ๐ GitHub: @hemanthmeher ๐ผ LinkedIn: Connect with me
๐ Acknowledgments
Groq - Lightning-fast LLM inference FAISS - Efficient similarity search by Facebook AI Sentence Transformers - State-of-the-art text embeddings Click - Beautiful command-line interfaces
๐ฎ Roadmap Coming Soon
Support for more programming languages Integration with VS Code extension Multi-file code generation Project-wide refactoring suggestions Integration with GitHub for PR analysis Support for OpenAI GPT models Custom embedding models Web interface (optional GUI)
๐ Project Stats
Lines of Code: ~500 Dependencies: 6 core packages Supported File Types: 11+ Average Response Time: <2 seconds Index Size: Varies by project (typically 1-10 MB)
โก Performance Tips
- Index Only What You Need If you have a large project, consider indexing specific directories: python# Modify indexer.py to limit scope project_path = "/your/project/src" # Instead of root
- Use Faster Models For quicker responses, use smaller models: pythonConfig.MODEL = "llama-3.1-8b-instant" # Fast
vs
Config.MODEL = "llama-3.1-70b-versatile" # Accurate but slower 3. Reuse Indexes DevChat saves the index to devchat.index. On subsequent runs, it loads from disk instead of re-indexing (future feature).
โ FAQ Q: Do I need an internet connection? A: Yes, DevChat uses the Groq API which requires internet. The vector search is local, but LLM inference is cloud-based. Q: Is my code sent to the cloud? A: Only the relevant code snippets matching your question are sent to Groq's API along with your prompt. Full codebase stays local. Q: Can I use OpenAI instead of Groq? A: Currently, DevChat is configured for Groq. OpenAI support is planned for future versions. Q: How accurate are the answers? A: DevChat is as accurate as the LLM (Llama 3.1) and the relevance of retrieved documents. It works best with well-structured codebases. Q: Can I use this in production? A: DevChat is great for development and debugging. For production AI features, consider rate limits and error handling. Q: How do I reset the index? A: Simply delete the devchat.index file and run DevChat again to re-index your project.
๐จ Troubleshooting Issue: "GROQ_API_KEY not found" Solution: Make sure you've set the environment variable: bashexport GROQ_API_KEY="your-key-here" Issue: No files being indexed Solution: Check if your files have supported extensions (.py, .js, etc.) and aren't in ignored folders. Issue: "NOT FOUND" responses Solution:
Ensure the file/code you're asking about actually exists in your indexed project Try rephrasing your question with more specific keywords Mention specific file names for better results
Issue: Slow indexing Solution:
Large projects take longer to index Exclude unnecessary directories by modifying IGNORE_DIRS in indexer.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file devchat_hm-0.1.1.tar.gz.
File metadata
- Download URL: devchat_hm-0.1.1.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec98732177aa67efbf2161f0b3912da37ab6666572693489175aa20c290fe619
|
|
| MD5 |
e8440a19d4d0fcb99870b79a4201a486
|
|
| BLAKE2b-256 |
8bd3e5fba7a48c02d085cb64933e6a250e4f4963c0e10350d0aaa3919808ee26
|
File details
Details for the file devchat_hm-0.1.1-py3-none-any.whl.
File metadata
- Download URL: devchat_hm-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9b4ed562719eac29c80bb70e07f23e6f777cf7613c897ce47bed6b2c05043fa
|
|
| MD5 |
b5e19348ffd65145bc63c2cee7c77f35
|
|
| BLAKE2b-256 |
94d219ee2778f3d15085fd595dd7c8d58180f2c29b26ab8fa95422d4073c07a1
|