Class: LlmGateway::Tool
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(*args) ⇒ Tool
Returns a new instance of Tool.
5
6
7
|
# File 'lib/llm_gateway/tool.rb', line 5
def initialize(*args)
end
|
Class Method Details
.cache(value = nil) ⇒ Object
24
25
26
27
|
# File 'lib/llm_gateway/tool.rb', line 24
def self.cache(value = nil)
@cache = value if value
@cache
end
|
.definition ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/llm_gateway/tool.rb', line 29
def self.definition
{
name: @name,
description: @description,
input_schema: @input_schema,
cache_control: @cache ? { type: "ephemeral" } : nil
}.compact
end
|
.description(value = nil) ⇒ Object
14
15
16
17
|
# File 'lib/llm_gateway/tool.rb', line 14
def self.description(value = nil)
@description = value if value
@description
end
|
19
20
21
22
|
# File 'lib/llm_gateway/tool.rb', line 19
def self.input_schema(value = nil)
@input_schema = value if value
@input_schema
end
|
.name(value = nil) ⇒ Object
9
10
11
12
|
# File 'lib/llm_gateway/tool.rb', line 9
def self.name(value = nil)
@name = value if value
@name
end
|
38
39
40
|
# File 'lib/llm_gateway/tool.rb', line 38
def self.tool_name
definition[:name]
end
|
Instance Method Details
#execute(input) ⇒ Object
42
43
44
|
# File 'lib/llm_gateway/tool.rb', line 42
def execute(input)
raise NotImplementedError, "Subclasses must implement execute"
end
|