Download Mini_RAG/core/schema.py from TuNan52/Mini-RAG: direct link, hf CLI and curl.
- Browser
- Download file 517 Bytes
-
https://huggingface.co/spaces/TuNan52/Mini-RAG/resolve/main/Mini_RAG/core/schema.py
- Command line
-
hf download hf://spaces/TuNan52/Mini-RAG/Mini_RAG/core/schema.py
-
curl -L -o schema.py https://huggingface.co/spaces/TuNan52/Mini-RAG/resolve/main/Mini_RAG/core/schema.py
517 Bytes
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # @Time : 2025/4/24 21:11 | |
| # @Author : hukangzhe | |
| # @File : schema.py | |
| # @Description : 不直接处理纯文本字符串. 引入一个标准化的数据结构来承载文本块,既有内容,也有元数据。 | |
| from dataclasses import dataclass, field | |
| from typing import Dict, Any | |
| class Document: | |
| text: str | |
| metadata: Dict[str, Any] = field(default_factory=dict) | |
| class Chunk(Document): | |
| parent_id: int = None |