Class: OpenAISwarm::Memories::Field
- Inherits:
-
Object
- Object
- OpenAISwarm::Memories::Field
- Defined in:
- lib/ruby-openai-swarm/memories/field.rb
Constant Summary collapse
- VALID_MEMORY_FIELDS =
[:field, :tool_call_description].freeze
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
-
#tool_call_description ⇒ Object
Returns the value of attribute tool_call_description.
Instance Method Summary collapse
-
#initialize(memory_field) ⇒ Field
constructor
A new instance of Field.
- #parse_hash(memory_field) ⇒ Object
- #parse_string(memory_field) ⇒ Object
Constructor Details
#initialize(memory_field) ⇒ Field
Returns a new instance of Field.
9 10 11 |
# File 'lib/ruby-openai-swarm/memories/field.rb', line 9 def initialize(memory_field) memory_field.is_a?(Hash) ? parse_hash(memory_field) : parse_string(memory_field) end |
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
4 5 6 |
# File 'lib/ruby-openai-swarm/memories/field.rb', line 4 def field @field end |
#tool_call_description ⇒ Object
Returns the value of attribute tool_call_description.
4 5 6 |
# File 'lib/ruby-openai-swarm/memories/field.rb', line 4 def tool_call_description @tool_call_description end |
Instance Method Details
#parse_hash(memory_field) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/ruby-openai-swarm/memories/field.rb', line 13 def parse_hash(memory_field) validate_memory_field!(memory_field) @field = memory_field[:field] @tool_call_description = memory_field[:tool_call_description] end |
#parse_string(memory_field) ⇒ Object
20 21 22 |
# File 'lib/ruby-openai-swarm/memories/field.rb', line 20 def parse_string(memory_field) @field = memory_field end |