一个使用向量数据库的RAG #92

Open
opened 2024-09-14 17:52:48 +08:00 by 12535224197cs · 0 comments

step1: 准备模拟的数据文档

s1.png

step2: 准备文本向量接口:get_embeddings_bge, 准备文本对话接口:get_completion_ernie

s2.png

step3: 将文档添加到数据库

s3.png

step4: 根据用户的问题query和向量数据库查询的信息构建prompt模板

s4.png

step5: 测试

s5.png

* 向量数据库: chromadb * 文本向量的API接口: https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/embeddings/bge_large_en?access_token= * 文本对话的API接口: https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro?access_token= ### step1: 准备模拟的数据文档 ![s1.png](https://cdn.nlark.com/yuque/0/2024/png/44993204/1726306031064-27181279-73c6-4dd6-a6a4-573b8877a2d2.png?x-oss-process=image%2Fresize%2Cw_1500%2Climit_0) ### step2: 准备文本向量接口:get_embeddings_bge, 准备文本对话接口:get_completion_ernie ![s2.png](https://cdn.nlark.com/yuque/0/2024/png/44993204/1726307325303-dcdd045b-d4c4-4cf0-8c04-175e8793476d.png?x-oss-process=image%2Fresize%2Cw_1500%2Climit_0) ### step3: 将文档添加到数据库 ![s3.png](https://cdn.nlark.com/yuque/0/2024/png/44993204/1726306031158-d4b6e9d2-b08c-46b0-85d4-f251e8128820.png?x-oss-process=image%2Fresize%2Cw_1500%2Climit_0) ### step4: 根据用户的问题query和向量数据库查询的信息构建prompt模板 ![s4.png](https://cdn.nlark.com/yuque/0/2024/png/44993204/1726307439158-120ffb2b-53b0-422d-b5be-c63a55eff0dd.png?x-oss-process=image%2Fresize%2Cw_1500%2Climit_0) ### step5: 测试 ![s5.png](https://cdn.nlark.com/yuque/0/2024/png/44993204/1726306031035-678b9af4-2927-4c7c-b899-adcfeaef2a9b.png?x-oss-process=image%2Fresize%2Cw_1500%2Climit_0)
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: HswOAuth/llm_course#92
No description provided.