Install
openclaw skills install opendao-laozi老子智能体(李耳)— 基于 RAG 的《道德经》问答系统。使用 LangChain + Chroma 向量数据库, 检索增强生成,以老子身份回答关于道家思想和《道德经》的问题。 支持多版本原文对比、思想主题导航、对话记忆。 触发场景:用户提到"老子"、"道德经"、"道家"、"请问老子"、"老子说"、"李耳"、 "无为"、"道论"、"德论"等关键词时激活。
openclaw skills install opendao-laozi基于 LangChain + Chroma 的 RAG 问答系统,以春秋时期思想家老子(李耳)的身份回答问题。
本项目提供两个独立入口,共享同一套知识库,但使用不同的模型:
| OpenAI 版 | 免费版 | |
|---|---|---|
| 入口 | scripts/laozi_agent.py | app.py |
| Embedding | text-embedding-3-large | BAAI/bge-base-zh-v1.5(本地) |
| LLM | gpt-4o | Qwen/Qwen2.5-72B-Instruct |
| 需要 API Key | ✅ OPENAI_API_KEY | ❌ 无需 |
| 界面 | 命令行 | Gradio Web |
| Temperature | 0.1 | 0.3 |
# 安装全部依赖(两个版本通用)
pip install -r requirements.txt
# 或按需安装:
# OpenAI 版只需:
pip install langchain langchain-openai langchain-chroma chromadb
# 免费版只需:
pip install langchain langchain-community langchain-chroma chromadb sentence-transformers huggingface_hub gradio
export OPENAI_API_KEY="sk-xxx"
python3 scripts/laozi_agent.py
python3 app.py
# 浏览器打开 http://localhost:7860
laozi_skill)以老子身份回答问题,引用《道德经》原文,返回引用来源。
from scripts.laozi_agent import laozi_skill
result = laozi_skill("什么是道?")
# result["answer"] — 老子的回答
# result["sources"] — 引用来源列表
compare_versions)对比同一章节的不同版本原文(郭店楚简、马王堆帛书、王弼注本等)。
from scripts.laozi_agent import compare_versions
versions = compare_versions(1) # 对比第1章
get_topics / get_topic_content)获取老子思想主要主题及相关内容。
from scripts.laozi_agent import get_topics, get_topic_content
topics = get_topics()
content = get_topic_content("道论")
知识库目录 ./laozi_knowledge_base/,向量集合名 laozi_collection。
文档元数据字段:
type — "原文" / "注释" / "研究"version — 版本名(郭店楚简本、马王堆帛书甲本 等)chapter — 章节号topic — 主题标签(道论、德论 等)title — 书名/篇名page — 页码详细书单见 references/knowledge_base_booklist.md。
两个入口均可通过环境变量覆盖默认配置:
| 环境变量 | OpenAI 版默认 | 免费版默认 | 说明 |
|---|---|---|---|
LAOZI_EMBEDDING_MODEL | text-embedding-3-large | BAAI/bge-base-zh-v1.5 | 向量模型 |
LAOZI_LLM_MODEL | gpt-4o | Qwen/Qwen2.5-72B-Instruct | 生成模型 |
LAOZI_TEMPERATURE | 0.1 | 0.3 | 温度(越低越严谨) |
LAOZI_RETRIEVAL_K | 5 | 5 | 返回文档数 |
LAOZI_FETCH_K | 20 | 20 | MMR 候选池大小 |
LAOZI_PERSIST_DIR | ./laozi_knowledge_base | ./laozi_knowledge_base | 向量库目录 |
LAOZI_COLLECTION | laozi_collection | laozi_collection | 集合名 |
| 平台 | 链接 | 说明 |
|---|---|---|
| GitLab(主仓库) | https://gitlab.scnet.cn:9002/space/aaroncxxx/opendao | 源码、Issue、CI/CD |
| GitHub(镜像) | https://github.com/aaroncxxx/OpenDao-LaoZi | 国内加速镜像 |
| HuggingFace(模型) | https://hf-mirror.com/aaroncxxx/OpenDao-LaoZi | 源文档 + 模型资源(国内镜像) |