AnythingLLM RAG Skill
Query local/private documents through AnythingLLM's RAG API.
Configuration
Environment variables (set in TOOLS.md or shell):
- -
ANYTHINGLLM_URL — default INLINECODE1 - INLINECODE2 — API token
- INLINECODE3 — default workspace slug
Script location: INLINECODE4
When to Use
Use AnythingLLM RAG when:
- - User asks about their local/private documents
- User wants to search uploaded PDFs, DOCX, TXT files
- User asks "what does X document say about Y"
- User wants to upload documents to the knowledge base
Use default model when:
- - General knowledge questions
- Questions not related to local documents
- Coding, writing, analysis without document context
Commands
Query documents (RAG)
CODEBLOCK0
Upload a file
CODEBLOCK1
Upload raw text
CODEBLOCK2
List documents
CODEBLOCK3
Check API health
CODEBLOCK4
Response Format
Query returns JSON with:
- -
textResponse — the RAG-generated answer - INLINECODE6 — array of source documents used for context
Present the answer to the user, citing relevant sources when available.
Notes
- - Scripts are in the skill's
scripts/ directory — use paths relative to skill location - API key and workspace are pre-configured
- For PDF/DOCX queries, documents must be uploaded first
AnythingLLM RAG 技能
通过AnythingLLM的RAG API查询本地/私有文档。
配置
环境变量(在TOOLS.md或shell中设置):
- - ANYTHINGLLMURL — 默认值 http://localhost:3001
- ANYTHINGLLMAPIKEY — API令牌
- ANYTHINGLLMWORKSPACE — 默认工作区标识符
脚本位置:scripts/anythingllm.sh
使用时机
使用AnythingLLM RAG的场景:
- - 用户询问其本地/私有文档相关内容
- 用户想要搜索已上传的PDF、DOCX、TXT文件
- 用户询问X文档对Y有什么说法
- 用户想要上传文档到知识库
使用默认模型的场景:
- - 通用知识问题
- 与本地文档无关的问题
- 无需文档上下文的编码、写作、分析
命令
查询文档(RAG)
bash
bash scripts/anythingllm.sh query 你的问题
上传文件
bash
bash scripts/anythingllm.sh upload /path/to/file.pdf
上传原始文本
bash
bash scripts/anythingllm.sh upload-text 文本内容 文档标题
列出文档
bash
bash scripts/anythingllm.sh list-docs
检查API健康状态
bash
bash scripts/anythingllm.sh health
响应格式
查询返回JSON,包含:
- - textResponse — RAG生成的答案
- sources — 用于上下文的源文档数组
向用户呈现答案,并在可用时引用相关来源。
注意事项
- - 脚本位于技能的scripts/目录中——使用相对于技能位置的路径
- API密钥和工作区已预先配置
- 对于PDF/DOCX查询,文档必须首先上传