agentscope.middlewareParameters
class Parameters(BaseModel)
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_tokens | int | 记忆最大令牌数字段。 | Field(default=4000, title='MEMORY.md Max Length', description='The maximum tokens of the MEMORY.md inserted into the system prompt.') |
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.') |
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.') |
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.") |
retrieval_max_tokens_per_md | int | 检索最大令牌数每个 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_files | int | 检索最大文件字段。 | Field(default=200, title='Retrieval Max Files', description='The maximum number of Markdown memory files to consider during relevance selection.') |
retrieval_max_tokens_per_frontmatter | int | `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_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.') |
属性详情Attribute Detail
model_config
= {'arbitrary_types_allowed': True}模型配置字段。
The model config field.
agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:373memory_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.
agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:375memory_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.
agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:384retrieval_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.
agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:393retrieval_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.
agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:403retrieval_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.
agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:413retrieval_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.
agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:423retrieval_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.
agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:432retrieval_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.
agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:441