🚀 Your AI Pair Programmer with Debugging Superpowers
DeepSeek Code Companion is an AI-powered coding assistant built with Ollama and LangChain. It provides expert assistance in Python programming, debugging, code documentation, and solution design. Whether you're a beginner or an experienced developer, DeepSeek is here to help you write better code faster.
🐍 Python Expert: Get expert guidance on Python programming.
🐞 Debugging Assistant: Identify and fix bugs in your code with strategic print statements.
📝 Code Documentation: Automatically generate clear and concise documentation for your code.
💡 Solution Design: Receive well-structured solutions for your coding problems.
Ollama: A lightweight framework for running large language models locally.
LangChain: A framework for building applications powered by language models.
Streamlit: A powerful tool for building interactive web applications with Python.
Follow these steps to set up and run the DeepSeek Code Companion on your local machine.
Python 3.9 or higher
Ollama installed and running locally
Streamlit installed
Clone the Repository:
git clone https://github.com/your-username/deepseek-code-companion.git
cd deepseek-code-companionpython -m venv .venv
source .venv/bin/activate # On Windows, use `.venv\Scripts\activatepip install -r requirements.txt
Ensure Ollama is running on your machine. By default, the application connects to http://localhost:11434.
streamlit run app.py
Open your browser and navigate to the URL provided in the terminal (usually http://localhost:8501).
Choose a Model:
In the sidebar, select a model from the dropdown (e.g., deepseek-r1:1.5b or deepseek-r1:3b).
Ask Your Coding Questions:
Type your coding question or problem in the chat input box.
DeepSeek will provide concise and accurate solutions.
Explore Model Capabilities:
Use DeepSeek for debugging, code documentation, or solution design.
Styling The app uses custom CSS for a dark theme. You can modify the styles in the st.markdown section of the code.
Models You can add or remove models in the selected_model dropdown by editing the app.py file:
python
selected_model = st.selectbox(
"Choose Model",
["deepseek-r1:1.5b", "deepseek-r1:3b"], # Add or remove models here
index=0
)
System Prompt Modify the system prompt in the system_prompt variable to customize the AI's behavior:
python
system_prompt = SystemMessagePromptTemplate.from_template(
"You are an expert AI coding assistant. Provide concise, correct solutions "
"with strategic print statements for debugging. Always respond in English."
)
Common Issues Ollama Not Running:
Ensure Ollama is running locally and accessible at http://localhost:11434.
If you encounter a KeyError related to missing variables (e.g., {r2} or {rmse}), ensure that the messages in st.session_state.message_log do not contain unescaped placeholders. Escape curly braces by doubling them (e.g., {{r2}}).
If the app doesn't launch, ensure Streamlit is installed and your virtual environment is activated.
This project is licensed under the MIT License. See the LICENSE file for details.
Ollama for providing a lightweight framework for running LLMs.
LangChain for simplifying the integration of language models.
Streamlit for making it easy to build interactive web apps.