Class: Insika::Tools::LoadKnowledge
- Inherits:
-
RubyLLM::Tool
- Object
- RubyLLM::Tool
- Insika::Tools::LoadKnowledge
- Defined in:
- lib/insika/tools/load_knowledge.rb
Overview
Level 2 of knowledge's progressive disclosure: loads a learned
concept's full body on demand, by the name the <knowledge> block
listed. Same shape as LoadSkill — a system default (outside the
allowlist), wired only when the profile opted in
(knowledge.retrieve), never through tools_allow.
require "ruby_llm" stays in THIS file (it inherits from
RubyLLM::Tool), so it does NOT enter lib/insika.rb — the Executor
loads it lazily inside create_chat, same as load_skill.
Instance Method Summary collapse
- #execute(name:) ⇒ Object
-
#initialize(store, agent_id, tenant: nil, trace_recorder: nil, state: nil) ⇒ LoadKnowledge
constructor
trace_recorder/state are OPTIONAL (nil = no trace, parity): this tool is deliberately NOT enveloped (ToolAssembly#wrap_tools), so without recording HERE the call is missing from the Studio's trace — same shape as LoadSkill.
-
#name ⇒ Object
RubyLLM::Tool#name derives from self.class.name — for a nested class it produces "insika--tools--load_knowledge", not "load_knowledge" (which wire_callbacks/:knowledge_retrieved assume).
Constructor Details
#initialize(store, agent_id, tenant: nil, trace_recorder: nil, state: nil) ⇒ LoadKnowledge
trace_recorder/state are OPTIONAL (nil = no trace, parity): this tool is deliberately NOT enveloped (ToolAssembly#wrap_tools), so without recording HERE the call is missing from the Studio's trace — same shape as LoadSkill.
31 32 33 34 35 36 37 38 |
# File 'lib/insika/tools/load_knowledge.rb', line 31 def initialize(store, agent_id, tenant: nil, trace_recorder: nil, state: nil) @store = store @agent_id = agent_id @tenant = tenant @trace_recorder = trace_recorder @state = state super() end |
Instance Method Details
#execute(name:) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/insika/tools/load_knowledge.rb', line 40 def execute(name:) started = Process.clock_gettime(Process::CLOCK_MONOTONIC) result = load(name) trace(name, result, started) result end |
#name ⇒ Object
RubyLLM::Tool#name derives from self.class.name — for a nested class it produces "insika--tools--load_knowledge", not "load_knowledge" (which wire_callbacks/:knowledge_retrieved assume). Explicit override, same reason LoadSkill has one.
25 |
# File 'lib/insika/tools/load_knowledge.rb', line 25 def name = "load_knowledge" |