Class: OpenAISwarm::Memories::CoreMemoryFunction

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-openai-swarm/memories/core_memory_function.rb

Class Method Summary collapse

Class Method Details

.definition(memory_fields = []) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ruby-openai-swarm/memories/core_memory_function.rb', line 4

def self.definition(memory_fields = [])
  properties = {}

  memory_fields.each do |memory_field|
    field = memory_field.field
    description = "The #{field} to remember." + memory_field&.tool_call_description.to_s
    properties[field] = { type: "string", description: description }
  end

  {
    type: "function",
    function: {
      name: "core_memory_save",
      description: "Save important information about you, the agent or the human you are chatting with.",
      parameters: {
        type: "object",
        properties: properties,
      }
    }
  }
end