类class
agentscope.ragChunk
class Chunk(BaseModel)
源码Source
agentscope/rag/_document.py:71–102分块,把私有文档转化为可检索的知识。位于 agentscope.rag 包。
Each Chunk corresponds to one record in the vector store.
The required structural fields (source, chunk_index,
total_chunks) enable downstream features such as "expand
context around a hit" during retrieval.
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
content | TextBlock | DataBlock | 内容字段。 | — |
source | str | 来源字段。 | — |
chunk_index | int | 分块索引字段。 | — |
total_chunks | int | `total_chunks` 字段。 | — |
metadata | dict[str, Any] | 元数据字段。 | Field(default_factory=dict) |
属性详情Attribute Detail
content
TextBlock | DataBlock内容字段。声明为 TextBlock | DataBlock。
The content field.
源码Source
agentscope/rag/_document.py:80source
str来源字段。声明为 str。
The source field.
源码Source
agentscope/rag/_document.py:84chunk_index
int分块索引字段。声明为 int。
The chunk index field.
源码Source
agentscope/rag/_document.py:88total_chunks
inttotal_chunks 字段。声明为 int。
The total chunks field.
源码Source
agentscope/rag/_document.py:94metadata
dict[str, Any] = Field(default_factory=dict)元数据字段。声明为 dict[str, Any]。
The metadata field.
源码Source
agentscope/rag/_document.py:100