https://github.com/khulnasoft-lab/deepseek-r1
https://github.com/khulnasoft-lab/deepseek-r1
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/khulnasoft-lab/deepseek-r1
- Owner: khulnasoft-lab
- Created: 2025-01-23T04:08:10.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2025-02-05T10:22:50.000Z (4 months ago)
- Last Synced: 2025-02-05T10:29:39.645Z (4 months ago)
- Language: Python
- Size: 37.1 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DeepSeek R1 🐋
## Overview
This repository contains a powerful coding assistant application that integrates with the DeepSeek API to process user conversations and generate structured JSON responses. Through an intuitive command-line interface, it can read local file contents, create new files, and apply diff edits to existing files in real time.
## Key Features
1. DeepSeek Client Configuration
- Automatically configures an API client to use the DeepSeek service with a valid DEEPSEEK_API_KEY
- Connects to the DeepSeek endpoint specified in the environment variable to stream GPT-like completions2. Data Models
- Leverages Pydantic for type-safe handling of file operations:
- FileToCreate: Defines structure for new files to be created
- FileToEdit: Specifies changes to be made to existing files
- AssistantResponse: Structures chat responses and file operations3. System Prompt
- Implements a comprehensive system prompt that guides conversation flow
- Ensures all responses follow strict JSON formatting
- Supports both file creation and editing operations4. File Operations
- read_local_file(): Reads and returns file contents as string
- create_file(): Creates or updates files with provided content
- show_diff_table(): Displays proposed changes in a rich format
- apply_diff_edit(): Implements precise file modifications5. File Integration Commands
- "/add path/to/file": Reads and includes single file content
- "/add path/to/folder": Adds all non-binary, non-hidden files from directory
- Enables context-aware assistance based on your codebase6. Conversation Management
- Maintains conversation history for context awareness
- Streams responses via DeepSeek API in real-time
- Parses responses as JSON for structured operations7. Interactive CLI
- Simple command-line interface
- Real-time file modification previews
- Easy confirmation of suggested changes
- Exit with "exit" or "quit" commands## Installation
1. Configure Environment:
```bash
# Create .env file with API key
echo "DEEPSEEK_API_KEY=your_api_key_here" > .env
```2. Install & Run:
Using pip:
```bash
pip install -r requirements.txt
python3 src/deepseek_r1/main.py
```Using uv (recommended for speed):
```bash
uv venv
uv run src/deepseek_r1/main.py
```## Advanced Features: Reasoning Model
The `src/deepseek_r1/r1.py` script provides enhanced capabilities using DeepSeek's Reasoning Model:
- Chain of Thought (CoT) reasoning visualization
- Transparent decision-making process
- Full compatibility with base features
- Dedicated reasoning display panel
- Clean conversation historyUsage:
```bash
python3 src/deepseek_r1/r1.py
```