algolia 3.40.0 → 3.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/Bug_report.yml +1 -0
  3. data/CHANGELOG.md +5 -0
  4. data/Gemfile.lock +4 -4
  5. data/lib/algolia/api/agent_studio_client.rb +2364 -0
  6. data/lib/algolia/models/agent-studio/advanced_syntax_features.rb +34 -0
  7. data/lib/algolia/models/agent-studio/agent_completion_algolia_params.rb +221 -0
  8. data/lib/algolia/models/agent-studio/agent_completion_request.rb +247 -0
  9. data/lib/algolia/models/agent-studio/agent_config_create.rb +288 -0
  10. data/lib/algolia/models/agent-studio/agent_config_update.rb +294 -0
  11. data/lib/algolia/models/agent-studio/agent_status.rb +34 -0
  12. data/lib/algolia/models/agent-studio/agent_test_configuration.rb +271 -0
  13. data/lib/algolia/models/agent-studio/agent_with_version_response.rb +370 -0
  14. data/lib/algolia/models/agent-studio/algolia_display_results_tool_config.rb +254 -0
  15. data/lib/algolia/models/agent-studio/algolia_recommend_tool_config_input.rb +242 -0
  16. data/lib/algolia/models/agent-studio/algolia_recommend_tool_index_config.rb +228 -0
  17. data/lib/algolia/models/agent-studio/algolia_search_tool_config.rb +232 -0
  18. data/lib/algolia/models/agent-studio/algolia_search_tool_index_config.rb +249 -0
  19. data/lib/algolia/models/agent-studio/allowed_domain_bulk_delete.rb +212 -0
  20. data/lib/algolia/models/agent-studio/allowed_domain_bulk_insert.rb +212 -0
  21. data/lib/algolia/models/agent-studio/allowed_domain_create.rb +210 -0
  22. data/lib/algolia/models/agent-studio/allowed_domain_list_response.rb +211 -0
  23. data/lib/algolia/models/agent-studio/allowed_domain_response.rb +264 -0
  24. data/lib/algolia/models/agent-studio/alternatives_as_exact.rb +36 -0
  25. data/lib/algolia/models/agent-studio/anthropic_provider_input.rb +220 -0
  26. data/lib/algolia/models/agent-studio/application_config_patch.rb +209 -0
  27. data/lib/algolia/models/agent-studio/application_config_response.rb +208 -0
  28. data/lib/algolia/models/agent-studio/around_precision_union.rb +108 -0
  29. data/lib/algolia/models/agent-studio/around_radius_union.rb +108 -0
  30. data/lib/algolia/models/agent-studio/assistant_message_v4.rb +252 -0
  31. data/lib/algolia/models/agent-studio/assistant_message_v5.rb +228 -0
  32. data/lib/algolia/models/agent-studio/assistant_part_v4.rb +110 -0
  33. data/lib/algolia/models/agent-studio/assistant_part_v5.rb +110 -0
  34. data/lib/algolia/models/agent-studio/azure_open_ai_provider_input.rb +243 -0
  35. data/lib/algolia/models/agent-studio/base_provider_input.rb +209 -0
  36. data/lib/algolia/models/agent-studio/client_side_tool_config.rb +241 -0
  37. data/lib/algolia/models/agent-studio/client_tools_args_schema.rb +228 -0
  38. data/lib/algolia/models/agent-studio/compatibility_mode.rb +34 -0
  39. data/lib/algolia/models/agent-studio/conversation_base_response.rb +355 -0
  40. data/lib/algolia/models/agent-studio/conversation_full_response.rb +369 -0
  41. data/lib/algolia/models/agent-studio/conversation_metadata.rb +209 -0
  42. data/lib/algolia/models/agent-studio/distinct_union.rb +108 -0
  43. data/lib/algolia/models/agent-studio/episode.rb +243 -0
  44. data/lib/algolia/models/agent-studio/error_base.rb +207 -0
  45. data/lib/algolia/models/agent-studio/exact_on_single_word_query.rb +35 -0
  46. data/lib/algolia/models/agent-studio/facet_filters_union.rb +108 -0
  47. data/lib/algolia/models/agent-studio/facets.rb +208 -0
  48. data/lib/algolia/models/agent-studio/facets_param.rb +220 -0
  49. data/lib/algolia/models/agent-studio/facets_union.rb +108 -0
  50. data/lib/algolia/models/agent-studio/feedback_creation_request.rb +251 -0
  51. data/lib/algolia/models/agent-studio/feedback_response.rb +297 -0
  52. data/lib/algolia/models/agent-studio/ignore_plurals_union.rb +108 -0
  53. data/lib/algolia/models/agent-studio/index_search_parameters.rb +267 -0
  54. data/lib/algolia/models/agent-studio/inside_bounding_box_union.rb +108 -0
  55. data/lib/algolia/models/agent-studio/inside_polygon_union.rb +108 -0
  56. data/lib/algolia/models/agent-studio/location_item_union.rb +108 -0
  57. data/lib/algolia/models/agent-studio/mcp_server_tool_config.rb +276 -0
  58. data/lib/algolia/models/agent-studio/mcp_tool_config.rb +218 -0
  59. data/lib/algolia/models/agent-studio/memory_record.rb +368 -0
  60. data/lib/algolia/models/agent-studio/memory_type.rb +34 -0
  61. data/lib/algolia/models/agent-studio/message_part.rb +132 -0
  62. data/lib/algolia/models/agent-studio/message_response.rb +309 -0
  63. data/lib/algolia/models/agent-studio/message_role.rb +34 -0
  64. data/lib/algolia/models/agent-studio/message_v4.rb +117 -0
  65. data/lib/algolia/models/agent-studio/message_v5.rb +117 -0
  66. data/lib/algolia/models/agent-studio/messages_union.rb +108 -0
  67. data/lib/algolia/models/agent-studio/number_param.rb +230 -0
  68. data/lib/algolia/models/agent-studio/number_param_constraint.rb +219 -0
  69. data/lib/algolia/models/agent-studio/numeric_filters_union.rb +108 -0
  70. data/lib/algolia/models/agent-studio/open_ai_compatible_provider_input.rb +232 -0
  71. data/lib/algolia/models/agent-studio/open_ai_provider_input.rb +220 -0
  72. data/lib/algolia/models/agent-studio/optional_filters_union.rb +108 -0
  73. data/lib/algolia/models/agent-studio/optional_words_union.rb +108 -0
  74. data/lib/algolia/models/agent-studio/paginated_agents_response.rb +221 -0
  75. data/lib/algolia/models/agent-studio/paginated_conversations_response.rb +221 -0
  76. data/lib/algolia/models/agent-studio/paginated_provider_authentications_response.rb +221 -0
  77. data/lib/algolia/models/agent-studio/paginated_secret_keys_response.rb +221 -0
  78. data/lib/algolia/models/agent-studio/pagination_metadata.rb +241 -0
  79. data/lib/algolia/models/agent-studio/provider_authentication_create.rb +230 -0
  80. data/lib/algolia/models/agent-studio/provider_authentication_patch.rb +218 -0
  81. data/lib/algolia/models/agent-studio/provider_authentication_response.rb +274 -0
  82. data/lib/algolia/models/agent-studio/provider_input.rb +111 -0
  83. data/lib/algolia/models/agent-studio/provider_input_nullable.rb +111 -0
  84. data/lib/algolia/models/agent-studio/provider_name.rb +38 -0
  85. data/lib/algolia/models/agent-studio/query_type.rb +35 -0
  86. data/lib/algolia/models/agent-studio/re_ranking_apply_filter_union.rb +108 -0
  87. data/lib/algolia/models/agent-studio/reasoning_part.rb +219 -0
  88. data/lib/algolia/models/agent-studio/reasoning_part_v4.rb +217 -0
  89. data/lib/algolia/models/agent-studio/reasoning_part_v5.rb +217 -0
  90. data/lib/algolia/models/agent-studio/remove_stop_words_union.rb +108 -0
  91. data/lib/algolia/models/agent-studio/remove_words_if_no_results.rb +36 -0
  92. data/lib/algolia/models/agent-studio/search_parameters.rb +950 -0
  93. data/lib/algolia/models/agent-studio/search_parameters_overrides.rb +286 -0
  94. data/lib/algolia/models/agent-studio/secret_key_create.rb +222 -0
  95. data/lib/algolia/models/agent-studio/secret_key_patch.rb +223 -0
  96. data/lib/algolia/models/agent-studio/secret_key_response.rb +287 -0
  97. data/lib/algolia/models/agent-studio/start_part.rb +208 -0
  98. data/lib/algolia/models/agent-studio/start_step_part.rb +208 -0
  99. data/lib/algolia/models/agent-studio/step_start_part_v4.rb +206 -0
  100. data/lib/algolia/models/agent-studio/step_start_part_v5.rb +206 -0
  101. data/lib/algolia/models/agent-studio/string_array_param.rb +242 -0
  102. data/lib/algolia/models/agent-studio/string_array_param_constraint.rb +211 -0
  103. data/lib/algolia/models/agent-studio/supported_language.rb +169 -0
  104. data/lib/algolia/models/agent-studio/tag_filters_union.rb +108 -0
  105. data/lib/algolia/models/agent-studio/text_param.rb +220 -0
  106. data/lib/algolia/models/agent-studio/text_part.rb +216 -0
  107. data/lib/algolia/models/agent-studio/text_part_v4.rb +217 -0
  108. data/lib/algolia/models/agent-studio/text_part_v5.rb +217 -0
  109. data/lib/algolia/models/agent-studio/tool_approval_request_part.rb +285 -0
  110. data/lib/algolia/models/agent-studio/tool_call_part.rb +265 -0
  111. data/lib/algolia/models/agent-studio/tool_config.rb +108 -0
  112. data/lib/algolia/models/agent-studio/tool_config_input.rb +129 -0
  113. data/lib/algolia/models/agent-studio/tool_invocation_part_v4.rb +217 -0
  114. data/lib/algolia/models/agent-studio/tool_invocation_v4.rb +309 -0
  115. data/lib/algolia/models/agent-studio/tool_part_v5.rb +309 -0
  116. data/lib/algolia/models/agent-studio/tool_result_output.rb +221 -0
  117. data/lib/algolia/models/agent-studio/tool_result_output_type.rb +37 -0
  118. data/lib/algolia/models/agent-studio/tool_result_part.rb +254 -0
  119. data/lib/algolia/models/agent-studio/tool_state.rb +36 -0
  120. data/lib/algolia/models/agent-studio/typo_tolerance_enum.rb +36 -0
  121. data/lib/algolia/models/agent-studio/typo_tolerance_union.rb +108 -0
  122. data/lib/algolia/models/agent-studio/unknown_tool_config.rb +220 -0
  123. data/lib/algolia/models/agent-studio/user_data_response.rb +223 -0
  124. data/lib/algolia/models/agent-studio/user_message_metadata_v5.rb +209 -0
  125. data/lib/algolia/models/agent-studio/user_message_v4.rb +250 -0
  126. data/lib/algolia/models/agent-studio/user_message_v5.rb +237 -0
  127. data/lib/algolia/models/agent-studio/validation_error.rb +252 -0
  128. data/lib/algolia/models/agent-studio/vote_enum.rb +34 -0
  129. data/lib/algolia/version.rb +1 -1
  130. metadata +125 -1
