AS AgentScopeAPI 手册 / API Reference
类class agentscope.middleware

Parameters

class Parameters(BaseModel)
源码Source agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:370–448

参数,驱动智能体的推理、工具调用与会话执行。位于 agentscope.middleware 包。

The user-tunable filesystem parameters. Declared in agentscope.middleware.

属性摘要Attribute Summary

属性Attribute类型Type说明Description值Value
model_config—
模型配置字段。
{'arbitrary_types_allowed': True}
memory_max_tokensint
记忆最大令牌数字段。
Field(default=4000, title='MEMORY.md Max Length', description='The maximum tokens of the MEMORY.md inserted into the system prompt.')
memory_instructionsstr
记忆指令字段。
Field(default=DEFAULT_MEMORY_INSTRUCTIONS, title='Memory Instructions', description='The default instructions appended to the system prompt before the MEMORY.md snapshots.')
retrieval_asyncbool
检索异步字段。
Field(default=True, title='Async Retrieval', description='Whether to retrieve relevant memory files asynchronously during the agent reply. If `True`, an async retrieval task will be started.')
retrieval_modelChatModelBase | None
检索模型字段。
Field(default=None, title='Retrieval Model', description="The LLM used to retrieve relevant memory files asynchronously during the agent reply. If `None`, the agent's model will be used.")
retrieval_max_tokens_per_mdint
检索最大令牌数每个 md字段。
Field(default=2000, title='Retrieval Max Tokens Per File', description='Maximum tokens read from each memory file that is surfaced by the relevance retrieval step. Keeps individual files from flooding the context window.')
retrieval_max_filesint
检索最大文件字段。
Field(default=200, title='Retrieval Max Files', description='The maximum number of Markdown memory files to consider during relevance selection.')
retrieval_max_tokens_per_frontmatterint
`retrieval_max_tokens_per_frontmatter` 字段。
Field(default=256, title='Retrieval Max Tokens per Frontmatter', description='The maximum number of tokens to read from the beginning of each Markdown file when parsing frontmatter.')
retrieval_instructionsstr
检索指令字段。
Field(default=DEFAULT_RETRIEVAL_INSTRUCTIONS, title='Retrieval Instructions', description='The instructions used to select relevant memory files for a given user query in the asynchronous retrieval task.')

属性详情Attribute Detail

model_config

 = {'arbitrary_types_allowed': True}

模型配置字段。

The model config field.

源码Source agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:373

memory_max_tokens

int = Field(default=4000, title='MEMORY.md Max Length', description='The maximum tokens of the MEMORY.md inserted into the system prompt.')

记忆最大令牌数字段。声明为 int。

The maximum tokens of the MEMORY.md inserted into the system prompt.

源码Source agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:375

memory_instructions

str = Field(default=DEFAULT_MEMORY_INSTRUCTIONS, title='Memory Instructions', description='The default instructions appended to the system prompt before the MEMORY.md snapshots.')

记忆指令字段。声明为 str。

The default instructions appended to the system prompt before the MEMORY.md snapshots.

源码Source agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:384

retrieval_async

bool = Field(default=True, title='Async Retrieval', description='Whether to retrieve relevant memory files asynchronously during the agent reply. If `True`, an async retrieval task will be started.')

检索异步字段。声明为 bool。

Whether to retrieve relevant memory files asynchronously during the agent reply.

源码Source agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:393

retrieval_model

ChatModelBase | None = Field(default=None, title='Retrieval Model', description="The LLM used to retrieve relevant memory files asynchronously during the agent reply. If `None`, the agent's model will be used.")

检索模型字段。声明为 ChatModelBase | None。

The LLM used to retrieve relevant memory files asynchronously during the agent reply.

源码Source agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:403

retrieval_max_tokens_per_md

int = Field(default=2000, title='Retrieval Max Tokens Per File', description='Maximum tokens read from each memory file that is surfaced by the relevance retrieval step. Keeps individual files from flooding the context window.')

检索最大令牌数每个 md字段。声明为 int。

Maximum tokens read from each memory file that is surfaced by the relevance retrieval step.

源码Source agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:413

retrieval_max_files

int = Field(default=200, title='Retrieval Max Files', description='The maximum number of Markdown memory files to consider during relevance selection.')

检索最大文件字段。声明为 int。

The maximum number of Markdown memory files to consider during relevance selection.

源码Source agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:423

retrieval_max_tokens_per_frontmatter

int = Field(default=256, title='Retrieval Max Tokens per Frontmatter', description='The maximum number of tokens to read from the beginning of each Markdown file when parsing frontmatter.')

retrieval_max_tokens_per_frontmatter 字段。声明为 int。

The maximum number of tokens to read from the beginning of each Markdown file when parsing frontmatter.

源码Source agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:432

retrieval_instructions

str = Field(default=DEFAULT_RETRIEVAL_INSTRUCTIONS, title='Retrieval Instructions', description='The instructions used to select relevant memory files for a given user query in the asynchronous retrieval task.')

检索指令字段。声明为 str。

The instructions used to select relevant memory files for a given user query in the asynchronous retrieval task.

源码Source agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:441
基于官方固定版本源码静态生成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.