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):



109
110
111
112
113
114
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
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 109

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']
end

Instance Attribute Details

#database_connectionOCI::GenerativeAiAgent::Models::DatabaseConnection



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

def database_connection
  @database_connection
end

#database_schemaOCI::GenerativeAiAgent::Models::InputLocation

This attribute is required.



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

def database_schema
  @database_schema
end

#dialectString

[Required] Dialect to be used for SQL generation.

Returns:

  • (String)


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

def dialect
  @dialect
end

#generation_llm_customizationOCI::GenerativeAiAgent::Models::LlmCustomization



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

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)


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

def model_size
  @model_size
end

#should_enable_self_correctionBOOLEAN

To enable/disable self correction.

Returns:

  • (BOOLEAN)


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

def should_enable_self_correction
  @should_enable_self_correction
end

#should_enable_sql_executionBOOLEAN

To enable/disable SQL execution.

Returns:

  • (BOOLEAN)


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

def should_enable_sql_execution
  @should_enable_sql_execution
end

#table_and_column_descriptionOCI::GenerativeAiAgent::Models::InputLocation



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

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.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 59

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'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 77

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'
    # 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



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 209

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
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



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 248

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


228
229
230
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 228

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



237
238
239
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 237

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].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



281
282
283
284
285
286
287
288
289
290
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 281

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



275
276
277
# File 'lib/oci/generative_ai_agent/models/sql_tool_config.rb', line 275

def to_s
  to_hash.to_s
end