类class
agentscope.app.ragDimensionPolicy
class DimensionPolicy(BaseModel)
源码Source
agentscope/app/rag/knowledge_base_manager/_dimension_policy.py:57–154维度策略,把私有文档转化为可检索的知识。位于 agentscope.app.rag 包。核心成员包括 accepts、filter_card。
The dimension policy a manager exposes to the front-end. Declared in agentscope.app.rag.
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
kind | DimensionPolicyKind | 种类字段。 | Field(description='What constraint applies to the chosen dimension.') |
dimension | int | None | 维度字段。 | Field(default=None, description='The required dimension when ``kind`` is ``FIXED`` or ``LOCKED_BY_EXISTING``. Always ``None`` for ``ANY``.') |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
def accepts(dimensions: int) -> bool | 设置该参数。 Check whether a candidate dimension satisfies this policy. |
def filter_card(card: 'EmbeddingModelCard') -> 'EmbeddingModelCard | None' | 过滤卡片。 Project an embedding model card through this policy. |
属性详情Attribute Detail
kind
DimensionPolicyKind = Field(description='What constraint applies to the chosen dimension.')种类字段。声明为 DimensionPolicyKind。
What constraint applies to the chosen dimension.
源码Source
agentscope/app/rag/knowledge_base_manager/_dimension_policy.py:60dimension
int | None = Field(default=None, description='The required dimension when ``kind`` is ``FIXED`` or ``LOCKED_BY_EXISTING``. Always ``None`` for ``ANY``.')维度字段。声明为 int | None。
The required dimension when kind is FIXED or LOCKED_BY_EXISTING.
源码Source
agentscope/app/rag/knowledge_base_manager/_dimension_policy.py:65方法详情Method Detail
accepts
def accepts(dimensions: int) -> bool
设置该参数。
Check whether a candidate dimension satisfies this policy.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
dimensions | int | 向量维度(类型 `int`)。The candidate output dimension. |
bool
返回布尔值,表示判断结果。`bool`:
源码Source
agentscope/app/rag/knowledge_base_manager/_dimension_policy.py:97–110filter_card
def filter_card(card: 'EmbeddingModelCard') -> 'EmbeddingModelCard | None'
过滤卡片。
Used by the knowledge base router to pre-filter the embedding model catalogue exposed at KB-creation time: - ANY returns the card unchanged.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
card | 'EmbeddingModelCard' | 卡片(类型 `'EmbeddingModelCard'`)。The candidate embedding model card. |
'EmbeddingModelCard | None'
返回'EmbeddingModelCard|None'。`EmbeddingModelCard | None`:
源码Source
agentscope/app/rag/knowledge_base_manager/_dimension_policy.py:112–154