Skip to content

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.

License

Notifications You must be signed in to change notification settings

Doriandarko/deepseek-engineer

Repository files navigation

DeepSeek Engineer v2 πŸ‹

Overview

DeepSeek Engineer v2 is a powerful AI-powered coding assistant that provides an interactive terminal interface for seamless code development. It integrates with DeepSeek's advanced reasoning models to offer intelligent file operations, code analysis, and development assistance through natural conversation and function calling.

πŸš€ Latest Update: Function Calling Architecture

Version 2.0 introduces a big upgrade from structured JSON output to native function calling, providing:

  • Natural conversations with the AI without rigid response formats
  • Automatic file operations through intelligent function calls
  • Real-time reasoning visibility with Chain of Thought (CoT) capabilities
  • Enhanced reliability and better error handling

Key Features

🧠 AI Capabilities

  • Elite Software Engineering: Decades of experience across all programming domains
  • Chain of Thought Reasoning: Visible thought process before providing solutions
  • Code Analysis & Discussion: Expert-level insights and optimization suggestions
  • Intelligent Problem Solving: Automatic file reading and context understanding

πŸ› οΈ Function Calling Tools

The AI can automatically execute these operations when needed:

read_file(file_path: str)

  • Read single file content with automatic path normalization
  • Built-in error handling for missing or inaccessible files
  • Automatic: AI can read any file you mention or reference in conversation

read_multiple_files(file_paths: List[str])

  • Batch read multiple files efficiently
  • Formatted output with clear file separators

create_file(file_path: str, content: str)

  • Create new files or overwrite existing ones
  • Automatic directory creation and safety checks

create_multiple_files(files: List[Dict])

  • Create multiple files in a single operation
  • Perfect for scaffolding projects or creating related files

edit_file(file_path: str, original_snippet: str, new_snippet: str)

  • Precise snippet-based file editing
  • Safe replacement with exact matching

πŸ“ File Operations

Automatic File Reading (Recommended)

The AI can automatically read files you mention:

You> Can you review the main.py file and suggest improvements?
β†’ AI automatically calls read_file("main.py")

You> Look at src/utils.py and tests/test_utils.py
β†’ AI automatically calls read_multiple_files(["src/utils.py", "tests/test_utils.py"])

Manual Context Addition (Optional)

For when you want to preload files into conversation context:

  • /add path/to/file - Include single file in conversation context
  • /add path/to/folder - Include entire directory (with smart filtering)

Note: The /add command is mainly useful when you want to provide extra context upfront. The AI can read files automatically via function calls whenever needed during the conversation.

🎨 Rich Terminal Interface

  • Color-coded feedback (green for success, red for errors, yellow for warnings)
  • Real-time streaming with visible reasoning process
  • Structured tables for diff previews
  • Progress indicators for long operations

πŸ›‘οΈ Security & Safety

  • Path normalization and validation
  • Directory traversal protection
  • File size limits (5MB per file)
  • Binary file detection and exclusion

Getting Started

Prerequisites

  1. DeepSeek API Key: Get your API key from DeepSeek Platform
  2. Python 3.11+: Required for optimal performance

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd deepseek-engineer
  2. Set up environment:

    # Create .env file
    echo "DEEPSEEK_API_KEY=your_api_key_here" > .env
  3. Install dependencies (choose one method):

    Using uv (recommended - faster)

    uv venv
    uv run deepseek-eng.py

    Using pip

    pip install -r requirements.txt
    python3 deepseek-eng.py

Usage Examples

Natural Conversation with Automatic File Operations

You> Can you read the main.py file and create a test file for it?

πŸ’­ Reasoning: I need to first read the main.py file to understand its structure...

πŸ€– Assistant> I'll read the main.py file first to understand its structure.
⚑ Executing 1 function call(s)...
β†’ read_file
βœ“ Read file 'main.py'

