Class: OCI::GenerativeAiAgent::Models::SqlToolConfig

Inherits:
ToolConfig
  • Object
show all
Defined in:
lib/oci/generative_ai_agent/models/sql_tool_config.rb

Overview

The configuration for SQL Tool.

Constant Summary collapse

DIALECT_ENUM =
[
  DIALECT_SQL_LITE = 'SQL_LITE'.freeze,
  DIALECT_ORACLE_SQL = 'ORACLE_SQL'.freeze,
  DIALECT_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
MODEL_SIZE_ENUM =
[
  MODEL_SIZE_SMALL = 'SMALL'.freeze,
  MODEL_SIZE_LARGE = 'LARGE'.freeze,
  MODEL_SIZE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from ToolConfig

ToolConfig::TOOL_CONFIG_TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from ToolConfig

#tool_config_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ToolConfig

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ SqlToolConfig

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 115

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['toolConfigType'] = 'SQL_TOOL_CONFIG'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.icl_examples = attributes[:'iclExamples'] if attributes[:'iclExamples']

  raise 'You cannot provide both :iclExamples and :icl_examples' if attributes.key?(:'iclExamples') && attributes.key?(:'icl_examples')

  self.icl_examples = attributes[:'icl_examples'] if attributes[:'icl_examples']

  self.database_schema = attributes[:'databaseSchema'] if attributes[:'databaseSchema']

  raise 'You cannot provide both :databaseSchema and :database_schema' if attributes.key?(:'databaseSchema') && attributes.key?(:'database_schema')

  self.database_schema = attributes[:'database_schema'] if attributes[:'database_schema']

  self.should_enable_sql_execution = attributes[:'shouldEnableSqlExecution'] unless attributes[:'shouldEnableSqlExecution'].nil?
  self.should_enable_sql_execution = false if should_enable_sql_execution.nil? && !attributes.key?(:'shouldEnableSqlExecution') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :shouldEnableSqlExecution and :should_enable_sql_execution' if attributes.key?(:'shouldEnableSqlExecution') && attributes.key?(:'should_enable_sql_execution')

  self.should_enable_sql_execution = attributes[:'should_enable_sql_execution'] unless attributes[:'should_enable_sql_execution'].nil?
  self.should_enable_sql_execution = false if should_enable_sql_execution.nil? && !attributes.key?(:'shouldEnableSqlExecution') && !attributes.key?(:'should_enable_sql_execution') # rubocop:disable Style/StringLiterals

  self.dialect = attributes[:'dialect'] if attributes[:'dialect']

  self.model_size = attributes[:'modelSize'] if attributes[:'modelSize']
  self.model_size = "SMALL" if model_size.nil? && !attributes.key?(:'modelSize') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :modelSize and :model_size' if attributes.key?(:'modelSize') && attributes.key?(:'model_size')

  self.model_size = attributes[:'model_size'] if attributes[:'model_size']
  self.model_size = "SMALL" if model_size.nil? && !attributes.key?(:'modelSize') && !attributes.key?(:'model_size') # rubocop:disable Style/StringLiterals

  self.should_enable_self_correction = attributes[:'shouldEnableSelfCorrection'] unless attributes[:'shouldEnableSelfCorrection'].nil?
  self.should_enable_self_correction = false if should_enable_self_correction.nil? && !attributes.key?(:'shouldEnableSelfCorrection') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :shouldEnableSelfCorrection and :should_enable_self_correction' if attributes.key?(:'shouldEnableSelfCorrection') && attributes.key?(:'should_enable_self_correction')

  self.should_enable_self_correction = attributes[:'should_enable_self_correction'] unless attributes[:'should_enable_self_correction'].nil?
  self.should_enable_self_correction = false if should_enable_self_correction.nil? && !attributes.key?(:'shouldEnableSelfCorrection') && !attributes.key?(:'should_enable_self_correction') # rubocop:disable Style/StringLiterals

  self.table_and_column_description = attributes[:'tableAndColumnDescription'] if attributes[:'tableAndColumnDescription']

  raise 'You cannot provide both :tableAndColumnDescription and :table_and_column_description' if attributes.key?(:'tableAndColumnDescription') && attributes.key?(:'table_and_column_description')

  self.table_and_column_description = attributes[:'table_and_column_description'] if attributes[:'table_and_column_description']

  self.generation_llm_customization = attributes[:'generationLlmCustomization'] if attributes[:'generationLlmCustomization']

  raise 'You cannot provide both :generationLlmCustomization and :generation_llm_customization' if attributes.key?(:'generationLlmCustomization') && attributes.key?(:'generation_llm_customization')

  self.generation_llm_customization = attributes[:'generation_llm_customization'] if attributes[:'generation_llm_customization']

  self.database_connection = attributes[:'databaseConnection'] if attributes[:'databaseConnection']

  raise 'You cannot provide both :databaseConnection and :database_connection' if attributes.key?(:'databaseConnection') && attributes.key?(:'database_connection')

  self.database_connection = attributes[:'database_connection'] if attributes[:'database_connection']

  self.runtime_version = attributes[:'runtimeVersion'] if attributes[:'runtimeVersion']

  raise 'You cannot provide both :runtimeVersion and :runtime_version' if attributes.key?(:'runtimeVersion') && attributes.key?(:'runtime_version')

  self.runtime_version = attributes[:'runtime_version'] if attributes[:'runtime_version']
end

Instance Attribute Details

#database_connectionOCI::GenerativeAiAgent::Models::DatabaseConnection



55
56
57
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 55

def database_connection
  @database_connection
end

#database_schemaOCI::GenerativeAiAgent::Models::InputLocation



30
31
32
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 30

def database_schema
  @database_schema
end

#dialectString

[Required] Dialect to be used for SQL generation.

Returns:

  • (String)


38
39
40
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 38

def dialect
  @dialect
end

#generation_llm_customizationOCI::GenerativeAiAgent::Models::LlmCustomization



52
53
54
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 52

def generation_llm_customization
  @generation_llm_customization
end

#icl_examplesOCI::GenerativeAiAgent::Models::InputLocation



27
28
29
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 27

def icl_examples
  @icl_examples
end

#model_sizeString

Size of the model.

Returns:

  • (String)


42
43
44
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 42

def model_size
  @model_size
end

#runtime_versionString

The runtimeVersion of the system prompt.

Returns:

  • (String)


59
60
61
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 59

def runtime_version
  @runtime_version
end

#should_enable_self_correctionBOOLEAN

To enable/disable self correction.

Returns:

  • (BOOLEAN)


46
47
48
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 46

def should_enable_self_correction
  @should_enable_self_correction
end

#should_enable_sql_executionBOOLEAN

To enable/disable SQL execution.

Returns:

  • (BOOLEAN)


34
35
36
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 34

def should_enable_sql_execution
  @should_enable_sql_execution
end

#table_and_column_descriptionOCI::GenerativeAiAgent::Models::InputLocation



49
50
51
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 49

def table_and_column_description
  @table_and_column_description
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 62

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'tool_config_type': :'toolConfigType',
    'icl_examples': :'iclExamples',
    'database_schema': :'databaseSchema',
    'should_enable_sql_execution': :'shouldEnableSqlExecution',
    'dialect': :'dialect',
    'model_size': :'modelSize',
    'should_enable_self_correction': :'shouldEnableSelfCorrection',
    'table_and_column_description': :'tableAndColumnDescription',
    'generation_llm_customization': :'generationLlmCustomization',
    'database_connection': :'databaseConnection',
    'runtime_version': :'runtimeVersion'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 81

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'tool_config_type': :'String',
    'icl_examples': :'OCI::GenerativeAiAgent::Models::InputLocation',
    'database_schema': :'OCI::GenerativeAiAgent::Models::InputLocation',
    'should_enable_sql_execution': :'BOOLEAN',
    'dialect': :'String',
    'model_size': :'String',
    'should_enable_self_correction': :'BOOLEAN',
    'table_and_column_description': :'OCI::GenerativeAiAgent::Models::InputLocation',
    'generation_llm_customization': :'OCI::GenerativeAiAgent::Models::LlmCustomization',
    'database_connection': :'OCI::GenerativeAiAgent::Models::DatabaseConnection',
    'runtime_version': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 221

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    tool_config_type == other.tool_config_type &&
    icl_examples == other.icl_examples &&
    database_schema == other.database_schema &&
    should_enable_sql_execution == other.should_enable_sql_execution &&
    dialect == other.dialect &&
    model_size == other.model_size &&
    should_enable_self_correction == other.should_enable_self_correction &&
    table_and_column_description == other.table_and_column_description &&
    generation_llm_customization == other.generation_llm_customization &&
    database_connection == other.database_connection &&
    runtime_version == other.runtime_version
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 261

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


241
242
243
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 241

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



250
251
252
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 250

def hash
  [tool_config_type, icl_examples, database_schema, should_enable_sql_execution, dialect, model_size, should_enable_self_correction, table_and_column_description, generation_llm_customization, database_connection, runtime_version].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



294
295
296
297
298
299
300
301
302
303
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 294

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



288
289
290
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 288

def to_s
  to_hash.to_s
end