dsh-vision-tool: Adding Image Understanding Capabilities to a Text-Only Main Model

Preface

The DeepSeek Harness (DSH) engine routes input based on the inputModalities declared by the model. Pure text models (without image) will reject messages during the admission phase, or the received image bytes will be projected as text placeholders, rendering them unable to truly process images.

dsh-vision-tool is a plugin maintained by YJLTF designed to address this issue. It delegates image understanding capabilities to a user-configured multimodal model by relaxing admission, registering tools, and injecting guidance, then returns the results to the main model. Meanwhile, the plugin features a smart fallback mechanism; when the main model natively supports images, it automatically ceases intervention to preserve the native experience.

Core Features

  • Relaxed Image Admission: Wraps the llm.resolveModelInfo service to allow pure text models to accept messages with images, while the engine still handles byte projection according to the adapter’s actual metadata.
  • Tool Integration:
    • understand_image: Automatically checks the most recent image in the conversation (typical paste scenario) or reads a file from a specified path.
    • list_conversation_images: Lists all images appearing in the conversation for selection.
  • Smart Fallback: Falls back based on model capabilities; models with native image support remain unaffected.
  • Guidance Injection: Automatically injects image understanding guidance into the system prompt, directing the main model to ask specific questions based on context.
  • Instant Configuration Updates: Supports official-style configuration cards on the Web; configuration changes take effect without restarting the session.
  • Zero Runtime Dependencies: The artifact is approximately 18 kB, relying only on the host-provided dsh package and schemastery.

Installation and Activation

Run the following command in the target dsh environment to install:

dsh plugin --profile <profile> add github:YJLTF/dsh-vision-tool

Note: Git installation pulls the source code and triggers a build. If using pnpm ≥ 10, the first installation may fail. You need to allow build authorization in the profile’s pnpm-workspace.yaml:

allowBuilds:
  dsh-vision-tool: true

Security Warning: Allowing the build implies permitting the package code to execute locally during installation. Please only allow this for trusted packages; it is recommended to pin the commit version.

Configuration Instructions

The plugin relies on the host environment configuration; a vision model and provider must be specified.

Minimal Configuration:

visionProvider: zai-coding-cn
visionModel: glm-5.3-flash

Configuration Options:

Field Type Default Description
visionProvider string '' Provider routing for the small multimodal model.
visionModel string '' Exact model ID for the small multimodal model.
maxTokens number 2048 Maximum output tokens for the vision call.
guidanceInjection boolean true Whether to inject image understanding guidance into the system prompt.
overrides [] Explicitly declare modalities per model; overrides adapter metadata.

Prerequisite: The selected vision model must declare image input capabilities in the DSH model configuration. Otherwise, the engine will project away image bytes, preventing the vision model from recognizing images:

models:
  - id: <vision-model>
    input: [text, image]   # image must be declared

Usage Example

Once configured, simply paste images and ask questions directly in the conversation.

  1. Paste and Ask: The user sends an image accompanied by a specific question (e.g., “What is wrong with the code in this image?”).
  2. Tool Invocation: Upon receiving the image placeholder, the pure text main model autonomously calls the understand_image tool based on the guidance in the system prompt (defaulting to checking the most recent image when path is not provided).
  3. Result Return: The vision model analyzes the image and returns a text result, which the main model uses to continue reasoning.

Notes

  • Environment Requirements: Requires DSH 0.2.0-rc.2 environment (peer range ^0.2.0-rc.1, @deepseek-ai/cordis ^4.0.1).
  • Security Risk: Git installation requires allowing pnpm builds, which is equivalent to permitting the package to execute code locally.
  • Stream Abort: Streaming calls for tool execution support request-level abortion; cancellation immediately interrupts the process.
  • Zero Dependencies: The build artifact is self-contained and naturally suitable for offline distribution.
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye