Class: LittleGhost::StructuredOutput::ToolStrategy
- Inherits:
-
Strategy
- Object
- Strategy
- LittleGhost::StructuredOutput::ToolStrategy
show all
- Defined in:
- lib/little_ghost/structured_output.rb
Instance Attribute Summary
Attributes inherited from Strategy
#configuration
Instance Method Summary
collapse
Methods inherited from Strategy
#initialize, #output_schema, #provider?, #schema_name
Instance Method Details
#required_capabilities ⇒ Object
40
|
# File 'lib/little_ghost/structured_output.rb', line 40
def required_capabilities = %i[tools tool_choice].freeze
|
42
43
44
45
46
47
48
49
50
|
# File 'lib/little_ghost/structured_output.rb', line 42
def result_tool
{
name: schema_name,
description: configuration[:description] ||
"Submit the final structured result. Call this tool only as the final action.",
input_schema: configuration.fetch(:schema),
strict: true
}.freeze
end
|
30
|
# File 'lib/little_ghost/structured_output.rb', line 30
def tool? = true
|
36
37
38
|
# File 'lib/little_ghost/structured_output.rb', line 36
def tool_choice(repair:)
repair ? {name: schema_name}.freeze : :required
end
|
32
33
34
|
# File 'lib/little_ghost/structured_output.rb', line 32
def tools(ordinary_tools)
[*ordinary_tools, result_tool].freeze
end
|