Class: Riffer::Skills::Adapter
- Inherits:
-
Object
- Object
- Riffer::Skills::Adapter
- Defined in:
- lib/riffer/skills/adapter.rb
Overview
Interface for skill adapters — provider-specific rendering of the available-skills section in the system prompt. Subclass and override render_catalog; the activation tool is exposed via #skill_activate_tool for the rendered output.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#skill_activate_tool ⇒ Object
readonly
The activation tool class for this adapter.
Instance Method Summary collapse
-
#catalog_instructions ⇒ Object
The behavioral instructions rendered alongside the catalog.
-
#initialize(skill_activate_tool:) ⇒ Adapter
constructor
– : (skill_activate_tool: singleton(Riffer::Tool)) -> void.
-
#render_activation(skill, body) ⇒ Object
Renders an activated skill body wrapped in identifying tags.
-
#render_catalog(skills) ⇒ Object
Renders a skill catalog section for the system prompt.
Constructor Details
#initialize(skill_activate_tool:) ⇒ Adapter
– : (skill_activate_tool: singleton(Riffer::Tool)) -> void
14 15 16 |
# File 'lib/riffer/skills/adapter.rb', line 14 def initialize(skill_activate_tool:) @skill_activate_tool = skill_activate_tool end |
Instance Attribute Details
#skill_activate_tool ⇒ Object (readonly)
The activation tool class for this adapter.
10 11 12 |
# File 'lib/riffer/skills/adapter.rb', line 10 def skill_activate_tool @skill_activate_tool end |
Instance Method Details
#catalog_instructions ⇒ Object
The behavioral instructions rendered alongside the catalog. – : () -> String
35 36 37 38 |
# File 'lib/riffer/skills/adapter.rb', line 35 def catalog_instructions "When a user's request matches a skill description below, call the `#{skill_activate_tool.name}` tool with the skill name. After activation, follow the skill's instructions. " \ "If a skill's instructions already appear in your context (inside <skill_content> tags), follow them instead of activating the skill again." end |
#render_activation(skill, body) ⇒ Object
Renders an activated skill body wrapped in identifying tags. – : (Riffer::Skills::Frontmatter, String) -> String
28 29 30 |
# File 'lib/riffer/skills/adapter.rb', line 28 def render_activation(skill, body) %(<skill_content name="#{skill.name}">\n#{body}\n</skill_content>) end |
#render_catalog(skills) ⇒ Object
Renders a skill catalog section for the system prompt. – : (Array) -> String
21 22 23 |
# File 'lib/riffer/skills/adapter.rb', line 21 def render_catalog(skills) raise NotImplementedError, "#{self.class} must implement #render_catalog" end |