Class: Rubino::Tools::CustomToolBuilder
- Inherits:
-
Object
- Object
- Rubino::Tools::CustomToolBuilder
- Defined in:
- lib/rubino/tools/custom_tool_loader.rb
Overview
DSL builder for custom tools
Instance Attribute Summary collapse
-
#_description ⇒ Object
readonly
Returns the value of attribute _description.
-
#_execute_block ⇒ Object
readonly
Returns the value of attribute _execute_block.
-
#_input_schema ⇒ Object
readonly
Returns the value of attribute _input_schema.
-
#_name ⇒ Object
readonly
Returns the value of attribute _name.
-
#_risk_level ⇒ Object
readonly
Returns the value of attribute _risk_level.
Instance Method Summary collapse
-
#build ⇒ Object
Builds a Tool instance from the DSL.
- #description(val) ⇒ Object
- #execute(&block) ⇒ Object
-
#initialize ⇒ CustomToolBuilder
constructor
A new instance of CustomToolBuilder.
- #input_schema(val) ⇒ Object
- #name(val) ⇒ Object
- #risk_level(val) ⇒ Object
Constructor Details
#initialize ⇒ CustomToolBuilder
Returns a new instance of CustomToolBuilder.
70 71 72 73 |
# File 'lib/rubino/tools/custom_tool_loader.rb', line 70 def initialize @_risk_level = :low @_input_schema = { type: "object", properties: {} } end |
Instance Attribute Details
#_description ⇒ Object (readonly)
Returns the value of attribute _description.
68 69 70 |
# File 'lib/rubino/tools/custom_tool_loader.rb', line 68 def _description @_description end |
#_execute_block ⇒ Object (readonly)
Returns the value of attribute _execute_block.
68 69 70 |
# File 'lib/rubino/tools/custom_tool_loader.rb', line 68 def _execute_block @_execute_block end |
#_input_schema ⇒ Object (readonly)
Returns the value of attribute _input_schema.
68 69 70 |
# File 'lib/rubino/tools/custom_tool_loader.rb', line 68 def _input_schema @_input_schema end |
#_name ⇒ Object (readonly)
Returns the value of attribute _name.
68 69 70 |
# File 'lib/rubino/tools/custom_tool_loader.rb', line 68 def _name @_name end |
#_risk_level ⇒ Object (readonly)
Returns the value of attribute _risk_level.
68 69 70 |
# File 'lib/rubino/tools/custom_tool_loader.rb', line 68 def _risk_level @_risk_level end |
Instance Method Details
#build ⇒ Object
Builds a Tool instance from the DSL
96 97 98 99 100 101 102 103 104 105 |
# File 'lib/rubino/tools/custom_tool_loader.rb', line 96 def build builder = self Class.new(Base) do define_method(:name) { builder._name } define_method(:description) { builder._description } define_method(:input_schema) { builder._input_schema } define_method(:risk_level) { builder._risk_level } define_method(:call) { |args| builder._execute_block.call(args) } end.new end |
#description(val) ⇒ Object
79 80 81 |
# File 'lib/rubino/tools/custom_tool_loader.rb', line 79 def description(val) @_description = val end |
#execute(&block) ⇒ Object
91 92 93 |
# File 'lib/rubino/tools/custom_tool_loader.rb', line 91 def execute(&block) @_execute_block = block end |
#input_schema(val) ⇒ Object
83 84 85 |
# File 'lib/rubino/tools/custom_tool_loader.rb', line 83 def input_schema(val) @_input_schema = val end |
#name(val) ⇒ Object
75 76 77 |
# File 'lib/rubino/tools/custom_tool_loader.rb', line 75 def name(val) @_name = val end |
#risk_level(val) ⇒ Object
87 88 89 |
# File 'lib/rubino/tools/custom_tool_loader.rb', line 87 def risk_level(val) @_risk_level = val end |