Class: A2A::AgentSkill
- Inherits:
-
Object
- Object
- A2A::AgentSkill
- Defined in:
- lib/a2a/agent_skill.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#examples ⇒ Object
readonly
Returns the value of attribute examples.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#input_modes ⇒ Object
readonly
Returns the value of attribute input_modes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#output_modes ⇒ Object
readonly
Returns the value of attribute output_modes.
-
#security_requirements ⇒ Object
readonly
Returns the value of attribute security_requirements.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:, description:, tags:, **kwargs) ⇒ AgentSkill
constructor
A new instance of AgentSkill.
- #to_h ⇒ Object
Constructor Details
#initialize(id:, name:, description:, tags:, **kwargs) ⇒ AgentSkill
Returns a new instance of AgentSkill.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/a2a/agent_skill.rb', line 7 def initialize(id:, name:, description:, tags:, **kwargs) raise ArgumentError, "tags must contain at least one element" if Array().empty? @id = id @name = name @description = description @tags = @examples = kwargs[:examples] @input_modes = kwargs[:input_modes] @output_modes = kwargs[:output_modes] @security_requirements = kwargs[:security_requirements] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/a2a/agent_skill.rb', line 5 def description @description end |
#examples ⇒ Object (readonly)
Returns the value of attribute examples.
5 6 7 |
# File 'lib/a2a/agent_skill.rb', line 5 def examples @examples end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/a2a/agent_skill.rb', line 5 def id @id end |
#input_modes ⇒ Object (readonly)
Returns the value of attribute input_modes.
5 6 7 |
# File 'lib/a2a/agent_skill.rb', line 5 def input_modes @input_modes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/a2a/agent_skill.rb', line 5 def name @name end |
#output_modes ⇒ Object (readonly)
Returns the value of attribute output_modes.
5 6 7 |
# File 'lib/a2a/agent_skill.rb', line 5 def output_modes @output_modes end |
#security_requirements ⇒ Object (readonly)
Returns the value of attribute security_requirements.
5 6 7 |
# File 'lib/a2a/agent_skill.rb', line 5 def security_requirements @security_requirements end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
5 6 7 |
# File 'lib/a2a/agent_skill.rb', line 5 def @tags end |
Class Method Details
.from_h(hash) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/a2a/agent_skill.rb', line 20 def self.from_h(hash) new( id: hash.fetch("id"), name: hash.fetch("name"), description: hash.fetch("description"), tags: hash.fetch("tags"), examples: hash["examples"], input_modes: hash["inputModes"], output_modes: hash["outputModes"], security_requirements: hash["securityRequirements"]&.map { SecurityRequirement.from_h(_1) } ) end |
Instance Method Details
#to_h ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/a2a/agent_skill.rb', line 33 def to_h { "id" => id, "name" => name, "description" => description, "tags" => , "examples" => examples, "inputModes" => input_modes, "outputModes" => output_modes, "securityRequirements" => security_requirements&.map(&:to_h) }.compact end |