Files
marqdo/doc/design/ext-llm.md
T
cflmyandCursor 1f23e2ed93 Add module namespaces and harden L1/agent after the import redesign.
Bind imports to library names with bare path calls (and use), forward optional host args through mq wrappers, stabilize writeback replacement newlines, and document the M1/M2 decisions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 13:28:32 +08:00

2.1 KiB

Official extensions (ext/) — LLM

Status Accepted (v0.1.x)
Date 2026-08-06
Related objects.md · ext-abi.md · ext-agent.md · ext-cli.md

Scope

ext/ai/ holds official LLM + agent extensions. Import paths:

---
> ext/ai/llm.mq.md
---

Resolution: MARQDO_EXT/ai/…, repo ext/ai/…, cwd ext/ai/… (see ext-cli.md).

Other official ext: ext-agent.md (document-driven agent — step / multi-step workbook + writeback; thin TOOL: loop superseded). Installer: ext-cli.md. Native plugins: ext-abi.md.

Note: Prefer marqdo ext add llm. Import > ext/ai/llm.mq.md from repo or install root.

Platform prerequisites

Capability Surface
HTTPS + headers lib/net → http_post / headers= map
Dotenv ## load_env in ext (or load_dotenv / lib/sys)
JSON quote lib/json → quote

ext/ai/llm / ext/ai/大模型 (object handles)

English Chinese Role
## load_env ## 加载环境 Free function: load .env
# llm # 大模型 Object ctor → handle map
## complete / ## chat ## 运行 / ## 聊天 Methods on the handle
---
> ext/ai/llm.mq.md
---

# main

> load_env

*`model` = > llm *
*`reply` = > `model`.complete prompt=Say hi in one word *
> print text=`reply`

Environment (create a project-local .env; do not commit secrets):

OPENAI_API_KEY=sk-...
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_MODEL=gpt-4o-mini

Fallbacks: MARQDO_LLM_API_KEY, MARQDO_LLM_BASE_URL, MARQDO_LLM_MODEL.

Tests

  • Import smoke: tests/ext/llm-import.mq.md
  • Live complete (local): tests/ext/llm-complete.mq.md + tests/ext/.env
  • Live agent ## step: tests/ext/agent-run-live.mq.md (DeepSeek; gold: ext_agent_run_live)
  • Agent smoke (real llm handle): tests/ext/agent-smoke.mq.md (gold: ext_agent_framework_smoke)
  • Live complete: tests/ext/llm-complete.mq.md (gold: ext_llm_complete_live)