`Class InMemorySkillSource`
java.lang.Object
com.google.adk.skills.InMemorySkillSource
- All Implemented Interfaces:
SkillSource
一种基于内存的实现方式(in-memory implementation)
SkillSource.
所有内容都通过“构建器模式”在开发初期就被预先准备好了。
-
嵌套类概述
Nested ClassesModifier and TypeClassDescriptionstatic class“Builder for”是一个用于描述某种构建工具或框架的术语。它通常表示该工具/框架用于帮助开发者或系统管理员快速、高效地创建或构建特定类型的应用程序、系统或组件。例如:“Builder for Web Applications”(用于构建Web应用程序的工具)或“Builder for Cloud Services”(用于构建云服务的工具)。InMemorySkillSource. -
方法概述
Modifier and TypeMethodDescriptionstatic InMemorySkillSource.Builderbuilder()io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableMap<String, Frontmatter>> 列出所有可用的选项。Frontmatter“s”代表已发现的技能(discovered skills)。io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableList<String>> listResources(String skillName, String resourceDirectory) 列出指定目录中某个特定技能所使用的所有资源文件。io.reactivex.rxjava3.core.Single<Frontmatter> loadFrontmatter(String skillName) 加载……Frontmatter针对某项特定的技能(for a specific skill)。io.reactivex.rxjava3.core.Single<String> loadInstructions(String skillName) 加载特定技能的指令(即 SKILL.md 文件中的内容)。io.reactivex.rxjava3.core.Single<com.google.common.io.ByteSource> loadResource(String skillName, String resourcePath) 加载特定的资源文件内容。
-
方法详细信息(Method Details)
-
builder
-
listFrontmatters
public io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableMap<String, Frontmatter>> listFrontmatters()描述内容复制自接口文档:SkillSource列出所有可用的选项。Frontmatter“s”代表已发现的技能(discovered skills)。如果源配置错误(例如目录不存在,或者技能信息格式不正确),则返回的结果将会……
Single程序将以……方式终止。SkillSourceException根据消息中的原因(with the reason in the message)。- Specified by:
listFrontmattersin interfaceSkillSource- Returns:
- a
Singleemitting a map where keys are skill names and values are theirFrontmatter
-
listResources
public io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableList<String>> listResources(String skillName, String resourceDirectory) 描述内容复制自接口文档:SkillSource列出指定目录中某个特定技能所使用的所有资源文件。如果该技能或资源目录不存在,那么返回的结果将会是……(具体内容需要根据实际情况填写)。
Single将以……结尾SkillSourceException.- Specified by:
listResourcesin interfaceSkillSource- Parameters:
skillName- the name of the skillresourceDirectory- the relative directory within the skill to list (e.g., "assets", "scripts")- Returns:
- a
Singleemitting a list of resource paths relative to the skill directory
-
loadFrontmatter
描述内容复制自接口文档:SkillSource加载……Frontmatter针对某项特定的技能(for a specific skill)。如果找不到该技能信息,或者其相关文档(frontmatter)的格式不正确,那么返回的结果将会是……(具体返回内容需要根据实际情况填写)。
Single将以……结尾SkillSourceException或者是因为解析错误(parsing error)。- Specified by:
loadFrontmatterin interfaceSkillSource- Parameters:
skillName- the name of the skill- Returns:
- a
Singleemitting theFrontmatterfor the skill
-
loadInstructions
描述内容复制自接口文档:SkillSource加载特定技能的指令(即 SKILL.md 文件中的内容)。如果该技能未被找到,或者其文件结构无效(例如:前置内容(frontmatter)块未正确关闭),则返回的……
Single程序将以……方式终止。SkillSourceException.- Specified by:
loadInstructionsin interfaceSkillSource- Parameters:
skillName- the name of the skill- Returns:
- a
Singleemitting the instructions as a String
-
loadResource
public io.reactivex.rxjava3.core.Single<com.google.common.io.ByteSource> loadResource(String skillName, String resourcePath) 描述内容复制自接口文档:SkillSource加载特定的资源文件内容。如果找不到该技能或相应的资源路径,系统将返回以下内容:
Single将以……结尾SkillSourceException.- Specified by:
loadResourcein interfaceSkillSource- Parameters:
skillName- the name of the skillresourcePath- the path to the resource file relative to the skill directory- Returns:
- a
Singleemitting theByteSourcefor the resource content
-