AS AgentScopeAPI 手册 / API Reference
类class agentscope.app.rag

DimensionPolicy

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
kindDimensionPolicyKind
种类字段。
Field(description='What constraint applies to the chosen dimension.')
dimensionint | 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:60

dimension

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
dimensionsint向量维度(类型 `int`)。The candidate output dimension.
返回Returns bool
返回布尔值,表示判断结果。`bool`:
源码Source agentscope/app/rag/knowledge_base_manager/_dimension_policy.py:97–110

filter_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.
返回Returns 'EmbeddingModelCard | None'
返回'EmbeddingModelCard|None'。`EmbeddingModelCard | None`:
源码Source agentscope/app/rag/knowledge_base_manager/_dimension_policy.py:112–154
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.