πŸ”„ Processing results...
Now I'll create comprehensive tests based on the code structure I found.
⚑ Executing 1 function call(s)...
β†’ create_file
βœ“ Created/updated file at 'test_main.py'

I've analyzed main.py and created comprehensive tests covering all the main functions...

Automatic Multi-File Analysis

You> Compare the implementation in utils.py with the tests in test_utils.py

πŸ’­ Reasoning: I need to read both files to compare them...

πŸ€– Assistant> I'll read both files to analyze the implementation and tests.
⚑ Executing 1 function call(s)...
β†’ read_multiple_files
βœ“ Read files: utils.py, test_utils.py

πŸ”„ Processing results...
After analyzing both files, I can see several areas where the tests could be improved...

Manual Context Loading (Optional)

You> /add src/

βœ“ Added folder 'src/' to conversation.
πŸ“ Added files: (15 files)
  πŸ“„ src/utils.py
  πŸ“„ src/models.py
  ...

You> Now review this codebase structure

πŸ€– Assistant> I've reviewed your codebase and found several areas for improvement:

1. **Error Handling**: The utils.py file could benefit from more robust error handling...

Technical Details

Model: DeepSeek-Reasoner

  • Powered by DeepSeek-R1 with Chain-of-Thought reasoning
  • Real-time reasoning visibility during processing
  • Enhanced problem-solving capabilities

Function Call Execution Flow

  1. User Input β†’ Natural language request
  2. AI Reasoning β†’ Visible thought process (CoT)
  3. Function Calls β†’ Automatic tool execution
  4. Real-time Feedback β†’ Operation status and results
  5. Follow-up Response β†’ AI processes results and responds

Streaming Architecture

  • Triple-stream processing: reasoning + content + tool_calls
  • Real-time tool execution during streaming
  • Automatic follow-up responses after tool completion
  • Error recovery and graceful degradation

Advanced Features

Intelligent Context Management

  • Automatic file detection from user messages
  • Smart conversation cleanup to prevent token overflow
  • File content preservation across conversation history
  • Tool message integration for complete operation tracking

Batch Operations

You> Create a complete Flask API with models, routes, and tests

πŸ€– Assistant> I'll create a complete Flask API structure for you.
⚑ Executing 1 function call(s)...
β†’ create_multiple_files
βœ“ Created 4 files: app.py, models.py, routes.py, test_api.py

Project Analysis

You> /add .
You> Analyze this entire project and suggest a refactoring plan

πŸ€– Assistant> ⚑ Executing 1 function call(s)...
β†’ read_multiple_files
Based on my analysis of your project, here's a comprehensive refactoring plan...

File Operations Comparison

Method When to Use How It Works
Automatic Reading Most cases - just mention files AI automatically calls read_file() when you reference files
/add Command Preload context, bulk operations Manually adds files to conversation context upfront

Recommendation: Use natural conversation - the AI will automatically read files as needed. Use /add only when you want to provide extra context upfront.

Troubleshooting

Common Issues

API Key Not Found

# Make sure .env file exists with your API key
echo "DEEPSEEK_API_KEY=your_key_here" > .env

Import Errors

# Install dependencies
uv sync  # or pip install -r requirements.txt

File Permission Errors

  • Ensure you have write permissions in the working directory
  • Check file paths are correct and accessible

Contributing

This is an experimental project showcasing DeepSeek reasoning model capabilities. Contributions are welcome!

Development Setup

git clone <repository-url>
cd deepseek-engineer
uv venv
uv sync

Run

# Run the application (preferred)
uv run deepseek-eng.py

or

python3 deepseek-eng.py

License

This project is licensed under the MIT License - see the LICENSE file for details.

This project is experimental and developed for testing DeepSeek reasoning model capabilities.


Note: This is an experimental project developed to explore the capabilities of DeepSeek's reasoning model with function calling. The AI can automatically read files you mention in conversation, while the /add command is available for when you want to preload context. Use responsibly and enjoy the enhanced AI pair programming experience! πŸš€

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published