Module: AgentClientProtocol::Schema::ContentBlock

Defined in:
lib/agent_client_protocol/schema/types.rb

Constant Summary collapse

TEXT =
"text".freeze
IMAGE =
"image".freeze
AUDIO =
"audio".freeze
"resource_link".freeze
RESOURCE =
"resource".freeze

Class Method Summary collapse

Class Method Details

.parse(hash) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/agent_client_protocol/schema/types.rb', line 68

def self.parse(hash)
  return nil if hash.nil?
  disc = hash["type"]
  case disc
  when "text"
    obj = TextContent.from_hash(hash)
    obj
  when "image"
    obj = ImageContent.from_hash(hash)
    obj
  when "audio"
    obj = AudioContent.from_hash(hash)
    obj
  when "resource_link"
    obj = ResourceLink.from_hash(hash)
    obj
  when "resource"
    obj = EmbeddedResource.from_hash(hash)
    obj
  else
    hash
  end
end