AgentSkillPromptProvider
public class AgentSkillPromptProvider
io/agentscope/core/skill/AgentSkillPromptProvider.java:38–390智能体技能提示词提供者,让智能体以受控方式调用外部能力。位于 io.agentscope.core.skill 包。核心成员包括 getSkillSystemPrompt、setCodeExecutionEnable、setUploadDir、setCodeExecutionInstruction、setExposeAllMetadata、AgentSkillPromptProvider。
Generates skill system prompts for agents to understand available skills.
This provider creates system prompts containing information about available skills that the LLM can dynamically load and use.
Usage example:
`AgentSkillPromptProvider provider = new AgentSkillPromptProvider(registry);
String prompt = provider.getSkillSystemPrompt();
`
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
DEFAULT_AGENT_SKILL_INSTRUCTIONstaticfinal | String | 默认智能体技能指令字段。 The DEFAULT AGENT SKILL INSTRUCTION field. |
DEFAULT_CODE_EXECUTION_INSTRUCTIONstaticfinal | String | 默认 CODE 执行指令字段。 The DEFAULT CODE EXECUTION INSTRUCTION field. |
DEFAULT_PER_SKILL_CODE_EXECUTION_INSTRUCTIONstaticfinal | String | 默认每个技能 CODE 执行指令字段。 Code-execution instruction used when every visible skill carries its own `
<files-root>` (e.g. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public AgentSkillPromptProvider(SkillRegistry registry) | 创建技能提示词提供者。 Creates a skill prompt provider. |
public AgentSkillPromptProvider(SkillRegistry registry, String instruction) | 创建技能提示词提供者使用自定义指令。 Creates a skill prompt provider with custom instruction. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getSkillSystemPrompt() | 获取技能系统提示词。 Gets the skill system prompt for the agent with all skills included. |
public String getSkillSystemPrompt(SkillFilter filter) | 获取技能系统提示词。 Gets the skill system prompt filtered by the given `SkillFilter`. |
public void setCodeExecutionEnable(boolean codeExecutionEnabled) | 设置 `setCodeExecutionEnable`。 Sets whether code execution instructions are included in the skill system prompt. |
public void setUploadDir(Path uploadDir) | 设置上传目录。 Sets the upload directory whose absolute path replaces every `%s`
placeholder in the code execution instruction template. |
public void setCodeExecutionInstruction(String codeExecutionInstruction) | 设置 `setCodeExecutionInstruction`。 Sets a custom code execution instruction template. |
public void setExposeAllMetadata(boolean exposeAllMetadata) | 设置 `setExposeAllMetadata`。 Sets whether all metadata fields are exposed to the LLM. |
字段详情Field Detail
DEFAULT_AGENT_SKILL_INSTRUCTION
public static final String DEFAULT_AGENT_SKILL_INSTRUCTION
默认智能体技能指令字段。声明为 public static final String DEFAULT_AGENT_SKILL_INSTRUCTION。
The DEFAULT AGENT SKILL INSTRUCTION field.
io/agentscope/core/skill/AgentSkillPromptProvider.java:49–75DEFAULT_CODE_EXECUTION_INSTRUCTION
public static final String DEFAULT_CODE_EXECUTION_INSTRUCTION
默认 CODE 执行指令字段。声明为 public static final String DEFAULT_CODE_EXECUTION_INSTRUCTION。
The DEFAULT CODE EXECUTION INSTRUCTION field.
io/agentscope/core/skill/AgentSkillPromptProvider.java:78–110DEFAULT_PER_SKILL_CODE_EXECUTION_INSTRUCTION
public static final String DEFAULT_PER_SKILL_CODE_EXECUTION_INSTRUCTION
默认每个技能 CODE 执行指令字段。声明为 public static final String DEFAULT_PER_SKILL_CODE_EXECUTION_INSTRUCTION。
Code-execution instruction used when every visible skill carries its own (e.g.
io/agentscope/core/skill/AgentSkillPromptProvider.java:118–134构造器详情Constructor Detail
AgentSkillPromptProvider
public AgentSkillPromptProvider(SkillRegistry registry)
创建技能提示词提供者。
Creates a skill prompt provider.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
registry | SkillRegistry | 注册表(类型 `SkillRegistry`)。The skill registry containing registered skills |
io/agentscope/core/skill/AgentSkillPromptProvider.java:141–143AgentSkillPromptProvider
public AgentSkillPromptProvider(SkillRegistry registry, String instruction)
创建技能提示词提供者使用自定义指令。
Creates a skill prompt provider with custom instruction.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
registry | SkillRegistry | 注册表(类型 `SkillRegistry`)。The skill registry containing registered skills |
instruction | String | 指令(类型 `String`)。Custom instruction header (null or blank uses default) |
io/agentscope/core/skill/AgentSkillPromptProvider.java:151–157方法详情Method Detail
getSkillSystemPrompt
public String getSkillSystemPrompt()
获取技能系统提示词。
Gets the skill system prompt for the agent with all skills included.
Stringio/agentscope/core/skill/AgentSkillPromptProvider.java:173–175getSkillSystemPrompt
public String getSkillSystemPrompt(SkillFilter filter)
获取技能系统提示词。
Gets the skill system prompt filtered by the given SkillFilter.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
filter | SkillFilter | 过滤条件(类型 `SkillFilter`)。the filter deciding which skills to include (null treated as all) |
Stringio/agentscope/core/skill/AgentSkillPromptProvider.java:183–226setCodeExecutionEnable
public void setCodeExecutionEnable(boolean codeExecutionEnabled)
设置 setCodeExecutionEnable。
Sets whether code execution instructions are included in the skill system prompt.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
codeExecutionEnabled | boolean | code 执行已启用(类型 `boolean`)。`true` to append code execution instructions |
io/agentscope/core/skill/AgentSkillPromptProvider.java:261–263setUploadDir
public void setUploadDir(Path uploadDir)
设置上传目录。
Sets the upload directory whose absolute path replaces every %s placeholder in the code execution instruction template.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
uploadDir | Path | 上传目录(类型 `Path`)。the upload directory path, or `null` to disable path substitution |
io/agentscope/core/skill/AgentSkillPromptProvider.java:271–273setCodeExecutionInstruction
public void setCodeExecutionInstruction(String codeExecutionInstruction)
设置 setCodeExecutionInstruction。
Sets a custom code execution instruction template.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
codeExecutionInstruction | String | code 执行指令(类型 `String`)。the custom template, or `null`/blank for default |
io/agentscope/core/skill/AgentSkillPromptProvider.java:284–289setExposeAllMetadata
public void setExposeAllMetadata(boolean exposeAllMetadata)
设置 setExposeAllMetadata。
Sets whether all metadata fields are exposed to the LLM.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
exposeAllMetadata | boolean | expose 所有元数据(类型 `boolean`)。`true` to expose all metadata, `false` to expose only the core fields |
io/agentscope/core/skill/AgentSkillPromptProvider.java:300–302