Skip to main content

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

  1. Run DevChat bashdevchat
  2. Enter your project path when prompted Enter project path: /path/to/your/project
  3. 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.
  4. 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:

  1. User - Represents user accounts
  2. Post - Represents blog posts
  3. 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

  1. Be Specific โŒ "Tell me about the code" โœ… "What does the authenticate() function in auth.py do?"
  2. Mention File Names Including file names helps DevChat give precise answers: ๐Ÿง‘โ€๐Ÿ’ป > How does error handling work in utils.py?
  3. Use Action Keywords for Fixes Keywords like "fix", "update", "change", "modify" trigger fix mode: ๐Ÿง‘โ€๐Ÿ’ป > Fix the indentation error in main.py line 45
  4. 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

  1. 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
  2. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

devchat_hm-0.1.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

devchat_hm-0.1.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

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

Hashes for devchat_hm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ec98732177aa67efbf2161f0b3912da37ab6666572693489175aa20c290fe619
MD5 e8440a19d4d0fcb99870b79a4201a486
BLAKE2b-256 8bd3e5fba7a48c02d085cb64933e6a250e4f4963c0e10350d0aaa3919808ee26

See more details on using hashes here.

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

Hashes for devchat_hm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b9b4ed562719eac29c80bb70e07f23e6f777cf7613c897ce47bed6b2c05043fa
MD5 b5e19348ffd65145bc63c2cee7c77f35
BLAKE2b-256 94d219ee2778f3d15085fd595dd7c8d58180f2c29b26ab8fa95422d4073c07a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page