商业产业 Hacker News LLM 2026-08-12T22:34 正文 ok 393 words

DLLM:直接构建于 llama.cpp 之上的极简 D 语言编程 Agent

英文标题:🔶 DLLM: Minimal, clean coding agent built directly on llama.cpp without overhead

DLLM 是一个以 D 语言编写、通过 importC 直接调用 llama.cpp 的轻量级 Agent,无需 Python 或额外绑定层。项目提供 Agent、摘要和嵌入三模型流水线,支持 CUDA 全量卸载、多模态视觉、RAG、KV-cache 压缩、思考预算及可扩展工具系统。其内置文件读写、网页搜索、Docker 沙箱代码执行、音频播放等工具,并宣称在指定模型配置下仅需 8GB VRAM。对于开发者而言,DLLM 展示了一种低开销、本地运行且可通过 D 语言属性自动注册工具的 Agent 实现路径。
打开原文相关 6 · 机会 1
media121.9 KB

中文

DLLM - 基于 🦙.cpp 的 D 语言 🤖

一个极简、整洁的 D 语言 Agent,通过 importC 直接构建在 llama.cpp 之上。无需 Python、无需绑定层、没有额外开销。它运行一个三模型流水线(agent、summary、embed),支持完整的 CUDA 卸载、通过 mtmd 实现多模态视觉、RAG、KV-cache 压缩、思考预算,以及可扩展的工具系统(通过函数上的用户定义属性 @Tool("Description") 自动注册)。内置工具涵盖:文件 I/O、网页搜索、日期与时间、文本编码、Docker 沙箱化代码执行以及音频播放。

依赖项的编译指南见 deps/README.md

  • D 编译器:使用 DMD、LDC 或 GDC 编译该 Agent。
  • llama.cpp:随 llama.cpp 一并提供。
  • Cuda Toolkit:通过 CUDA 构建,以支持 GPU 加速。
  • SearxNG:SearxNG 为 webSearch() 工具提供不限次数的网页搜索能力。
  • Docker:Docker 提供由 runCode() 工具使用的代码执行沙箱。

已使用以下 HuggingFace 模型进行测试:

模型路径在 src/main.d 中配置;使用上述模型配置时需要 8GB VRAM。

通过提示词以 OneShot 模式执行:

  dub -- "What is your name?"
  dub -- "Download the image at https://picsum.photos/400, load it, and write a poem about it"
  dub -- "What date is it today ? and which day of the week was 2 days ago ?"
  dub -- "Generate an 8-second audio file of a 440hz sine wave that fades out, then play it"
  dub -- "Generate a spoken 16-bit PCM WAV of 'Hello World' and play it"
  dub -- "Ingest the file README.md into RAG, tell me what DLLM is in one sentence"
  dub -- "Read the file dub.json, and summarize in a single line what the file is about."
  dub -- "How is the weather in Newcastle upon Tyne (UK) ?"
  dub -- "Fetch the Bitcoin price history online, plot it as a chart and save to workspace"
  dub -- "Think about then tell me, a story about math, 4 lines of text and be creative!"

或者启动一个交互式会话:

想要贡献?太好了!欢迎通过给此仓库点亮 ⭐ 或 Fork 🍴 来贡献;在提交 Pull Request 前,也可以先创建 Issue 讨论想法。你同样可以在提交记录下发表评论。

由 Danny Arends 编写,并以 GPLv3 发布。

English / 原文

DLLM - D Language 🤖 on 🦙.cpp

A minimal, clean D language agent built directly on llama.cpp via importC. No Python, no bindings, no overhead. Runs a three-model pipeline (agent , summary , embed) with full CUDA offloading, multimodal vision via mtmd, RAG, KV-cache condensation, thinking budget, and an extensible tool system (auto-registered via user-defined attribute @Tool("Description") on functions). Tools included cover: file I/O, web search, date & time, text encoding, Docker sandboxed code execution, and audio playback.

Compilation guide for dependencies are found in deps/README.md

  • D Compiler : Use either DMD, LDC, or GDC to compile the agent.
  • llama.cpp : Bundled with llama.cpp
  • Cuda Toolkit : Built with CUDA for GPU acceleration support.
  • SearxNG : SearxNG is used to provide unlimited web searching by the webSearch() tool.
  • Docker : Docker provides a code execution sandbox used by the runCode() tool.

Tested with the following HuggingFace models:

Model paths are configured in src/main.d and with the above model setup require 8GB VRAM.

Execute with prompt to OneShot:

  dub -- "What is your name?"
  dub -- "Download the image at https://picsum.photos/400, load it, and write a poem about it"
  dub -- "What date is it today ? and which day of the week was 2 days ago ?"
  dub -- "Generate an 8-second audio file of a 440hz sine wave that fades out, then play it"
  dub -- "Generate a spoken 16-bit PCM WAV of 'Hello World' and play it"
  dub -- "Ingest the file README.md into RAG, tell me what DLLM is in one sentence"
  dub -- "Read the file dub.json, and summarize in a single line what the file is about."
  dub -- "How is the weather in Newcastle upon Tyne (UK) ?"
  dub -- "Fetch the Bitcoin price history online, plot it as a chart and save to workspace"
  dub -- "Think about then tell me, a story about math, 4 lines of text and be creative!"

Or start an interactive session:

Want to contribute? Great! Contribute to this repo by starring ⭐ or forking 🍴, and feel free to start an issue first to discuss idea's before sending a pull request. You're also welcome to post comments on commits.

Written by Danny Arends and released as GPLv3