← ClaudeAtlas

structailisted

Use when building, testing, or debugging LLM applications with the StructAI Python toolkit, including LLMAgent calls, structured outputs, LLM judging, batch concurrency, file/PDF utilities, text parsing, private-IP no_proxy handling, and timeout wrappers.
black-yt/skills · ★ 2 · AI & Automation · score 63
Install: claude install-skill black-yt/skills
# StructAI ## 使用边界 - 用于基于 `structai` 快速搭建 LLM workflow、批量推理、结构化输出、评测、PDF 解析和常用 I/O。 - 不要把 API key、token、私有 base URL 写进代码或日志;优先读取环境变量。 - 不要擅自安装、升级或修改共享 Python/conda 环境;需要安装 `structai` 或依赖时,先征得用户同意。 - 如果本地 `structai` 版本和示例不一致,先用 `python -c "from structai import structai_skill; print(structai_skill())"` 查看当前版本文档。 ## 环境变量 ```bash export LLM_API_KEY="[API_KEY]" export LLM_BASE_URL="[OPENAI_COMPATIBLE_BASE_URL]" export MINERU_TOKEN="[MINERU_TOKEN]" # 仅 PDF 解析需要 ``` - PyPI 安装:`pip install structai` - GitHub 源码:https://github.com/black-yt/structai 安装模板: ```bash pip install structai ``` 开发版本模板: ```bash git clone https://github.com/black-yt/structai.git cd structai pip install -e . ``` ## 源码追溯 - 如果示例和当前行为不一致,优先追溯已安装包源码,而不是猜测 API。 - `inspect.getsource(...)` 适合快速查看函数、类、方法的真实实现。 - `module.__file__` 可定位包安装路径,再按需打开源码文件。 - 源码只用于阅读和定位问题,不要改源码,不要修改 `site-packages` 或共享环境;需要改库时,先 clone 仓库并使用 editable install,且必须征得用户同意。 ```python import inspect import structai from structai import LLMAgent, Judge, read_pdf, multi_thread print(structai.__file__) print(inspect.getsource(LLMAgent)) print(inspect.getsource(Judge)) print(inspect.getsource(read_pdf)) print(inspect.getsource(multi_thread)) ``` 命令行快速定位: ```bash python - <<'PY' import structai print(structai.__file__) PY ``` ## 内置文档与 Prompt - `structai_skill()` 会返回当前安装版本的 Markdown 文档;版本不确定时优先查看它。 - `prompts` 保存内置 judge / arena 等 prompt 模板;做评测时优先复用已有模板,再按任务小幅调整。 - 不要把 `structai_skill()` 的长输出无条件塞进上下文;只在 API 不确定或需要核对当前版本时��取。 ```python fro