https://github.com/tanushreesb/deepseek-rag-agent
https://github.com/tanushreesb/deepseek-rag-agent
deepseek gen-ai gen-ai-project ollama rag
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tanushreesb/deepseek-rag-agent
- Owner: TanushreeSB
- Created: 2025-02-17T17:47:36.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-02-18T06:39:30.000Z (3 months ago)
- Last Synced: 2025-02-18T07:22:19.298Z (3 months ago)
- Topics: deepseek, gen-ai, gen-ai-project, ollama, rag
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# deepseek-rag-agent
# 🧠 DeepSeek Code Companion
DeepSeek is an AI-powered code companion designed to assist with coding, debugging, and providing solutions to programming problems. It uses the Ollama API and LangChain framework to generate helpful responses based on user input.







## 🚀 Features
- **Python Expertise**: Provides solutions, code snippets, and explanations for Python-related queries.
- **Debugging Assistance**: Helps identify and debug issues in your code with useful print statements and suggestions.
- **Code Documentation**: Automatically generates explanations and comments for code.
- **Solution Design**: Offers high-level design and architectural suggestions for software development.## ⚙️ Prerequisites
Before using this app, make sure you have the following:
- Python 3.7+ installed on your system.
- [Streamlit](https://streamlit.io/) installed (`pip install streamlit`).
- [LangChain](https://python.langchain.com/) installed (`pip install langchain`).
- Ollama's API endpoint running locally on your machine. (You need to install Ollama and run their server on `http://localhost:11434`)## 🔧 Installation
### 1. Install Dependencies
To get started, install the necessary Python libraries:
```bash
pip install streamlit langchain langchain_ollama
```### 2. Set up Ollama
Make sure you have Ollama installed and running locally. Visit [Ollama's website](https://ollama.ai/) for detailed instructions on installation and configuration.
### 3. Clone or Download the Repository
Clone the repository (or create a new file) containing your code.
```bash
git clone https://github.com/TanushreeSB/deepseek.git
cd deepseek
```## 🚀 Running the App
To start the Streamlit app, run:
```bash
streamlit run app.py
```This will launch the app in your browser at `http://localhost:8501`.
## 🖥️ How It Works
- **User Interaction**: The user types a programming-related question in the input box.
- **AI Response Generation**: The system prompts the Ollama model for an appropriate response, which can be a code solution, debug suggestion, or documentation.
- **Chat Interface**: All interactions are logged and displayed in a chat-like interface, allowing users to have ongoing conversations with the AI assistant.### Configuration Options
- **Model Selection**: Choose between two pre-configured models: `deepseek-r1:1.5b` or `deepseek-r1:3b`. These models differ in their capability and performance.
- **Customization**: Modify the system prompt to change how the assistant responds (concise, debug-friendly, etc.).## 💡 Code Explanation
### Streamlit Interface
- **Main UI**: The main user interface displays a chat interface for interacting with the AI assistant. It uses Streamlit's layout capabilities for the chat experience.
- **Sidebar**: Contains options to configure the model and other settings.### Core Components
1. **System Message**: The `system_prompt` defines the AI's behavior, guiding it to act as a concise coding assistant.
2. **Message Log**: All user inputs and AI responses are stored in `st.session_state.message_log`, ensuring the chat history is maintained across interactions.
3. **Chat Interface**: A custom chat interface is created using Streamlit components to display both user and AI messages.
4. **Response Generation**: Upon receiving user input, the app constructs a prompt chain using `LangChain` and sends it to Ollama for processing.
5. **Reset**: A button is provided to clear the chat history and restart the interaction.