Class: SimpleAcp::Models::MessageAwaitRequest

Inherits:
AwaitRequest show all
Defined in:
lib/simple_acp/models/await.rb

Overview

Request for a message from the client.

Used when an agent needs text or other message input to continue.

Instance Attribute Summary collapse

Attributes inherited from AwaitRequest

#type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, attribute, attributes, #hash, own_attributes, #to_h, #to_json

Constructor Details

#initialize(**kwargs) ⇒ MessageAwaitRequest

Returns a new instance of MessageAwaitRequest.



42
43
44
45
# File 'lib/simple_acp/models/await.rb', line 42

def initialize(**kwargs)
  kwargs[:type] = "message"
  super
end

Instance Attribute Details

#message ⇒ Message? (readonly)

Returns prompt message to display to client.

Returns:

  • (Message, nil) —

    prompt message to display to client



40
# File 'lib/simple_acp/models/await.rb', line 40

attribute :message

Class Method Details

.from_hash(hash) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/simple_acp/models/await.rb', line 47

def self.from_hash(hash)
  return nil if hash.nil?

  instance = allocate
  instance.instance_variable_set(:@type, "message")

  if hash["message"] || hash[:message]
    instance.instance_variable_set(
      :@message,
      Message.from_hash(hash["message"] || hash[:message])
    )
  end

  instance
end