类class
agentscope.ragSection
class Section(BaseModel)
源码Source
agentscope/rag/_document.py:31–68Section,把私有文档转化为可检索的知识。位于 agentscope.rag 包。
A Section represents one logical region of the source file.
The :class:ChunkerBase guarantees that no resulting
:class:Chunk ever spans content from two different sections.
The granularity of a Section is format-specific:
- PDF: one section per page (plus separate sections for embedded images).
- PPTX: one section per slide.
- Markdown: one section per top-level heading, or the entire file if unstructured.
- TXT / image / video: one section for the whole file.
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
content | TextBlock | DataBlock | 内容字段。 | — |
source | str | 来源字段。 | — |
metadata | dict[str, Any] | 元数据字段。 | Field(default_factory=dict) |
属性详情Attribute Detail
content
TextBlock | DataBlock内容字段。声明为 TextBlock | DataBlock。
The content field.
源码Source
agentscope/rag/_document.py:48source
str来源字段。声明为 str。
The source field.
源码Source
agentscope/rag/_document.py:52metadata
dict[str, Any] = Field(default_factory=dict)元数据字段。声明为 dict[str, Any]。
The metadata field.
源码Source
agentscope/rag/_document.py:57