← 返回 Skills 市场
tangweigang-jpg

Instructor Structured Output

作者 Tang Weigang · GitHub ↗ · v0.1.0 · MIT-0
cross-platform ⚠ suspicious
64
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install instructor-structured-output
功能描述
Instructor:声明 Pydantic BaseModel 即可从 20 个 LLM provider 拿到类型化实例。核心是 monkey-patch(instructor.patch / from_*)拦截 create(),注入 schema-aware kwargs,tenacity 重试 + In...
使用说明 (SKILL.md)

这个 skill 适合什么用户?能做哪些任务?

概览

Instructor 是把 Pydantic BaseModel 直接绑到 LLM 输出的 Python 框架(github.com/jxnl/instructor)。核心机制:monkey-patch(instructor.patch / instructor.from_*)拦截 provider client 的 create() 调用,注入 schema-aware kwargs,在 tenacity 重试循环里跑,验证 JSON 响应到模型,ValidationError 时把 failed_attempts 作为 XML 重写 prompt 再试。

支持 20 个 provider...

Doramagic 晶体页: https://doramagic.ai/zh/crystal/instructor-structured-output

知识规模

  • 47 条约束 (4 fatal + 43 non-fatal)
  • 上游源码: jxnl/instructor @ commit 3f1d6ddb
  • 蓝图 ID: finance-bp-139

用法

Host AI(Claude Code / Cursor / OpenClaw)读 references/seed.yaml,按其中的:

  • intent_router 匹配用户意图
  • architecture 理解项目架构
  • constraints 应用 anti-pattern 约束
  • business_decisions 参考核心设计决策

FAQ 摘要

这个 skill 适合什么用户?能做哪些任务?

适合需要从 LLM 拿到强类型结构化输出的工程师:信息抽取、表单解析、JSON API 直接返回 Pydantic 模型、agent 工具调用参数解析等。20 个 provider 一致 API。访问 doramagic.ai/r/instructor 查看完整用例。

需要准备什么环境?依赖什么?

Python 3.9+(instructor 在 pyproject 中声明 >=3.9)。Pydantic v2 事实上必须(function_calls.py 用 model_validate_json + TypeAdapter,都是 v2-only,v1 在 Partial 路径上 AttributeError)。

会踩哪些坑?这个 skill 怎么防护?

本 skill 内置 47 条约束(4 条 fatal)。典型踩坑:(1) failed_attempts XML 每次重试线性增长,max_retries=5 可超 context window;(2) from_openai 的 mode 验证用 assert,python -O 下静默剥离;


完整文档: 见 references/seed.yaml (v6.1 schema). 浏览页: https://doramagic.ai/zh/crystal/instructor-structured-output

安全使用建议
This package is internally inconsistent: the name/description promise a generic LLM->Pydantic adapter, but the included seed.yaml/human_summary are a finance blueprint that will ask the host to run Python checks, access/write workspace files, and rely on ZVT data. Before installing or enabling this skill: (1) don't allow it to run on a production agent or with broad filesystem access — use an isolated sandbox; (2) inspect references/seed.yaml and human_summary.md yourself to confirm the intended purpose; (3) if you expected a pure 'instructor' utility, ask the publisher why a finance blueprint and ZVT preconditions are bundled; (4) if you must run it, restrict agent permissions (no arbitrary shell/python execution, no write access to important dirs) and be prepared to manually supply any data instead of allowing the skill to probe your environment. If you are not comfortable with host-side Python commands and filesystem writes triggered by a skill whose metadata does not disclose them, do not install or enable it.
功能分析
Type: OpenClaw Skill Name: instructor-structured-output Version: 0.1.0 The skill bundle provides a comprehensive framework for an AI agent to perform quantitative trading tasks and structured data extraction using the 'instructor' and 'zvt' Python libraries. The core logic is defined in 'references/seed.yaml', which includes intent routing, architectural constraints, and automated validation gates for financial backtesting. While the skill performs high-risk actions such as environment setup via 'pip install' and shell-based preconditions (e.g., checking ZVT data directories), these actions are transparently documented and strictly aligned with the stated purpose of building quant strategies. No evidence of malicious intent, data exfiltration, or harmful prompt injection was found.
能力标签
cryptocan-make-purchases
能力评估
Purpose & Capability
The skill title/description advertises an LLM->Pydantic 'Instructor' adapter across 20 providers. However the bundled seed.yaml and human_summary are a compiled finance blueprint (finance-bp-139) focused on ZVT backtests, data directories, and domain-specific preconditions. Requiring ZVT, K-data, and backtest preconditions is not coherent with a generic 'instructor structured output' utility.
Instruction Scope
SKILL.md instructs the host AI to read references/seed.yaml and follow its execution protocol. seed.yaml contains explicit runtime actions that direct the host to run shell/python commands (e.g., import zvt checks, filesystem writes, sqlite write permission tests), reload seed.yaml on execute, and consult local files (LATEST.yaml / LATEST.jsonl). Those instructions expand scope to performing host-side checks and file access unrelated to the advertised LLM schema-mapping purpose.
Install Mechanism
No install spec or code is provided (instruction-only), which is low risk in itself. However seed.yaml references an install_trigger (resources.host_adapter.install_recipes[]) and a host verification step; there are no concrete install recipes included in the package, making the runtime behavior ambiguous — the host may attempt to run installs or import checks based on the blueprint instructions.
Credentials
The skill declares no required env vars, yet seed.yaml preconditions and checks reference ZVT_HOME and expect writable data directories and Python package availability. The blueprint implicitly requires filesystem and Python environment access (and potentially network access to fetch data/providers) that are not declared or justified by the skill's stated purpose.
Persistence & Privilege
The skill is not always:true and is user-invocable (normal). Still, seed.yaml defines workspace paths (scripts_path, skills_path, trace_path) and mandates reloading and writing to host workspace. This gives the skill potential to read/write files in the host workspace during execution, which is a privilege the README/metadata did not clearly surface.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install instructor-structured-output
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /instructor-structured-output 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
Instructor Pydantic structured output skill — 47 constraints / 4 fatal. 20 providers, 36 modes, 3-layer retry.
元数据
Slug instructor-structured-output
版本 0.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Instructor Structured Output 是什么?

Instructor:声明 Pydantic BaseModel 即可从 20 个 LLM provider 拿到类型化实例。核心是 monkey-patch(instructor.patch / from_*)拦截 create(),注入 schema-aware kwargs,tenacity 重试 + In... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 64 次。

如何安装 Instructor Structured Output?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install instructor-structured-output」即可一键安装,无需额外配置。

Instructor Structured Output 是免费的吗?

是的,Instructor Structured Output 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Instructor Structured Output 支持哪些平台?

Instructor Structured Output 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Instructor Structured Output?

由 Tang Weigang(@tangweigang-jpg)开发并维护,当前版本 v0.1.0。

💬 留言讨论