CodeMate AI is an AI-powered programming assistant built using Python and the Groq API. It helps users learn programming, debug code, understand errors, and solve coding and Data Structures and Algorithms (DSA) problems through an interactive conversation.
With support for Python, C, C++, and Java, CodeMate AI aims to make programming easier, especially for beginners, by providing simple explanations, corrected code, and step-by-step guidance.
- 🌐 Multi-Language Support: Choose Python, C, C++, or Java.
- 🐛 Code Debugging: Identify errors and understand why they occur.
- 🛠️ Code Correction: Get corrected code with explanations.
- 📚 Concept Learning: Understand programming concepts in simple language.
- 👣 Step-by-Step Explanations: Learn how code works.
- 🧠 DSA Assistance: Get help with algorithms, data structures, and coding problems.
- ⚡ Code Optimization: Explore more efficient solutions and time and space complexity.
- 💬 Conversational Interaction: Ask follow-up questions while retaining conversation context.
- 📡 Streaming Responses: Receive AI-generated responses as they are produced.
- 🔒 Error Handling: Handle API and runtime request errors gracefully.
| Technology | Purpose |
|---|---|
| Python | Core application logic |
| Groq API | AI inference and chat completions |
| Groq Python SDK | Communication with the AI service |
openai/gpt-oss-120b |
AI model used for programming assistance |
| Google Colab / Jupyter Notebook | Development and execution |
- Choose a language: Select Python, C, C++, or Java.
- Enter a question: Ask about a programming concept, code error, or DSA problem.
- Process the request: The application sends the question and conversation history to the Groq API.
- Generate a response: The AI model produces a programming-focused answer.
- Stream the output: The response is displayed progressively in the terminal.
- Continue learning: Ask follow-up questions without losing the current conversation context.
- Exit anytime: Type
exitto end the session.
- Python 3.9 or later
- A Groq API key
- Internet connectivity
- Google Colab, Jupyter Notebook, or a local Python environment
git clone https://github.com/brubasree007/CodeMate-AI.git
cd CodeMate-AIpip install groqCreate an API key through the Groq Console.
For security, store your API key in an environment variable named GROQ_API_KEY instead of hardcoding it in your source code.
Windows PowerShell:
$env:GROQ_API_KEY="your_groq_api_key"Linux / macOS:
export GROQ_API_KEY="your_groq_api_key"In your Python notebook, initialize the client securely:
import os
from groq import Groq
client = Groq(
api_key=os.environ["GROQ_API_KEY"]
)Replace the existing hardcoded API-key initialization with this code before running the notebook.
Open CodeMate_AI.ipynb in Google Colab or Jupyter Notebook and execute the cells in order.
Follow the prompts to select a programming language and start chatting with CodeMate AI.
💻 CodeMate AI
Your Personal Programming Assistant
Select your programming language:
1. Python
2. C
3. C++
4. Java
Enter your choice (1-4): 1
Selected Language: Python
Type 'exit' to quit.
You: Explain the difference between a list and a tuple.
CodeMate: A list is mutable, meaning you can modify its elements.
A tuple is immutable, meaning its elements cannot be changed
after creation.
The conversation above is illustrative. Actual responses are generated by the AI model.
CodeMate-AI/
├── CodeMate_AI.ipynb
└── README.md
The objective of CodeMate AI is to make programming more accessible by combining artificial intelligence with interactive learning. It provides a convenient way for users to understand code, troubleshoot errors, practice problem-solving, and improve their programming skills.
- Develop a web-based interface for a better user experience.
- Integrate code execution and automated test-case evaluation.
- Add support for more programming languages.
- Introduce dedicated DSA practice and learning modes.
- Provide detailed complexity analysis and code optimization suggestions.
- Add user authentication and persistent chat history.
- Support code file uploads and project-level analysis.
- Never expose API keys in public repositories.
- Use environment variables or secure secrets management.
- Rotate any API key that has been exposed.
- Avoid committing credentials to Git history.