AgentSkillRepository
public interface AgentSkillRepository extends AutoCloseable
io/agentscope/core/skill/repository/AgentSkillRepository.java:35–133定义智能体技能仓库契约的接口。位于 io.agentscope.core.skill.repository 包,实现 AutoCloseable。核心成员包括 getSkill、getAllSkillNames、getAllSkills、save、delete、skillExists。
Repository interface for AgentSkill persistence operations.
This interface follows the Repository Pattern and Dependency Inversion Principle, allowing different storage stores (filesystem, database, remote APIs, etc.) to be used interchangeably.
Example usage:
`AgentSkillRepository repo = new GitHubSkillRepository("owner/repo");
AgentSkill skill = repo.getByName("calculate").orElseThrow();
`
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public AgentSkill getSkill(String name) | 获取技能。 Gets a skill by its name. |
public List<String> getAllSkillNames() | 获取 `getAllSkillNames`。 Lists all available skill IDs in the repository. |
public List<AgentSkill> getAllSkills() | 获取所有技能来自仓库。 Gets all skills from the repository. |
public boolean save(List<AgentSkill> skills, boolean force) | 保存数据到持久化存储。 Saves or updates a skill in the repository. |
public boolean delete(String skillName) | 删除数据。 Deletes a skill by its skill name. |
public boolean skillExists(String skillName) | 设置该参数。 Checks if a skill exists in the repository. |
public AgentSkillRepositoryInfo getRepositoryInfo() | 获取仓库信息。 Gets metadata about this repository. |
public String getSource() | 获取来源。 Gets the source identifier of this repository. |
public void setWriteable(boolean writeable) | 设置 `setWriteable`。 Sets the writeable flag for this repository. |
public boolean isWriteable() | 判断是否 `isWriteable`。 Checks if the repository supports write operations. |
default public void close()default | 关闭连接并释放相关资源。 Cleans up any resources used by this repository. |
方法详情Method Detail
getSkill
public AgentSkill getSkill(String name)
获取技能。
Gets a skill by its name.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 技能名称。The skill name |
AgentSkillIllegalArgumentException当if 名称或版本是无效时抛出 `IllegalArgumentException`。if name or version is invalid
io/agentscope/core/skill/repository/AgentSkillRepository.java:44getAllSkillNames
public List<String> getAllSkillNames()
获取 getAllSkillNames。
Lists all available skill IDs in the repository.
List<String>io/agentscope/core/skill/repository/AgentSkillRepository.java:53getAllSkills
public List<AgentSkill> getAllSkills()
获取所有技能来自仓库。
Gets all skills from the repository.
List<AgentSkill>io/agentscope/core/skill/repository/AgentSkillRepository.java:60save
public boolean save(List<AgentSkill> skills, boolean force)
保存数据到持久化存储。
Saves or updates a skill in the repository.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skills | List<AgentSkill> | 技能到保存。The skills to save |
force | boolean | force(类型 `boolean`)。Whether to force save even if the skill already exists |
booleanio/agentscope/core/skill/repository/AgentSkillRepository.java:73delete
public boolean delete(String skillName)
删除数据。
Deletes a skill by its skill name.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skillName | String | 技能名称(类型 `String`)。The skill name (never null) |
booleanio/agentscope/core/skill/repository/AgentSkillRepository.java:81skillExists
public boolean skillExists(String skillName)
设置该参数。
Checks if a skill exists in the repository.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skillName | String | 技能名称(类型 `String`)。The skill name (never null) |
booleanio/agentscope/core/skill/repository/AgentSkillRepository.java:89getRepositoryInfo
public AgentSkillRepositoryInfo getRepositoryInfo()
获取仓库信息。
Gets metadata about this repository.
AgentSkillRepositoryInfoio/agentscope/core/skill/repository/AgentSkillRepository.java:98getSource
public String getSource()
获取来源。
Gets the source identifier of this repository.
Stringio/agentscope/core/skill/repository/AgentSkillRepository.java:107setWriteable
public void setWriteable(boolean writeable)
设置 setWriteable。
Sets the writeable flag for this repository.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
writeable | boolean | writeable(类型 `boolean`)。Whether the repository supports write operations |
io/agentscope/core/skill/repository/AgentSkillRepository.java:114isWriteable
public boolean isWriteable()
判断是否 isWriteable。
Checks if the repository supports write operations.
booleanio/agentscope/core/skill/repository/AgentSkillRepository.java:121close
default public void close()
关闭连接并释放相关资源。
Cleans up any resources used by this repository.
io/agentscope/core/skill/repository/AgentSkillRepository.java:129–132