DeepSeek Harness: Multimodal Support

Last updated: 2026-08-31

Text is just one way for an Agent to understand the world — images, audio, and video are the language of the real world. DSH's multimodal support lets the Agent not just "read code" but also "see interfaces," "hear feedback," and "watch videos," greatly expanding the Agent's perception boundaries.

💡 Tip: Multimodal is a DSH developer preview feature, with functionality continuously iterating. Image input is currently the most stable; audio and video support are still being refined.

📋 Prerequisites: Completed 06-tools.md, familiar with the tool system basics

1. What You'll Learn


Multimodal Pipeline

Image Input Paths

2. Multimodal Architecture Overview

(1) Multimodal Data Flow

100%
graph TB
    subgraph Input Sources
        IMG[Image<br/>PNG/JPG/WebP]
        AUD[Audio<br/>MP3/WAV]
        VID[Video<br/>MP4/WebM]
        DOC[Documents<br/>PDF/CSV]
    end
    subgraph DSH Processing
        PARSE[Attachment Parser]
        ENCODE[Multimodal Encoding]
        LLM[LLM Multimodal Reasoning]
    end
    subgraph Output
        TEXT[Text Reply]
        TOOL[Tool Calls]
    end
    IMG --> PARSE
    AUD --> PARSE
    VID --> PARSE
    DOC --> PARSE
    PARSE --> ENCODE
    ENCODE --> LLM
    LLM --> TEXT
    LLM --> TOOL

(2) Multimodal Support Matrix

Input Type Format Support Stability Max Size Notes
Image PNG, JPG, WebP, GIF ✅ Stable 20MB/image Most mature multimodal capability
Audio MP3, WAV, OGG ⚠️ Experimental 50MB Requires audio-capable model
Video MP4, WebM ⚠️ Experimental 100MB Frame-by-frame extraction analysis
Document PDF, CSV, XLSX ✅ Stable 50MB Text extraction + structuring

(3) Model Requirements

Multimodal features depend on the LLM's multimodal capabilities:

Model Image Audio Video Document
deepseek-chat
gpt-4o
gpt-4-vision
claude-3.5-sonnet

3. Image Input Processing

(1) Adding Images in Web UI

In the Web UI chat area, you can add images by dragging or pasting:

TEXT 📖 Display only
┌─ Chat Area ──────────────────────────────┐
│                                           │
│ 👤 Alice:                                 │
│ 📎 [screenshot.png] [ui-mockup.jpg]      │
│ Which of these two UI designs is better?  │
│                                           │
│ [Send]                                    │
└───────────────────────────────────────────┘

Supported operations:

(2) Adding Images in CLI Mode

▶ Example 1: Attaching Images in CLI Mode

BASH
# Start CLI with attached image
dsh cli --attach ./screenshot.png

# Use /attach command during conversation
> /attach ./ui-mockup.jpg
> What's wrong with this UI?

# Attach multiple images
> /attach ./before.png ./after.png
> What's the difference between these two versions?

(3) Attaching Images via SDK

▶ Example 2: Sending Images with Python SDK

PYTHON
from dsh import DSHClient

client = DSHClient(base_url="http://127.0.0.1:3080")
session = client.create_session(workspace="/home/alice/project")

# Attach a single image
response = session.send(
    "What's wrong with this UI screenshot?",
    images=["./screenshot.png"]
)

print(response.content)

# Attach multiple images for comparison
response = session.send(
    "Compare these two designs, which is better?",
    images=["./design-a.png", "./design-b.png"]
)

(4) Image Analysis in Practice

▶ Example 3: UI Bug Analysis

TEXT 📖 Display only
👤 Alice: [attaches error-page-screenshot.png]
What's wrong with this error page? Help me fix it

🤖 Agent:
🔍 Analyzing image...

