AS AgentScopeAPI 手册 / API Reference

Builder

public static class Builder
源码Source io/agentscope/core/memory/autocontext/PromptConfig.java:128–199

构建器,用于构建并配置目标实例。位于 io.agentscope.core.memory.autocontext 包。核心成员包括 previousRoundToolCompressPrompt、previousRoundSummaryPrompt、currentRoundLargeMessagePrompt、currentRoundCompressPrompt、build。

Builder class for constructing PromptConfig instances.

This builder follows the standard Builder pattern and supports method chaining. Each call to #build() creates a new independent instance, allowing the same builder to be reused multiple times safely.

Example:

`PromptConfig config = PromptConfig.builder()
.previousRoundToolCompressPrompt("Custom prompt 1")
.previousRoundSummaryPrompt("Custom prompt 4")
.build();
`

方法摘要Method Summary

方法Method说明Description
public Builder previousRoundToolCompressPrompt(String prompt)
设置该配置项。
Sets the prompt for Strategy 1: compressing previous round tool invocations.
public Builder previousRoundSummaryPrompt(String prompt)
设置该配置项。
Sets the prompt for Strategy 4: summarizing previous round conversations.
public Builder currentRoundLargeMessagePrompt(String prompt)
设置该配置项。
Sets the prompt for Strategy 5: summarizing current round large messages.
public Builder currentRoundCompressPrompt(String prompt)
设置该配置项。
Sets the prompt for Strategy 6: compressing current round messages.
public PromptConfig build()
构建并返回最终实例。
Builds a new PromptConfig instance with the configured values.

方法详情Method Detail

previousRoundToolCompressPrompt

public Builder previousRoundToolCompressPrompt(String prompt)

设置该配置项。

Sets the prompt for Strategy 1: compressing previous round tool invocations.

另见See also @see #previousRoundToolCompressPrompt
参数Parameters
名称Name类型Type说明Description
promptString提示词(类型 `String`)。the custom prompt text, or null/empty to use default
返回Returns Builder
返回当前实例,以支持链式调用。this builder instance for method chaining
源码Source io/agentscope/core/memory/autocontext/PromptConfig.java:138–141

previousRoundSummaryPrompt

public Builder previousRoundSummaryPrompt(String prompt)

设置该配置项。

Sets the prompt for Strategy 4: summarizing previous round conversations.

另见See also @see #previousRoundSummaryPrompt
参数Parameters
名称Name类型Type说明Description
promptString提示词(类型 `String`)。the custom prompt text, or null/empty to use default
返回Returns Builder
返回当前实例,以支持链式调用。this builder instance for method chaining
源码Source io/agentscope/core/memory/autocontext/PromptConfig.java:150–153

currentRoundLargeMessagePrompt

public Builder currentRoundLargeMessagePrompt(String prompt)

设置该配置项。

Sets the prompt for Strategy 5: summarizing current round large messages.

另见See also @see #currentRoundLargeMessagePrompt
参数Parameters
名称Name类型Type说明Description
promptString提示词(类型 `String`)。the custom prompt text, or null/empty to use default
返回Returns Builder
返回当前实例,以支持链式调用。this builder instance for method chaining
源码Source io/agentscope/core/memory/autocontext/PromptConfig.java:162–165

currentRoundCompressPrompt

public Builder currentRoundCompressPrompt(String prompt)

设置该配置项。

Sets the prompt for Strategy 6: compressing current round messages.

另见See also @see #currentRoundCompressPrompt
参数Parameters
名称Name类型Type说明Description
promptString提示词(类型 `String`)。the custom prompt text, or null/empty to use default
返回Returns Builder
返回当前实例,以支持链式调用。this builder instance for method chaining
源码Source io/agentscope/core/memory/autocontext/PromptConfig.java:177–180

build

public PromptConfig build()

构建并返回最终实例。

Builds a new PromptConfig instance with the configured values.

返回Returns PromptConfig
返回PromptConfig。a new PromptConfig instance with the configured prompt values
源码Source io/agentscope/core/memory/autocontext/PromptConfig.java:190–198
基于官方固定版本源码静态生成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.