华为开发者空间:基于DeepSeek构建RAG向量数据库
摘要:让大家熟悉如何通过云主机部署DeepSeek,并且通过本地部署的DeepSeek快速搭建RAG向量数据库。
一、案例介绍
二、案例时间
三、案例流程
四、资源总览
|
资源名称
|
规格
|
单价(元)
|
时长(分钟)
|
|
云主机
|
2vCPUs
| 4GB X86 Ubuntu 22.04 Server定制版 |
免费
|
60
|
五、云主机部署DeepSeek
5.1安装Ollama
curl -fsSL https://ollama.com/install.sh | sh
5.2模型部署
ollama run deepseek-r1:1.5b
ollama pull mxbai-embed-large
六、RAG向量数据库创建
6.1虚拟环境创建
6.2 RAG向量数据库构建
git clone https://github.com/paquino11/chatpdf-rag-deepseek-r1
cd chatpdf-rag-deepseek-r1
pip install -r requirements.txt
6.3 RAG向量数据库功能实现
def __init__(self, llm_model: str = "deepseek-r1:1.5b", embedding_model: str = "mxbai-embed-large"):
streamlit run app.py