Interface SkillSource

All Known Implementing Classes:
AbstractSkillSource, ClassPathSkillSource, InMemorySkillSource, LocalSkillSource

public interface SkillSource
用于获取可用技能的接口。

所有操作都是异步的;当出现通信故障时,系统会通过返回的结果来被动地响应这些故障。 Single 错误通道(以……结束) onError)来处理错误,而不是抛出异常;这些操作需要同步执行。实现方案必须使用相应的机制(或技术)来确保操作的同步性。 SkillSourceException 为了将错误信息传递回大型语言模型(LLM),需要使用特定的机制或流程。

  • 方法概述

    Modifier and Type
    Method
    Description
    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>
    加载…… Frontmatter 针对某项特定的技能(for a specific skill)。
    io.reactivex.rxjava3.core.Single<String>
    加载特定技能的指令(即 SKILL.md 文件中的内容)。
    io.reactivex.rxjava3.core.Single<com.google.common.io.ByteSource>
    loadResource(String skillName, String resourcePath)
    加载特定的资源文件内容。
  • 方法详细信息(Method Details)

    • listFrontmatters

      io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableMap<String, Frontmatter>> listFrontmatters()
      列出所有可用的选项。 Frontmatter“s”代表已发现的技能(discovered skills)。

      如果源配置错误(例如目录不存在,或者技能信息格式不正确),则返回的结果将会…… Single 程序将以……方式终止。 SkillSourceException 根据消息中的原因(with the reason in the message)。

      Returns:
      a Single emitting a map where keys are skill names and values are their Frontmatter
    • listResources

      io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableList<String>> listResources(String skillName, String resourceDirectory)
      列出指定目录中某个特定技能所使用的所有资源文件。

      如果该技能或资源目录不存在,那么返回的结果将会是……(具体内容需要根据实际情况填写)。 Single 将以……结尾 SkillSourceException.

      Parameters:
      skillName - the name of the skill
      resourceDirectory - the relative directory within the skill to list (e.g., "assets", "scripts")
      Returns:
      a Single emitting a list of resource paths relative to the skill directory
    • loadFrontmatter

      io.reactivex.rxjava3.core.Single<Frontmatter> loadFrontmatter(String skillName)
      加载…… Frontmatter 针对某项特定的技能(for a specific skill)。

      如果找不到该技能信息,或者其相关文档(frontmatter)的格式不正确,那么返回的结果将会是……(具体返回内容需要根据实际情况填写)。 Single 将以……结尾 SkillSourceException 或者是因为解析错误(parsing error)。

      Parameters:
      skillName - the name of the skill
      Returns:
      a Single emitting the Frontmatter for the skill
    • loadInstructions

      io.reactivex.rxjava3.core.Single<String> loadInstructions(String skillName)
      加载特定技能的指令(即 SKILL.md 文件中的内容)。

      如果该技能未被找到,或者其文件结构无效(例如:前置内容(frontmatter)块未正确关闭),则返回的…… Single 程序将以……方式终止。 SkillSourceException.

      Parameters:
      skillName - the name of the skill
      Returns:
      a Single emitting the instructions as a String
    • loadResource

      io.reactivex.rxjava3.core.Single<com.google.common.io.ByteSource> loadResource(String skillName, String resourcePath)
      加载特定的资源文件内容。

      如果找不到该技能或相应的资源路径,系统将返回以下内容: Single 将以……结尾 SkillSourceException.

      Parameters:
      skillName - the name of the skill
      resourcePath - the path to the resource file relative to the skill directory
      Returns:
      a Single emitting the ByteSource for the resource content