Class: Geminize::Models::ToolConfig
- Inherits:
-
Object
- Object
- Geminize::Models::ToolConfig
- Defined in:
- lib/geminize/models/tool_config.rb
Overview
Represents configuration for tool execution in Gemini API
Constant Summary collapse
- EXECUTION_MODES =
Valid execution modes for tools
["AUTO", "MANUAL", "NONE"].freeze
Instance Attribute Summary collapse
-
#execution_mode ⇒ String
readonly
The execution mode for tools.
Instance Method Summary collapse
-
#initialize(execution_mode = "AUTO") ⇒ ToolConfig
constructor
Initialize a new tool configuration.
-
#to_h ⇒ Hash
Alias for to_hash.
-
#to_hash ⇒ Hash
Convert the tool configuration to a hash for API requests.
-
#validate! ⇒ Boolean
Validate the tool configuration.
Constructor Details
#initialize(execution_mode = "AUTO") ⇒ ToolConfig
Initialize a new tool configuration
16 17 18 19 |
# File 'lib/geminize/models/tool_config.rb', line 16 def initialize(execution_mode = "AUTO") @execution_mode = execution_mode validate! end |
Instance Attribute Details
#execution_mode ⇒ String (readonly)
Returns The execution mode for tools.
11 12 13 |
# File 'lib/geminize/models/tool_config.rb', line 11 def execution_mode @execution_mode end |
Instance Method Details
#to_h ⇒ Hash
Alias for to_hash
47 48 49 |
# File 'lib/geminize/models/tool_config.rb', line 47 def to_h to_hash end |
#to_hash ⇒ Hash
Convert the tool configuration to a hash for API requests
37 38 39 40 41 42 43 |
# File 'lib/geminize/models/tool_config.rb', line 37 def to_hash { function_calling_config: { mode: @execution_mode } } end |
#validate! ⇒ Boolean
Validate the tool configuration
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/geminize/models/tool_config.rb', line 24 def validate! unless EXECUTION_MODES.include?(@execution_mode) raise Geminize::ValidationError.new( "Invalid execution mode: #{@execution_mode}. Must be one of: #{EXECUTION_MODES.join(", ")}", "INVALID_ARGUMENT" ) end true end |