I see the following issues:
1. Error message text overflows the container boundary
2. The "Retry" button is truncated, only showing half
3. Background color is inconsistent with the design spec (should be #f5f5f5, not white)

📝 Using tool: file_edit (edit)
  → Path: src/pages/ErrorPage.tsx
  → Fix 1: Add text-overflow: ellipsis
  → Fix 2: Adjust button margin
  → Fix 3: Change background color

⚠️ Approval Required: Edit file src/pages/ErrorPage.tsx

(5) Image Processing Limitations

Limitation Description
Max per image 20MB
Max per message 5 images
Resolution Recommended not exceeding 4096×4096
Animated GIF Only the first frame is used
Format conversion Automatically converted to model-supported format

4. Audio/Video Input

(1) Audio Input (Experimental)

Audio input requires a model that supports audio understanding (e.g., GPT-4o):

▶ Example 4: Sending Audio via SDK

PYTHON
# Send an audio file
response = session.send(
    "Transcribe this audio and summarize the key points",
    audio=["./meeting-recording.mp3"]
)

print(response.content)
# Audio transcription results and summary...

(2) Video Input (Experimental)

Video processing uses a frame extraction strategy:

100%
graph LR
    VID[Video File] --> EXTRACT[Frame Extraction<br/>1 frame/second] --> SELECT[Key Frame Selection<br/>Scene Change Detection] --> ENCODE[Multi-frame Encoding] --> LLM[LLM Analysis]

▶ Example 5: Sending Video via SDK

PYTHON
# Send a video file
response = session.send(
    "Analyze this demo video, list the features shown",
    video=["./demo.mp4"]
)

print(response.content)
# 1. User login feature (0:00-0:15)
# 2. Dashboard display (0:15-0:45)
# ...

(3) Current Limitations

Audio and video features are still in the experimental stage:

Limitation Audio Video
Max duration 10 minutes 5 minutes
Max file size 50MB 100MB
Model requirement GPT-4o etc. GPT-4o etc.
Frame extraction 1 frame/second, max 300 frames
Stability ⚠️ May timeout ⚠️ May timeout

5. Document Attachments and Parsing

(1) Supported Document Formats

Format Parsing Method Output
PDF Text extraction + OCR Structured text
CSV Parse rows and columns Table data
XLSX Parse worksheets Table data
DOCX Text extraction Structured text
Markdown Direct reading Raw text

▶ Example 6: Attaching a PDF File

PYTHON
# Analyze a PDF document
response = session.send(
    "Summarize the core points of this technical document",
    files=["./api-specification.pdf"]
)

print(response.content)

(2) CSV Data Analysis

▶ Example 7: Analyzing CSV Data

PYTHON
# Analyze CSV data
response = session.send(
    "Analyze this sales data, find trends and outliers",
    files=["./sales-2026.csv"]
)

print(response.content)
# Data analysis results...

The Agent can also further process with tools:

TEXT 📖 Display only
🤖 Agent:
📊 Analyzing CSV data...
  → Rows: 12,450
  → Columns: 8
  → Date range: 2026-01 to 2026-08

Key findings:
1. Monthly average growth 12%, but March dropped 8% (suspected seasonality)
2. Top 3 products account for 65% of total revenue
3. Customer retention rate dropped from 72% to 68%

🔧 Using tool: shell
  → Command: python3 -c "import pandas; ..."
  → Generating visualization...

6. Multimodal Tool Integration

(1) Multimodal and Tool Coordination

The Agent can combine multimodal input with tool calls:

100%
graph TB
    INPUT[Multimodal Input] --> AGENT[Agent Analysis]
    AGENT -->|Image → Code| FE[file_edit]
    AGENT -->|Video → Script| SH[shell]
    AGENT -->|Document → Database| DB[database.query]

▶ Example 8: Image + Tool Coordination

TEXT 📖 Display only
👤 Bob: [attaches api-response-screenshot.png]
This API response format is wrong, help me check the code

🤖 Agent:
🔍 Analyzing screenshot...
  → Expected format: { data: [...], meta: {...} }
  → Actual format: { results: [...] }

🔍 Using tool: search
  → Pattern: "results"
  → Type: content
  → Found in: src/api/handlers.ts:45

📝 Using tool: file_edit (read)
  → Reading src/api/handlers.ts

📝 Using tool: file_edit (edit)
  → Fixing response format at line 45-52
  → Changing "results" to "data", adding "meta" field

(2) Batch Image Processing

▶ Example 9: Batch Images + File Editing

PYTHON
import glob

screenshots = glob.glob("./screenshots/*.png")

response = session.send(
    "Review all screenshots, find pages with UI issues, and fix them one by one",
    images=screenshots[:5]  # Max 5 images
)

(3) Multimodal Chain Reasoning

TEXT 📖 Display only
👤 Alice: [attaches architecture-diagram.png]
Generate a Docker Compose configuration based on this architecture diagram

🤖 Agent:
🔍 Analyzing architecture diagram...
  → Identified 4 services: API, Worker, Database, Cache
  → Connections: API → Database, API → Cache, Worker → Database

📝 Using tool: file_edit (create)
  → Creating docker-compose.yml
  → 4 services with proper networking

✅ Docker Compose configuration generated, including:
- api-service (Express.js, port 3000)
- worker-service (Node.js, background jobs)
- postgres (PostgreSQL 16, volume mounted)
- redis (Redis 7, cache layer)

7. Configuration and Optimization

(1) Multimodal Configuration

YAML
# dsh.config.yaml
multimodal:
  # Image settings
  images:
    max_size_mb: 20
    max_per_message: 5
    resize_large: true          # Auto-resize oversized images
    max_resolution: [4096, 4096]
  
  # Audio settings
  audio:
    max_duration_minutes: 10
    max_size_mb: 50
    transcription_model: "whisper-1"
  
  # Video settings
  video:
    max_duration_minutes: 5
    max_size_mb: 100
    frame_rate: 1               # Frames per second to extract
    max_frames: 300
  
  # Document settings
  documents:
    max_size_mb: 50
    pdf_ocr_enabled: true
    csv_max_rows: 100000

(2) Performance Optimization

Multimodal input increases token consumption and response time:

Optimization Strategy Description Effect
Image compression Compress to appropriate resolution before uploading 50-80% image token reduction
Key frame selection Only send key frames for video 90% video frame reduction
Text extraction Prefer text extraction over OCR for PDFs Faster and more accurate
Batch sending Send large numbers of images in batches Avoids timeout

❓ FAQ

Q Do all models support image input?
A No. You need to use a vision-capable model such as DeepSeek-VL, GPT-4o, Claude 3.5 Sonnet, etc. Standard text models cannot process images.
Q Does image quality affect Agent understanding?
A Yes. Low-resolution, blurry, or poorly lit images may cause the Agent to misjudge. We recommend uploading clear, high-resolution images.
Q When will audio features be stable?
A Audio and video features are still in developer preview. The official team hasn't announced a stable timeline. We recommend using them only for non-critical scenarios.
Q How many extra tokens does multimodal consume?
A Images approximately 85-170 tokens/image (depending on resolution), audio approximately 150 tokens/minute, video approximately 85 tokens/frame. Specifics depend on the model and encoding method.
Q Can the Agent take screenshots on its own?
A Yes. Through tool plugins like Playwright, the Agent can open a browser, take a screenshot, and then analyze it. This requires installing a community plugin.
Q Is PDF OCR accurate?
A For PDFs with clear text, direct text extraction (non-OCR) accuracy is close to 100%. Scanned documents and handwritten content rely on OCR with lower accuracy.

📖 Summary


📝 Exercises

1. ⭐ Basic: Upload a UI screenshot in the Web UI and have the Agent describe the content of the screenshot. Record the Agent's analysis results and tools used.

2. ⭐⭐ Intermediate: Upload a CSV data file and have the Agent analyze the data and suggest visualizations. Use the SDK to write a script for this operation.

3. ⭐⭐⭐ Challenge: Design a multimodal workflow — upload a UI design image, have the Agent generate corresponding frontend code based on the design, then take a screenshot to compare the generated result with the original design. Record the complete tool call chain.

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