@@ -0,0 +1,271 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
4
+
5
+ require "date"
6
+ require "time"
7
+
8
+ module Algolia
9
+ module AgentStudio
10
+ # Dynamic configuration for testing agents.
11
+ class AgentTestConfiguration
12
+ attr_accessor :id
13
+
14
+ attr_accessor :provider_id
15
+
16
+ attr_accessor :model
17
+
18
+ attr_accessor :instructions
19
+
20
+ attr_accessor :system_prompt
21
+
22
+ attr_accessor :config
23
+
24
+ attr_accessor :tools
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :id => :id,
30
+ :provider_id => :providerId,
31
+ :model => :model,
32
+ :instructions => :instructions,
33
+ :system_prompt => :systemPrompt,
34
+ :config => :config,
35
+ :tools => :tools
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.types_mapping
41
+ {
42
+ :id => :"String",
43
+ :provider_id => :"String",
44
+ :model => :"String",
45
+ :instructions => :"String",
46
+ :system_prompt => :"String",
47
+ :config => :"Hash<String, Object>",
48
+ :tools => :"Array<ToolConfigInput>"
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new(
55
+ []
56
+ )
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ raise(
64
+ ArgumentError,
65
+ "The input argument (attributes) must be a hash in `Algolia::AgentTestConfiguration` initialize method"
66
+ )
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ raise(
73
+ ArgumentError,
74
+ "`#{k}` is not a valid attribute in `Algolia::AgentTestConfiguration`. Please check the name to make sure it's valid. List of attributes: " +
75
+ self.class.attribute_map.keys.inspect
76
+ )
77
+ end
78
+
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:id)
83
+ self.id = attributes[:id]
84
+ end
85
+
86
+ if attributes.key?(:provider_id)
87
+ self.provider_id = attributes[:provider_id]
88
+ end
89
+
90
+ if attributes.key?(:model)
91
+ self.model = attributes[:model]
92
+ end
93
+
94
+ if attributes.key?(:instructions)
95
+ self.instructions = attributes[:instructions]
96
+ else
97
+ self.instructions = nil
98
+ end
99
+
100
+ if attributes.key?(:system_prompt)
101
+ self.system_prompt = attributes[:system_prompt]
102
+ end
103
+
104
+ if attributes.key?(:config)
105
+ if (value = attributes[:config]).is_a?(Hash)
106
+ self.config = value
107
+ end
108
+ else
109
+ self.config = nil
110
+ end
111
+
112
+ if attributes.key?(:tools)
113
+ if (value = attributes[:tools]).is_a?(Array)
114
+ self.tools = value
115
+ end
116
+ else
117
+ self.tools = nil
118
+ end
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
123
+ def ==(other)
124
+ return true if self.equal?(other)
125
+ self.class == other.class &&
126
+ id == other.id &&
127
+ provider_id == other.provider_id &&
128
+ model == other.model &&
129
+ instructions == other.instructions &&
130
+ system_prompt == other.system_prompt &&
131
+ config == other.config &&
132
+ tools == other.tools
133
+ end
134
+
135
+ # @see the `==` method
136
+ # @param [Object] Object to be compared
137
+ def eql?(other)
138
+ self == other
139
+ end
140
+
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Integer] Hash code
143
+ def hash
144
+ [id, provider_id, model, instructions, system_prompt, config, tools].hash
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def self.build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ attributes = attributes.transform_keys(&:to_sym)
153
+ transformed_hash = {}
154
+ types_mapping.each_pair do |key, type|
155
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
156
+ transformed_hash[key.to_sym] = nil
157
+ elsif type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[attribute_map[key]].is_a?(Array)
161
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
162
+ _deserialize(::Regexp.last_match(1), v)
163
+ }
164
+ end
165
+ elsif !attributes[attribute_map[key]].nil?
166
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
167
+ end
168
+ end
169
+
170
+ new(transformed_hash)
171
+ end
172
+
173
+ # Deserializes the data based on type
174
+ # @param string type Data type
175
+ # @param string value Value to be deserialized
176
+ # @return [Object] Deserialized data
177
+ def self._deserialize(type, value)
178
+ case type.to_sym
179
+ when :Time
180
+ Time.parse(value)
181
+ when :Date
182
+ Date.parse(value)
183
+ when :String
184
+ value.to_s
185
+ when :Integer
186
+ value.to_i
187
+ when :Float
188
+ value.to_f
189
+ when :Boolean
190
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
191
+ true
192
+ else
193
+ false
194
+ end
195
+
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ # model
211
+ else
212
+ # models (e.g. Pet) or oneOf
213
+ klass = Algolia::AgentStudio.const_get(type)
214
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
215
+ .build_from_hash(value)
216
+ end
217
+ end
218
+
219
+ # Returns the string representation of the object
220
+ # @return [String] String presentation of the object
221
+ def to_s
222
+ to_hash.to_s
223
+ end
224
+
225
+ # to_body is an alias to to_hash (backward compatibility)
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_body
228
+ to_hash
229
+ end
230
+
231
+ def to_json(*_args)
232
+ to_hash.to_json
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ self.class.attribute_map.each_pair do |attr, param|
240
+ value = send(attr)
241
+ if value.nil?
242
+ is_nullable = self.class.openapi_nullable.include?(attr)
243
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
+ end
245
+
246
+ hash[param] = _to_hash(value)
247
+ end
248
+
249
+ hash
250
+ end
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map { |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to?(:to_hash)
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+ end
270
+ end
271
+ end
@@ -0,0 +1,370 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
4
+
5
+ require "date"
6
+ require "time"
7
+
8
+ module Algolia
9
+ module AgentStudio
10
+ class AgentWithVersionResponse
11
+ attr_accessor :id
12
+
13
+ attr_accessor :name
14
+
15
+ attr_accessor :description
16
+
17
+ attr_accessor :status
18
+
19
+ attr_accessor :provider_id
20
+
21
+ attr_accessor :model
22
+
23
+ attr_accessor :instructions
24
+
25
+ attr_accessor :system_prompt
26
+
27
+ attr_accessor :config
28
+
29
+ attr_accessor :tools
30
+
31
+ attr_accessor :template_type
32
+
33
+ attr_accessor :created_at
34
+
35
+ attr_accessor :updated_at
36
+
37
+ attr_accessor :last_used_at
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :id => :id,
43
+ :name => :name,
44
+ :description => :description,
45
+ :status => :status,
46
+ :provider_id => :providerId,
47
+ :model => :model,
48
+ :instructions => :instructions,
49
+ :system_prompt => :systemPrompt,
50
+ :config => :config,
51
+ :tools => :tools,
52
+ :template_type => :templateType,
53
+ :created_at => :createdAt,
54
+ :updated_at => :updatedAt,
55
+ :last_used_at => :lastUsedAt
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.types_mapping
61
+ {
62
+ :id => :"String",
63
+ :name => :"String",
64
+ :description => :"String",
65
+ :status => :"AgentStatus",
66
+ :provider_id => :"String",
67
+ :model => :"String",
68
+ :instructions => :"String",
69
+ :system_prompt => :"String",
70
+ :config => :"Hash<String, Object>",
71
+ :tools => :"Array<ToolConfigInput>",
72
+ :template_type => :"String",
73
+ :created_at => :"String",
74
+ :updated_at => :"String",
75
+ :last_used_at => :"String"
76
+ }
77
+ end
78
+
79
+ # List of attributes with nullable: true
80
+ def self.openapi_nullable
81
+ Set.new(
82
+ [
83
+ :description,
84
+ :provider_id,
85
+ :model,
86
+ :system_prompt,
87
+ :template_type,
88
+ :updated_at,
89
+ :last_used_at
90
+ ]
91
+ )
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ raise(
99
+ ArgumentError,
100
+ "The input argument (attributes) must be a hash in `Algolia::AgentWithVersionResponse` initialize method"
101
+ )
102
+ end
103
+
104
+ # check to see if the attribute exists and convert string to symbol for hash key
105
+ attributes = attributes.each_with_object({}) { |(k, v), h|
106
+ if (!self.class.attribute_map.key?(k.to_sym))
107
+ raise(
108
+ ArgumentError,
109
+ "`#{k}` is not a valid attribute in `Algolia::AgentWithVersionResponse`. Please check the name to make sure it's valid. List of attributes: " +
110
+ self.class.attribute_map.keys.inspect
111
+ )
112
+ end
113
+
114
+ h[k.to_sym] = v
115
+ }
116
+
117
+ if attributes.key?(:id)
118
+ self.id = attributes[:id]
119
+ else
120
+ self.id = nil
121
+ end
122
+
123
+ if attributes.key?(:name)
124
+ self.name = attributes[:name]
125
+ else
126
+ self.name = nil
127
+ end
128
+
129
+ if attributes.key?(:description)
130
+ self.description = attributes[:description]
131
+ else
132
+ self.description = nil
133
+ end
134
+
135
+ if attributes.key?(:status)
136
+ self.status = attributes[:status]
137
+ else
138
+ self.status = nil
139
+ end
140
+
141
+ if attributes.key?(:provider_id)
142
+ self.provider_id = attributes[:provider_id]
143
+ else
144
+ self.provider_id = nil
145
+ end
146
+
147
+ if attributes.key?(:model)
148
+ self.model = attributes[:model]
149
+ end
150
+
151
+ if attributes.key?(:instructions)
152
+ self.instructions = attributes[:instructions]
153
+ else
154
+ self.instructions = nil
155
+ end
156
+
157
+ if attributes.key?(:system_prompt)
158
+ self.system_prompt = attributes[:system_prompt]
159
+ end
160
+
161
+ if attributes.key?(:config)
162
+ if (value = attributes[:config]).is_a?(Hash)
163
+ self.config = value
164
+ end
165
+ else
166
+ self.config = nil
167
+ end
168
+
169
+ if attributes.key?(:tools)
170
+ if (value = attributes[:tools]).is_a?(Array)
171
+ self.tools = value
172
+ end
173
+ end
174
+
175
+ if attributes.key?(:template_type)
176
+ self.template_type = attributes[:template_type]
177
+ end
178
+
179
+ if attributes.key?(:created_at)
180
+ self.created_at = attributes[:created_at]
181
+ else
182
+ self.created_at = nil
183
+ end
184
+
185
+ if attributes.key?(:updated_at)
186
+ self.updated_at = attributes[:updated_at]
187
+ else
188
+ self.updated_at = nil
189
+ end
190
+
191
+ if attributes.key?(:last_used_at)
192
+ self.last_used_at = attributes[:last_used_at]
193
+ else
194
+ self.last_used_at = nil
195
+ end
196
+ end
197
+
198
+ # Checks equality by comparing each attribute.
199
+ # @param [Object] Object to be compared
200
+ def ==(other)
201
+ return true if self.equal?(other)
202
+ self.class == other.class &&
203
+ id == other.id &&
204
+ name == other.name &&
205
+ description == other.description &&
206
+ status == other.status &&
207
+ provider_id == other.provider_id &&
208
+ model == other.model &&
209
+ instructions == other.instructions &&
210
+ system_prompt == other.system_prompt &&
211
+ config == other.config &&
212
+ tools == other.tools &&
213
+ template_type == other.template_type &&
214
+ created_at == other.created_at &&
215
+ updated_at == other.updated_at &&
216
+ last_used_at == other.last_used_at
217
+ end
218
+
219
+ # @see the `==` method
220
+ # @param [Object] Object to be compared
221
+ def eql?(other)
222
+ self == other
223
+ end
224
+
225
+ # Calculates hash code according to all attributes.
226
+ # @return [Integer] Hash code
227
+ def hash
228
+ [
229
+ id,
230
+ name,
231
+ description,
232
+ status,
233
+ provider_id,
234
+ model,
235
+ instructions,
236
+ system_prompt,
237
+ config,
238
+ tools,
239
+ template_type,
240
+ created_at,
241
+ updated_at,
242
+ last_used_at
243
+ ].hash
244
+ end
245
+
246
+ # Builds the object from hash
247
+ # @param [Hash] attributes Model attributes in the form of hash
248
+ # @return [Object] Returns the model itself
249
+ def self.build_from_hash(attributes)
250
+ return nil unless attributes.is_a?(Hash)
251
+ attributes = attributes.transform_keys(&:to_sym)
252
+ transformed_hash = {}
253
+ types_mapping.each_pair do |key, type|
254
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
255
+ transformed_hash[key.to_sym] = nil
256
+ elsif type =~ /\AArray<(.*)>/i
257
+ # check to ensure the input is an array given that the attribute
258
+ # is documented as an array but the input is not
259
+ if attributes[attribute_map[key]].is_a?(Array)
260
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
261
+ _deserialize(::Regexp.last_match(1), v)
262
+ }
263
+ end
264
+ elsif !attributes[attribute_map[key]].nil?
265
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
266
+ end
267
+ end
268
+
269
+ new(transformed_hash)
270
+ end
271
+
272
+ # Deserializes the data based on type
273
+ # @param string type Data type
274
+ # @param string value Value to be deserialized
275
+ # @return [Object] Deserialized data
276
+ def self._deserialize(type, value)
277
+ case type.to_sym
278
+ when :Time
279
+ Time.parse(value)
280
+ when :Date
281
+ Date.parse(value)
282
+ when :String
283
+ value.to_s
284
+ when :Integer
285
+ value.to_i
286
+ when :Float
287
+ value.to_f
288
+ when :Boolean
289
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
290
+ true
291
+ else
292
+ false
293
+ end
294
+
295
+ when :Object
296
+ # generic object (usually a Hash), return directly
297
+ value
298
+ when /\AArray<(?<inner_type>.+)>\z/
299
+ inner_type = Regexp.last_match[:inner_type]
300
+ value.map { |v| _deserialize(inner_type, v) }
301
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
302
+ k_type = Regexp.last_match[:k_type]
303
+ v_type = Regexp.last_match[:v_type]
304
+ {}.tap do |hash|
305
+ value.each do |k, v|
306
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
307
+ end
308
+ end
309
+ # model
310
+ else
311
+ # models (e.g. Pet) or oneOf
312
+ klass = Algolia::AgentStudio.const_get(type)
313
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
314
+ .build_from_hash(value)
315
+ end
316
+ end
317
+
318
+ # Returns the string representation of the object
319
+ # @return [String] String presentation of the object
320
+ def to_s
321
+ to_hash.to_s
322
+ end
323
+
324
+ # to_body is an alias to to_hash (backward compatibility)
325
+ # @return [Hash] Returns the object in the form of hash
326
+ def to_body
327
+ to_hash
328
+ end
329
+
330
+ def to_json(*_args)
331
+ to_hash.to_json
332
+ end
333
+
334
+ # Returns the object in the form of hash
335
+ # @return [Hash] Returns the object in the form of hash
336
+ def to_hash
337
+ hash = {}
338
+ self.class.attribute_map.each_pair do |attr, param|
339
+ value = send(attr)
340
+ if value.nil?
341
+ is_nullable = self.class.openapi_nullable.include?(attr)
342
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
343
+ end
344
+
345
+ hash[param] = _to_hash(value)
346
+ end
347
+
348
+ hash
349
+ end
350
+
351
+ # Outputs non-array value in the form of hash
352
+ # For object, use to_hash. Otherwise, just return the value
353
+ # @param [Object] value Any valid value
354
+ # @return [Hash] Returns the value in the form of hash
355
+ def _to_hash(value)
356
+ if value.is_a?(Array)
357
+ value.compact.map { |v| _to_hash(v) }
358
+ elsif value.is_a?(Hash)
359
+ {}.tap do |hash|
360
+ value.each { |k, v| hash[k] = _to_hash(v) }
361
+ end
362
+ elsif value.respond_to?(:to_hash)
363
+ value.to_hash
364
+ else
365
+ value
366
+ end
367
+ end
368
+ end
369
+ end
370
+ end