Class: Kodo::Tools::ForgetFact

Inherits:
RubyLLM::Tool
  • Object
show all
Extended by:
PromptContributor
Defined in:
lib/kodo/tools/forget_fact.rb

Instance Method Summary collapse

Methods included from PromptContributor

capability_name, capability_primary, disabled_guidance, enabled_guidance

Constructor Details

#initialize(knowledge:, audit:) ⇒ ForgetFact

Returns a new instance of ForgetFact.



17
18
19
20
21
# File 'lib/kodo/tools/forget_fact.rb', line 17

def initialize(knowledge:, audit:)
  super()
  @knowledge = knowledge
  @audit = audit
end

Instance Method Details

#execute(id:) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/kodo/tools/forget_fact.rb', line 23

def execute(id:)
  fact = @knowledge.forget(id)

  if fact
    @audit.log(
      event: "knowledge_forgotten",
      detail: "id:#{id} content:#{fact['content']&.slice(0, 80)}"
    )
    "Forgot fact: #{fact['content']}"
  else
    "No active fact found with id: #{id}"
  end
end

#name ⇒ Object



37
38
39
# File 'lib/kodo/tools/forget_fact.rb', line 37

def name
  "forget"
end