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,288 @@
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 AgentConfigCreate
11
+ attr_accessor :name
12
+
13
+ attr_accessor :description
14
+
15
+ attr_accessor :provider_id
16
+
17
+ attr_accessor :model
18
+
19
+ # The agent prompt: defines the agent's role, tone, and goals. Guides how it answers using the provided context. Corresponds to the 'Agent prompt' field in the dashboard.
20
+ attr_accessor :instructions
21
+
22
+ # The system prompt: defines system-level rules and constraints. Guides how the agent uses tools, features, and generates context. Prepended before `instructions` in the final prompt sent to the LLM. Typically injected by an agent template — modify with caution, as changes may affect behavior, tool usage, or response accuracy. Corresponds to the 'System prompt' field in the dashboard.
23
+ attr_accessor :system_prompt
24
+
25
+ attr_accessor :template_type
26
+
27
+ attr_accessor :config
28
+
29
+ attr_accessor :tools
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :name => :name,
35
+ :description => :description,
36
+ :provider_id => :providerId,
37
+ :model => :model,
38
+ :instructions => :instructions,
39
+ :system_prompt => :systemPrompt,
40
+ :template_type => :templateType,
41
+ :config => :config,
42
+ :tools => :tools
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.types_mapping
48
+ {
49
+ :name => :"String",
50
+ :description => :"String",
51
+ :provider_id => :"String",
52
+ :model => :"String",
53
+ :instructions => :"String",
54
+ :system_prompt => :"String",
55
+ :template_type => :"String",
56
+ :config => :"Hash<String, Object>",
57
+ :tools => :"Array<ToolConfigInput>"
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new(
64
+ []
65
+ )
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ raise(
73
+ ArgumentError,
74
+ "The input argument (attributes) must be a hash in `Algolia::AgentConfigCreate` initialize method"
75
+ )
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ raise(
82
+ ArgumentError,
83
+ "`#{k}` is not a valid attribute in `Algolia::AgentConfigCreate`. Please check the name to make sure it's valid. List of attributes: " +
84
+ self.class.attribute_map.keys.inspect
85
+ )
86
+ end
87
+
88
+ h[k.to_sym] = v
89
+ }
90
+
91
+ if attributes.key?(:name)
92
+ self.name = attributes[:name]
93
+ else
94
+ self.name = nil
95
+ end
96
+
97
+ if attributes.key?(:description)
98
+ self.description = attributes[:description]
99
+ end
100
+
101
+ if attributes.key?(:provider_id)
102
+ self.provider_id = attributes[:provider_id]
103
+ end
104
+
105
+ if attributes.key?(:model)
106
+ self.model = attributes[:model]
107
+ end
108
+
109
+ if attributes.key?(:instructions)
110
+ self.instructions = attributes[:instructions]
111
+ else
112
+ self.instructions = nil
113
+ end
114
+
115
+ if attributes.key?(:system_prompt)
116
+ self.system_prompt = attributes[:system_prompt]
117
+ end
118
+
119
+ if attributes.key?(:template_type)
120
+ self.template_type = attributes[:template_type]
121
+ end
122
+
123
+ if attributes.key?(:config)
124
+ if (value = attributes[:config]).is_a?(Hash)
125
+ self.config = value
126
+ end
127
+ end
128
+
129
+ if attributes.key?(:tools)
130
+ if (value = attributes[:tools]).is_a?(Array)
131
+ self.tools = value
132
+ end
133
+ end
134
+ end
135
+
136
+ # Checks equality by comparing each attribute.
137
+ # @param [Object] Object to be compared
138
+ def ==(other)
139
+ return true if self.equal?(other)
140
+ self.class == other.class &&
141
+ name == other.name &&
142
+ description == other.description &&
143
+ provider_id == other.provider_id &&
144
+ model == other.model &&
145
+ instructions == other.instructions &&
146
+ system_prompt == other.system_prompt &&
147
+ template_type == other.template_type &&
148
+ config == other.config &&
149
+ tools == other.tools
150
+ end
151
+
152
+ # @see the `==` method
153
+ # @param [Object] Object to be compared
154
+ def eql?(other)
155
+ self == other
156
+ end
157
+
158
+ # Calculates hash code according to all attributes.
159
+ # @return [Integer] Hash code
160
+ def hash
161
+ [name, description, provider_id, model, instructions, system_prompt, template_type, config, tools].hash
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def self.build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ attributes = attributes.transform_keys(&:to_sym)
170
+ transformed_hash = {}
171
+ types_mapping.each_pair do |key, type|
172
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
173
+ transformed_hash[key.to_sym] = nil
174
+ elsif type =~ /\AArray<(.*)>/i
175
+ # check to ensure the input is an array given that the attribute
176
+ # is documented as an array but the input is not
177
+ if attributes[attribute_map[key]].is_a?(Array)
178
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
179
+ _deserialize(::Regexp.last_match(1), v)
180
+ }
181
+ end
182
+ elsif !attributes[attribute_map[key]].nil?
183
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
184
+ end
185
+ end
186
+
187
+ new(transformed_hash)
188
+ end
189
+
190
+ # Deserializes the data based on type
191
+ # @param string type Data type
192
+ # @param string value Value to be deserialized
193
+ # @return [Object] Deserialized data
194
+ def self._deserialize(type, value)
195
+ case type.to_sym
196
+ when :Time
197
+ Time.parse(value)
198
+ when :Date
199
+ Date.parse(value)
200
+ when :String
201
+ value.to_s
202
+ when :Integer
203
+ value.to_i
204
+ when :Float
205
+ value.to_f
206
+ when :Boolean
207
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
208
+ true
209
+ else
210
+ false
211
+ end
212
+
213
+ when :Object
214
+ # generic object (usually a Hash), return directly
215
+ value
216
+ when /\AArray<(?<inner_type>.+)>\z/
217
+ inner_type = Regexp.last_match[:inner_type]
218
+ value.map { |v| _deserialize(inner_type, v) }
219
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
220
+ k_type = Regexp.last_match[:k_type]
221
+ v_type = Regexp.last_match[:v_type]
222
+ {}.tap do |hash|
223
+ value.each do |k, v|
224
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
225
+ end
226
+ end
227
+ # model
228
+ else
229
+ # models (e.g. Pet) or oneOf
230
+ klass = Algolia::AgentStudio.const_get(type)
231
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
232
+ .build_from_hash(value)
233
+ end
234
+ end
235
+
236
+ # Returns the string representation of the object
237
+ # @return [String] String presentation of the object
238
+ def to_s
239
+ to_hash.to_s
240
+ end
241
+
242
+ # to_body is an alias to to_hash (backward compatibility)
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_body
245
+ to_hash
246
+ end
247
+
248
+ def to_json(*_args)
249
+ to_hash.to_json
250
+ end
251
+
252
+ # Returns the object in the form of hash
253
+ # @return [Hash] Returns the object in the form of hash
254
+ def to_hash
255
+ hash = {}
256
+ self.class.attribute_map.each_pair do |attr, param|
257
+ value = send(attr)
258
+ if value.nil?
259
+ is_nullable = self.class.openapi_nullable.include?(attr)
260
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
261
+ end
262
+
263
+ hash[param] = _to_hash(value)
264
+ end
265
+
266
+ hash
267
+ end
268
+
269
+ # Outputs non-array value in the form of hash
270
+ # For object, use to_hash. Otherwise, just return the value
271
+ # @param [Object] value Any valid value
272
+ # @return [Hash] Returns the value in the form of hash
273
+ def _to_hash(value)
274
+ if value.is_a?(Array)
275
+ value.compact.map { |v| _to_hash(v) }
276
+ elsif value.is_a?(Hash)
277
+ {}.tap do |hash|
278
+ value.each { |k, v| hash[k] = _to_hash(v) }
279
+ end
280
+ elsif value.respond_to?(:to_hash)
281
+ value.to_hash
282
+ else
283
+ value
284
+ end
285
+ end
286
+ end
287
+ end
288
+ end
@@ -0,0 +1,294 @@
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 AgentConfigUpdate
11
+ attr_accessor :name
12
+
13
+ attr_accessor :description
14
+
15
+ attr_accessor :provider_id
16
+
17
+ attr_accessor :model
18
+
19
+ # The agent prompt: defines the agent's role, tone, and goals. Guides how it answers using the provided context. Corresponds to the 'Agent prompt' field in the dashboard.
20
+ attr_accessor :instructions
21
+
22
+ # The system prompt: defines system-level rules and constraints. Guides how the agent uses tools, features, and generates context. Prepended before `instructions` in the final prompt sent to the LLM. Typically injected by an agent template — modify with caution, as changes may affect behavior, tool usage, or response accuracy. Corresponds to the 'System prompt' field in the dashboard.
23
+ attr_accessor :system_prompt
24
+
25
+ attr_accessor :config
26
+
27
+ attr_accessor :tools
28
+
29
+ attr_accessor :template_type
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :name => :name,
35
+ :description => :description,
36
+ :provider_id => :providerId,
37
+ :model => :model,
38
+ :instructions => :instructions,
39
+ :system_prompt => :systemPrompt,
40
+ :config => :config,
41
+ :tools => :tools,
42
+ :template_type => :templateType
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.types_mapping
48
+ {
49
+ :name => :"String",
50
+ :description => :"String",
51
+ :provider_id => :"String",
52
+ :model => :"String",
53
+ :instructions => :"String",
54
+ :system_prompt => :"String",
55
+ :config => :"Hash<String, Object>",
56
+ :tools => :"Array<ToolConfigInput>",
57
+ :template_type => :"String"
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new(
64
+ [
65
+ :name,
66
+ :description,
67
+ :provider_id,
68
+ :model,
69
+ :instructions,
70
+ :system_prompt,
71
+ :config,
72
+ :tools,
73
+ :template_type
74
+ ]
75
+ )
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ raise(
83
+ ArgumentError,
84
+ "The input argument (attributes) must be a hash in `Algolia::AgentConfigUpdate` initialize method"
85
+ )
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!self.class.attribute_map.key?(k.to_sym))
91
+ raise(
92
+ ArgumentError,
93
+ "`#{k}` is not a valid attribute in `Algolia::AgentConfigUpdate`. Please check the name to make sure it's valid. List of attributes: " +
94
+ self.class.attribute_map.keys.inspect
95
+ )
96
+ end
97
+
98
+ h[k.to_sym] = v
99
+ }
100
+
101
+ if attributes.key?(:name)
102
+ self.name = attributes[:name]
103
+ end
104
+
105
+ if attributes.key?(:description)
106
+ self.description = attributes[:description]
107
+ end
108
+
109
+ if attributes.key?(:provider_id)
110
+ self.provider_id = attributes[:provider_id]
111
+ end
112
+
113
+ if attributes.key?(:model)
114
+ self.model = attributes[:model]
115
+ end
116
+
117
+ if attributes.key?(:instructions)
118
+ self.instructions = attributes[:instructions]
119
+ end
120
+
121
+ if attributes.key?(:system_prompt)
122
+ self.system_prompt = attributes[:system_prompt]
123
+ end
124
+
125
+ if attributes.key?(:config)
126
+ if (value = attributes[:config]).is_a?(Hash)
127
+ self.config = value
128
+ end
129
+ end
130
+
131
+ if attributes.key?(:tools)
132
+ if (value = attributes[:tools]).is_a?(Array)
133
+ self.tools = value
134
+ end
135
+ end
136
+
137
+ if attributes.key?(:template_type)
138
+ self.template_type = attributes[:template_type]
139
+ end
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(other)
145
+ return true if self.equal?(other)
146
+ self.class == other.class &&
147
+ name == other.name &&
148
+ description == other.description &&
149
+ provider_id == other.provider_id &&
150
+ model == other.model &&
151
+ instructions == other.instructions &&
152
+ system_prompt == other.system_prompt &&
153
+ config == other.config &&
154
+ tools == other.tools &&
155
+ template_type == other.template_type
156
+ end
157
+
158
+ # @see the `==` method
159
+ # @param [Object] Object to be compared
160
+ def eql?(other)
161
+ self == other
162
+ end
163
+
164
+ # Calculates hash code according to all attributes.
165
+ # @return [Integer] Hash code
166
+ def hash
167
+ [name, description, provider_id, model, instructions, system_prompt, config, tools, template_type].hash
168
+ end
169
+
170
+ # Builds the object from hash
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ # @return [Object] Returns the model itself
173
+ def self.build_from_hash(attributes)
174
+ return nil unless attributes.is_a?(Hash)
175
+ attributes = attributes.transform_keys(&:to_sym)
176
+ transformed_hash = {}
177
+ types_mapping.each_pair do |key, type|
178
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
179
+ transformed_hash[key.to_sym] = nil
180
+ elsif type =~ /\AArray<(.*)>/i
181
+ # check to ensure the input is an array given that the attribute
182
+ # is documented as an array but the input is not
183
+ if attributes[attribute_map[key]].is_a?(Array)
184
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
185
+ _deserialize(::Regexp.last_match(1), v)
186
+ }
187
+ end
188
+ elsif !attributes[attribute_map[key]].nil?
189
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
190
+ end
191
+ end
192
+
193
+ new(transformed_hash)
194
+ end
195
+
196
+ # Deserializes the data based on type
197
+ # @param string type Data type
198
+ # @param string value Value to be deserialized
199
+ # @return [Object] Deserialized data
200
+ def self._deserialize(type, value)
201
+ case type.to_sym
202
+ when :Time
203
+ Time.parse(value)
204
+ when :Date
205
+ Date.parse(value)
206
+ when :String
207
+ value.to_s
208
+ when :Integer
209
+ value.to_i
210
+ when :Float
211
+ value.to_f
212
+ when :Boolean
213
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
214
+ true
215
+ else
216
+ false
217
+ end
218
+
219
+ when :Object
220
+ # generic object (usually a Hash), return directly
221
+ value
222
+ when /\AArray<(?<inner_type>.+)>\z/
223
+ inner_type = Regexp.last_match[:inner_type]
224
+ value.map { |v| _deserialize(inner_type, v) }
225
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
226
+ k_type = Regexp.last_match[:k_type]
227
+ v_type = Regexp.last_match[:v_type]
228
+ {}.tap do |hash|
229
+ value.each do |k, v|
230
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
231
+ end
232
+ end
233
+ # model
234
+ else
235
+ # models (e.g. Pet) or oneOf
236
+ klass = Algolia::AgentStudio.const_get(type)
237
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
238
+ .build_from_hash(value)
239
+ end
240
+ end
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # to_body is an alias to to_hash (backward compatibility)
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_body
251
+ to_hash
252
+ end
253
+
254
+ def to_json(*_args)
255
+ to_hash.to_json
256
+ end
257
+
258
+ # Returns the object in the form of hash
259
+ # @return [Hash] Returns the object in the form of hash
260
+ def to_hash
261
+ hash = {}
262
+ self.class.attribute_map.each_pair do |attr, param|
263
+ value = send(attr)
264
+ if value.nil?
265
+ is_nullable = self.class.openapi_nullable.include?(attr)
266
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
267
+ end
268
+
269
+ hash[param] = _to_hash(value)
270
+ end
271
+
272
+ hash
273
+ end
274
+
275
+ # Outputs non-array value in the form of hash
276
+ # For object, use to_hash. Otherwise, just return the value
277
+ # @param [Object] value Any valid value
278
+ # @return [Hash] Returns the value in the form of hash
279
+ def _to_hash(value)
280
+ if value.is_a?(Array)
281
+ value.compact.map { |v| _to_hash(v) }
282
+ elsif value.is_a?(Hash)
283
+ {}.tap do |hash|
284
+ value.each { |k, v| hash[k] = _to_hash(v) }
285
+ end
286
+ elsif value.respond_to?(:to_hash)
287
+ value.to_hash
288
+ else
289
+ value
290
+ end
291
+ end
292
+ end
293
+ end
294
+ end
@@ -0,0 +1,34 @@
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 AgentStatus
11
+ DRAFT = "draft".freeze
12
+ PUBLISHED = "published".freeze
13
+
14
+ def self.all_vars
15
+ @all_vars ||= [DRAFT, PUBLISHED].freeze
16
+ end
17
+
18
+ # Builds the enum from string
19
+ # @param [String] The enum value in the form of the string
20
+ # @return [String] The enum value
21
+ def self.build_from_hash(value)
22
+ new.build_from_hash(value)
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def build_from_hash(value)
29
+ return value if AgentStatus.all_vars.include?(value)
30
+ raise "Invalid ENUM value #{value} for class #AgentStatus"
31
+ end
32
+ end
33
+ end
34
+ end