Files
DronePlanning/tools/rag/README.md

40 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# RAG & Map Tools
该目录包含了地图构建、知识库生成和向量数据库管理的相关工具。
## 目录结构
- **knowledge_base/**: 存放源文档数据。
- 支持格式: `.txt`, `.md`, `.pdf`
- 生成格式: `.json`, `.ndjson` (由 `build_knowledge_base.py` 生成)
- **map/**: 存放地图原始数据。
- `.osm` (OpenStreetMap 数据)
- `.world` (Gazebo 仿真环境数据)
- **vector_store/**: ChromaDB 向量数据库的持久化存储目录。
## 脚本说明
### 1. `build_knowledge_base.py`
**功能**: 处理 `map/` 目录下的地图文件,提取地理信息和语义描述,生成知识库文件到 `knowledge_base/` 目录。
**使用方法**:
```bash
python build_knowledge_base.py
```
### 2. `ingest.py`
**功能**: 读取 `knowledge_base/` 中的所有文档调用嵌入模型Embedding Model将其向量化并存入 `vector_store/` 中的 ChromaDB 数据库。
**使用方法**:
```bash
python ingest.py
```
**依赖**: 需要确保后端嵌入服务(如 `llama-server`)已启动,或者配置正确的 `ORIN_IP` 环境变量。
## 工作流
1. 将地图文件放入 `map/`
2. 运行 `build_knowledge_base.py` 生成文本描述。
3. 将其他补充文档放入 `knowledge_base/`
4. 运行 `ingest.py` 构建向量索引。