Skip to content
dsh.fish
Bundle

dsh-dashscope-tool-adapter

DSH plugin: adapts DashScope/闂傚倸鍟锟犲闯闁垮顩查柟瀵稿У椤忋儵鏌?DeepSeek endpoints that lack native tool calling by converting tool definitions to prompt text and parsing model responses for tool calls.

Source
Uersx
License
MIT
Updated
Updated 20 hours ago

Readme

# dsh-dashscope-tool-adapter

DSH plugin: adapts [DashScope](https://dashscope.aliyun.com) / 阿里云百炼 DeepSeek endpoints that lack native tool calling.

## Problem

DashScope's OpenAI-compatible endpoint (`https://dashscope.aliyuncs.com/compatible-mode/v1`) does not support native tool calling (function calling) for DeepSeek models. When DSH sends tool definitions, the API either ignores them or rejects the request.

## Solution

This plugin converts tool definitions into prompt text and parses the model's text response for `<|tool_call|>` markers. It then constructs standard BlockAssembler-compatible tool-call chunks, which the DSH agent loop executes natively.

- **Non-DashScope providers**: untouched, native tool calling works as usual.
- **DashScope providers**: tools are described in the system prompt, and the model calls them via text markers.

## Installation

```bash
dsh plugin add github:Uersx/dsh-dashscope-tool-adapter
```

Or manually:

```bash
dsh plugin --profile web add github:Uersx/dsh-dashscope-tool-adapter
```

## How it works

1. A `systemPrompt.section()` injects text-based tool descriptions into the system prompt.
2. The `llm/stream` waterfall intercepts only DashScope calls.
3. The model outputs `<|tool_call|>{"name":"...","arguments":{...}}</|tool_call|>` in its text.
4. The plugin parses these markers and constructs standard `tool-call-delta` / `block-end` chunks.
5. The DSH agent loop executes the tools natively.

## License

MIT

Install

dsh plugin --profile web add github:Uersx/dsh-dashscope-tool-adapter

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source