# RAG-examples **Repository Path**: NN-Studio/RAG-examples ## Basic Information - **Project Name**: RAG-examples - **Description**: 检索增强生成(RAG)实践用例,使用Python3语言开发 - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-01 - **Last Updated**: 2026-06-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # RAG-examples 检索增强生成(RAG)实践用例,使用Python3语言开发
## 如何运行? ### PostgreSQL 完成依赖安装: ``` brew install postgresql pgvector ``` 启动服务: ``` brew services start postgresql ``` 连接数据库: ``` psql postgres ``` 创建数据库 + 启用向量扩展: ``` postgres=# CREATE DATABASE rag_db; postgres=# \c rag_db; rag_db=# CREATE EXTENSION IF NOT EXISTS vector; ``` 创建存储文档的表和向量索引: ``` rag_db=# CREATE TABLE rag_documents ( id SERIAL PRIMARY KEY, content TEXT NOT NULL, -- 原文内容 metadata JSONB, -- 元数据(文件名、页码等) embedding vector(768) -- 向量维度 ); rag_db=# CREATE INDEX idx_rag_embedding ON rag_documents USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100); ``` ### Python3 > python3版本:3.14.5 首先,需要安装: ``` pip3 install -r requirements.txt ``` 然后直接: ``` python3 src/index.py ``` ## 版权 MIT License Copyright (c) [zxl20070701](https://zxl20070701.github.io/notebook/home.html) 走一步,再走一步