Class: Kward::Tools::Base
- Inherits:
-
Object
- Object
- Kward::Tools::Base
- Defined in:
- lib/kward/tools/base.rb
Overview
Base class for model-callable tools and their JSON schemas.
Direct Known Subclasses
AskUserQuestion, CodeSearch, EditFile, ListDirectory, ReadFile, ReadSkill, RunShellCommand, WebSearch, WriteFile
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
Function name exposed to the model.
Instance Method Summary collapse
-
#initialize(name, description, properties: {}, required: []) ⇒ Base
constructor
Creates a tool schema definition shared by all concrete tool wrappers.
-
#schema ⇒ Object
Returns the strict JSON schema advertised to model providers.
Constructor Details
#initialize(name, description, properties: {}, required: []) ⇒ Base
Creates a tool schema definition shared by all concrete tool wrappers.
11 12 13 14 15 16 |
# File 'lib/kward/tools/base.rb', line 11 def initialize(name, description, properties: {}, required: []) @name = name @description = description @properties = properties @required = required end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns function name exposed to the model.
8 9 10 |
# File 'lib/kward/tools/base.rb', line 8 def name @name end |
Instance Method Details
#schema ⇒ Object
Returns the strict JSON schema advertised to model providers.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/kward/tools/base.rb', line 19 def schema { type: "function", function: { name: @name, description: @description, parameters: { type: "object", properties: @properties, required: @required, additionalProperties: false } } } end |