LangChain + DeepSeek 构建 RAG 知识库系统
使用 LangChain + DeepSeek 构建企业级 RAG 知识库系统,支持文档上传、向量检索、流式问答。
2026年7月6日0 次阅读
LangChain + DeepSeek 构建 RAG 系统
技术栈
- LangChain:LLM 应用框架
- DeepSeek:大语言模型
- ChromaDB:向量数据库
- FastAPI:API 服务
核心代码
from langchain.chains import RetrievalQA
from langchain.embeddings import HuggingFaceEmbeddings
from langchain.vectorstores import Chroma
# 构建检索链
qa_chain = RetrievalQA.from_chain_type(
llm=llm,
retriever=vectorstore.as_retriever(),
chain_type="stuff"
)
部署
使用 Docker Compose 一键部署。