algolia 3.45.0 → 3.46.1

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 (164) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +2 -2
  3. data/AGENTS.md +0 -24
  4. data/CHANGELOG.md +30 -0
  5. data/Gemfile.lock +1 -1
  6. data/lib/algolia/api/abtesting_v3_client.rb +196 -7
  7. data/lib/algolia/api/agent_studio_client.rb +244 -6
  8. data/lib/algolia/api/recommend_client.rb +2 -2
  9. data/lib/algolia/api/search_client.rb +17 -3
  10. data/lib/algolia/configuration.rb +8 -0
  11. data/lib/algolia/defaults.rb +8 -0
  12. data/lib/algolia/models/abtesting-v3/ab_test.rb +25 -1
  13. data/lib/algolia/models/abtesting-v3/ab_test_configuration.rb +22 -4
  14. data/lib/algolia/models/abtesting-v3/ab_test_settings_response.rb +224 -0
  15. data/lib/algolia/models/abtesting-v3/add_ab_tests_request.rb +11 -1
  16. data/lib/algolia/models/abtesting-v3/analysis_method.rb +34 -0
  17. data/lib/algolia/models/abtesting-v3/bayesian_metric_result.rb +237 -0
  18. data/lib/algolia/models/abtesting-v3/evidence_status.rb +37 -0
  19. data/lib/algolia/models/abtesting-v3/feature_settings.rb +224 -0
  20. data/lib/algolia/models/abtesting-v3/metric_evidence.rb +209 -0
  21. data/lib/algolia/models/abtesting-v3/metric_metadata.rb +1 -1
  22. data/lib/algolia/models/abtesting-v3/metric_name.rb +7 -1
  23. data/lib/algolia/models/abtesting-v3/metric_result.rb +18 -8
  24. data/lib/algolia/models/abtesting-v3/minimum_detectable_effect.rb +1 -1
  25. data/lib/algolia/models/abtesting-v3/primary_metric.rb +37 -0
  26. data/lib/algolia/models/abtesting-v3/save_settings_request.rb +208 -0
  27. data/lib/algolia/models/abtesting-v3/variant_settings.rb +293 -0
  28. data/lib/algolia/models/agent-studio/agent_completion_algolia_params.rb +16 -4
  29. data/lib/algolia/models/agent-studio/agent_completion_request.rb +1 -3
  30. data/lib/algolia/models/agent-studio/agent_completion_request_union.rb +108 -0
  31. data/lib/algolia/models/agent-studio/agent_test_configuration.rb +1 -1
  32. data/lib/algolia/models/agent-studio/agent_with_version_response.rb +1 -1
  33. data/lib/algolia/models/agent-studio/agui_completion_request.rb +265 -0
  34. data/lib/algolia/models/agent-studio/agui_resume.rb +231 -0
  35. data/lib/algolia/models/agent-studio/algolia_grouped_results_compat_tool_config.rb +268 -0
  36. data/lib/algolia/models/agent-studio/{algolia_display_results_tool_config.rb → algolia_grouped_results_tool_config.rb} +30 -16
  37. data/lib/algolia/models/agent-studio/{algolia_recommend_tool_config_input.rb → algolia_recommend_tool_config.rb} +3 -3
  38. data/lib/algolia/models/agent-studio/algolia_search_tool_config.rb +22 -4
  39. data/lib/algolia/models/agent-studio/assistant_message_agui.rb +280 -0
  40. data/lib/algolia/models/agent-studio/assistant_message_v4.rb +1 -0
  41. data/lib/algolia/models/agent-studio/assistant_message_v5.rb +3 -1
  42. data/lib/algolia/models/agent-studio/assistant_part_v5.rb +2 -0
  43. data/lib/algolia/models/agent-studio/azure_open_ai_provider_input.rb +1 -1
  44. data/lib/algolia/models/agent-studio/boolean_param.rb +220 -0
  45. data/lib/algolia/models/agent-studio/client_side_tool_config.rb +14 -4
  46. data/lib/algolia/models/agent-studio/compaction_stats.rb +271 -0
  47. data/lib/algolia/models/agent-studio/compatibility_mode.rb +2 -1
  48. data/lib/algolia/models/agent-studio/context_compact_request.rb +263 -0
  49. data/lib/algolia/models/agent-studio/context_response.rb +231 -0
  50. data/lib/algolia/models/agent-studio/context_stats.rb +258 -0
  51. data/lib/algolia/models/agent-studio/context_trim_request.rb +239 -0
  52. data/lib/algolia/models/agent-studio/conversation_base_response.rb +16 -5
  53. data/lib/algolia/models/agent-studio/conversation_full_response.rb +26 -5
  54. data/lib/algolia/models/agent-studio/data_guardrail_violation_part_v5.rb +218 -0
  55. data/lib/algolia/models/agent-studio/data_part_v5.rb +220 -0
  56. data/lib/algolia/models/agent-studio/facet_filters_union_search_parameters_overrides.rb +108 -0
  57. data/lib/algolia/models/agent-studio/feedback_update_request.rb +253 -0
  58. data/lib/algolia/models/agent-studio/forwarded_props.rb +226 -0
  59. data/lib/algolia/models/agent-studio/function_call_agui.rb +219 -0
  60. data/lib/algolia/models/agent-studio/guardrail_outcome.rb +231 -0
  61. data/lib/algolia/models/agent-studio/guardrail_violation_data_v5.rb +230 -0
  62. data/lib/algolia/models/agent-studio/impact_analytics.rb +242 -0
  63. data/lib/algolia/models/agent-studio/index_search_parameters.rb +11 -1
  64. data/lib/algolia/models/agent-studio/input_union.rb +113 -0
  65. data/lib/algolia/models/agent-studio/items_union.rb +132 -0
  66. data/lib/algolia/models/agent-studio/items_union_agui_completion_request.rb +123 -0
  67. data/lib/algolia/models/agent-studio/managed_provider_response_input.rb +209 -0
  68. data/lib/algolia/models/agent-studio/mcp_server_tool_config.rb +1 -1
  69. data/lib/algolia/models/agent-studio/memory_record.rb +4 -4
  70. data/lib/algolia/models/agent-studio/message_event.rb +231 -0
  71. data/lib/algolia/models/agent-studio/message_part_assistant_message_agui.rb +123 -0
  72. data/lib/algolia/models/agent-studio/message_response.rb +87 -5
  73. data/lib/algolia/models/agent-studio/mode_enum.rb +34 -0
  74. data/lib/algolia/models/agent-studio/one_of_enum.rb +34 -0
  75. data/lib/algolia/models/agent-studio/open_ai_compatible_provider_input.rb +1 -1
  76. data/lib/algolia/models/agent-studio/paginated_conversations_response.rb +13 -4
  77. data/lib/algolia/models/agent-studio/provider_authentication_response.rb +14 -5
  78. data/lib/algolia/models/agent-studio/provider_input.rb +2 -1
  79. data/lib/algolia/models/agent-studio/provider_input_nullable.rb +2 -1
  80. data/lib/algolia/models/agent-studio/provider_name.rb +2 -1
  81. data/lib/algolia/models/agent-studio/reasoning_message_agui.rb +239 -0
  82. data/lib/algolia/models/agent-studio/reasoning_part_agui.rb +228 -0
  83. data/lib/algolia/models/agent-studio/search_parameters.rb +1 -1
  84. data/lib/algolia/models/agent-studio/search_parameters_overrides.rb +80 -5
  85. data/lib/algolia/models/agent-studio/status_enum.rb +34 -0
  86. data/lib/algolia/models/agent-studio/task_kind.rb +33 -0
  87. data/lib/algolia/models/agent-studio/task_request.rb +240 -0
  88. data/lib/algolia/models/agent-studio/task_response.rb +211 -0
  89. data/lib/algolia/models/agent-studio/text_part_agui.rb +219 -0
  90. data/lib/algolia/models/agent-studio/tool_approval_agui.rb +228 -0
  91. data/lib/algolia/models/agent-studio/tool_approval_request_part.rb +15 -5
  92. data/lib/algolia/models/agent-studio/tool_call_agui.rb +237 -0
  93. data/lib/algolia/models/agent-studio/tool_call_part.rb +13 -1
  94. data/lib/algolia/models/agent-studio/tool_call_part_agui.rb +272 -0
  95. data/lib/algolia/models/agent-studio/tool_call_result_part_agui.rb +250 -0
  96. data/lib/algolia/models/agent-studio/tool_config_input.rb +2 -5
  97. data/lib/algolia/models/agent-studio/{tool_config.rb → tool_config_or_boolean_union.rb} +1 -1
  98. data/lib/algolia/models/agent-studio/tool_config_output.rb +126 -0
  99. data/lib/algolia/models/agent-studio/tool_invocation_v4.rb +10 -2
  100. data/lib/algolia/models/agent-studio/tool_message_agui.rb +259 -0
  101. data/lib/algolia/models/agent-studio/tool_part_v5.rb +47 -2
  102. data/lib/algolia/models/agent-studio/tool_result_part.rb +57 -5
  103. data/lib/algolia/models/agent-studio/unknown_tool_config.rb +1 -1
  104. data/lib/algolia/models/agent-studio/user_message_agui.rb +261 -0
  105. data/lib/algolia/models/agent-studio/user_message_metadata_agui.rb +208 -0
  106. data/lib/algolia/models/agent-studio/user_message_metadata_v5.rb +4 -2
  107. data/lib/algolia/models/agent-studio/user_message_v4.rb +4 -1
  108. data/lib/algolia/models/agent-studio/user_message_v5.rb +4 -1
  109. data/lib/algolia/models/agent-studio/validation_error.rb +5 -25
  110. data/lib/algolia/models/agent-studio/xai_provider_input.rb +220 -0
  111. data/lib/algolia/models/analytics/catalog_entry.rb +1 -1
  112. data/lib/algolia/models/composition/base_injection_query_parameters.rb +18 -18
  113. data/lib/algolia/models/composition/distinct.rb +1 -1
  114. data/lib/algolia/models/composition/external_provider.rb +209 -0
  115. data/lib/algolia/models/composition/external_provider_ordering.rb +34 -0
  116. data/lib/algolia/models/composition/hit_metadata.rb +2 -2
  117. data/lib/algolia/models/composition/injected_item_external.rb +21 -14
  118. data/lib/algolia/models/composition/injected_item_external_provider.rb +258 -0
  119. data/lib/algolia/models/composition/injected_item_external_provider_source.rb +216 -0
  120. data/lib/algolia/models/composition/injected_item_hits_metadata.rb +1 -1
  121. data/lib/algolia/models/composition/{recommend.rb → injected_item_recommend.rb} +10 -3
  122. data/lib/algolia/models/composition/injected_item_recommend_source.rb +1 -1
  123. data/lib/algolia/models/composition/injected_item_search.rb +8 -1
  124. data/lib/algolia/models/composition/injected_item_source.rb +1 -0
  125. data/lib/algolia/models/composition/injection_main_external_provider.rb +258 -0
  126. data/lib/algolia/models/composition/injection_main_external_provider_source.rb +216 -0
  127. data/lib/algolia/models/composition/{main_recommend.rb → injection_main_recommend.rb} +10 -3
  128. data/lib/algolia/models/composition/injection_main_recommend_source.rb +1 -1
  129. data/lib/algolia/models/composition/{main_search.rb → injection_main_search.rb} +11 -4
  130. data/lib/algolia/models/composition/injection_main_search_source.rb +1 -1
  131. data/lib/algolia/models/composition/injection_main_source.rb +1 -0
  132. data/lib/algolia/models/composition/main_injection_query_parameters.rb +22 -22
  133. data/lib/algolia/models/composition/optional_words.rb +1 -1
  134. data/lib/algolia/models/composition/params.rb +6 -6
  135. data/lib/algolia/models/composition/processing_error.rb +209 -0
  136. data/lib/algolia/models/composition/request_body.rb +13 -4
  137. data/lib/algolia/models/composition/result_card.rb +208 -0
  138. data/lib/algolia/models/composition/search_response.rb +16 -4
  139. data/lib/algolia/models/composition/widgets.rb +13 -4
  140. data/lib/algolia/models/ingestion/source_update_commercetools.rb +11 -0
  141. data/lib/algolia/models/recommend/distinct.rb +1 -1
  142. data/lib/algolia/models/recommend/fallback_params.rb +26 -26
  143. data/lib/algolia/models/recommend/optional_words.rb +1 -1
  144. data/lib/algolia/models/recommend/recommend_search_params.rb +26 -26
  145. data/lib/algolia/models/recommend/result_card.rb +208 -0
  146. data/lib/algolia/models/recommend/widgets.rb +13 -4
  147. data/lib/algolia/models/search/api_key.rb +2 -2
  148. data/lib/algolia/models/search/attribute_criteria_computed_by.rb +35 -0
  149. data/lib/algolia/models/search/browse_params_object.rb +35 -25
  150. data/lib/algolia/models/search/consequence_params.rb +35 -25
  151. data/lib/algolia/models/search/distinct.rb +1 -1
  152. data/lib/algolia/models/search/get_api_key_response.rb +2 -2
  153. data/lib/algolia/models/search/index_settings.rb +28 -18
  154. data/lib/algolia/models/search/optional_words.rb +1 -1
  155. data/lib/algolia/models/search/result_card.rb +208 -0
  156. data/lib/algolia/models/search/search_for_facets.rb +35 -25
  157. data/lib/algolia/models/search/search_for_hits.rb +35 -25
  158. data/lib/algolia/models/search/search_params_object.rb +35 -25
  159. data/lib/algolia/models/search/secured_api_key_restrictions.rb +1 -1
  160. data/lib/algolia/models/search/settings_response.rb +28 -18
  161. data/lib/algolia/models/search/widgets.rb +13 -4
  162. data/lib/algolia/transport/transport.rb +82 -10
  163. data/lib/algolia/version.rb +1 -1
  164. metadata +72 -8
@@ -0,0 +1,208 @@
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 AbtestingV3
10
+ # Options for capturing a variant's settings.
11
+ class SaveSettingsRequest
12
+ # Whether to also capture the variant's index settings and feature-specific settings. This must be true for A/B tests whose variants use different indices so that the captured variant settings can later be applied.
13
+ attr_accessor :save_features_settings
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+ :save_features_settings => :saveFeaturesSettings
19
+ }
20
+ end
21
+
22
+ # Attribute type mapping.
23
+ def self.types_mapping
24
+ {
25
+ :save_features_settings => :"Boolean"
26
+ }
27
+ end
28
+
29
+ # List of attributes with nullable: true
30
+ def self.openapi_nullable
31
+ Set.new(
32
+ []
33
+ )
34
+ end
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ def initialize(attributes = {})
39
+ if (!attributes.is_a?(Hash))
40
+ raise(
41
+ ArgumentError,
42
+ "The input argument (attributes) must be a hash in `Algolia::SaveSettingsRequest` initialize method"
43
+ )
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ raise(
50
+ ArgumentError,
51
+ "`#{k}` is not a valid attribute in `Algolia::SaveSettingsRequest`. Please check the name to make sure it's valid. List of attributes: " +
52
+ self.class.attribute_map.keys.inspect
53
+ )
54
+ end
55
+
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:save_features_settings)
60
+ self.save_features_settings = attributes[:save_features_settings]
61
+ end
62
+ end
63
+
64
+ # Checks equality by comparing each attribute.
65
+ # @param [Object] Object to be compared
66
+ def ==(other)
67
+ return true if self.equal?(other)
68
+ self.class == other.class &&
69
+ save_features_settings == other.save_features_settings
70
+ end
71
+
72
+ # @see the `==` method
73
+ # @param [Object] Object to be compared
74
+ def eql?(other)
75
+ self == other
76
+ end
77
+
78
+ # Calculates hash code according to all attributes.
79
+ # @return [Integer] Hash code
80
+ def hash
81
+ [save_features_settings].hash
82
+ end
83
+
84
+ # Builds the object from hash
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ # @return [Object] Returns the model itself
87
+ def self.build_from_hash(attributes)
88
+ return nil unless attributes.is_a?(Hash)
89
+ attributes = attributes.transform_keys(&:to_sym)
90
+ transformed_hash = {}
91
+ types_mapping.each_pair do |key, type|
92
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
93
+ transformed_hash[key.to_sym] = nil
94
+ elsif type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[attribute_map[key]].is_a?(Array)
98
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
99
+ _deserialize(::Regexp.last_match(1), v)
100
+ }
101
+ end
102
+ elsif !attributes[attribute_map[key]].nil?
103
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
104
+ end
105
+ end
106
+
107
+ new(transformed_hash)
108
+ end
109
+
110
+ # Deserializes the data based on type
111
+ # @param string type Data type
112
+ # @param string value Value to be deserialized
113
+ # @return [Object] Deserialized data
114
+ def self._deserialize(type, value)
115
+ case type.to_sym
116
+ when :Time
117
+ Time.parse(value)
118
+ when :Date
119
+ Date.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :Boolean
127
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ # model
148
+ else
149
+ # models (e.g. Pet) or oneOf
150
+ klass = Algolia::AbtestingV3.const_get(type)
151
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
152
+ .build_from_hash(value)
153
+ end
154
+ end
155
+
156
+ # Returns the string representation of the object
157
+ # @return [String] String presentation of the object
158
+ def to_s
159
+ to_hash.to_s
160
+ end
161
+
162
+ # to_body is an alias to to_hash (backward compatibility)
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_body
165
+ to_hash
166
+ end
167
+
168
+ def to_json(*_args)
169
+ to_hash.to_json
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = send(attr)
178
+ if value.nil?
179
+ is_nullable = self.class.openapi_nullable.include?(attr)
180
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
181
+ end
182
+
183
+ hash[param] = _to_hash(value)
184
+ end
185
+
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.map { |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to?(:to_hash)
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+ end
207
+ end
208
+ end
@@ -0,0 +1,293 @@
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 AbtestingV3
10
+ # Settings captured for one A/B test variant.
11
+ class VariantSettings
12
+ # One-based index of the variant within the A/B test. The control is variant 1.
13
+ attr_accessor :variant_id
14
+
15
+ # Whether the variant's settings have been applied to the control index.
16
+ attr_accessor :applied
17
+
18
+ # Feature-specific settings captured for the variant.
19
+ attr_accessor :features_settings
20
+
21
+ # Index settings captured for the variant.
22
+ attr_accessor :index_settings
23
+
24
+ # Date and time when the variant's settings were applied to the control index, in RFC 3339 format.
25
+ attr_accessor :apply_timestamp
26
+
27
+ # Date and time when the applied settings were reverted on the control index, in RFC 3339 format.
28
+ attr_accessor :revert_timestamp
29
+
30
+ # Date and time when the variant's settings were captured, in RFC 3339 format.
31
+ attr_accessor :declared_timestamp
32
+
33
+ # Date and time when the captured settings expired, in RFC 3339 format.
34
+ attr_accessor :expired_timestamp
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :variant_id => :variantId,
40
+ :applied => :applied,
41
+ :features_settings => :featuresSettings,
42
+ :index_settings => :indexSettings,
43
+ :apply_timestamp => :applyTimestamp,
44
+ :revert_timestamp => :revertTimestamp,
45
+ :declared_timestamp => :declaredTimestamp,
46
+ :expired_timestamp => :expiredTimestamp
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.types_mapping
52
+ {
53
+ :variant_id => :"Integer",
54
+ :applied => :"Boolean",
55
+ :features_settings => :"Array<FeatureSettings>",
56
+ :index_settings => :"Object",
57
+ :apply_timestamp => :"String",
58
+ :revert_timestamp => :"String",
59
+ :declared_timestamp => :"String",
60
+ :expired_timestamp => :"String"
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new(
67
+ []
68
+ )
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ raise(
76
+ ArgumentError,
77
+ "The input argument (attributes) must be a hash in `Algolia::VariantSettings` initialize method"
78
+ )
79
+ end
80
+
81
+ # check to see if the attribute exists and convert string to symbol for hash key
82
+ attributes = attributes.each_with_object({}) { |(k, v), h|
83
+ if (!self.class.attribute_map.key?(k.to_sym))
84
+ raise(
85
+ ArgumentError,
86
+ "`#{k}` is not a valid attribute in `Algolia::VariantSettings`. Please check the name to make sure it's valid. List of attributes: " +
87
+ self.class.attribute_map.keys.inspect
88
+ )
89
+ end
90
+
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:variant_id)
95
+ self.variant_id = attributes[:variant_id]
96
+ else
97
+ self.variant_id = nil
98
+ end
99
+
100
+ if attributes.key?(:applied)
101
+ self.applied = attributes[:applied]
102
+ else
103
+ self.applied = nil
104
+ end
105
+
106
+ if attributes.key?(:features_settings)
107
+ if (value = attributes[:features_settings]).is_a?(Array)
108
+ self.features_settings = value
109
+ end
110
+ end
111
+
112
+ if attributes.key?(:index_settings)
113
+ self.index_settings = attributes[:index_settings]
114
+ end
115
+
116
+ if attributes.key?(:apply_timestamp)
117
+ self.apply_timestamp = attributes[:apply_timestamp]
118
+ end
119
+
120
+ if attributes.key?(:revert_timestamp)
121
+ self.revert_timestamp = attributes[:revert_timestamp]
122
+ end
123
+
124
+ if attributes.key?(:declared_timestamp)
125
+ self.declared_timestamp = attributes[:declared_timestamp]
126
+ end
127
+
128
+ if attributes.key?(:expired_timestamp)
129
+ self.expired_timestamp = attributes[:expired_timestamp]
130
+ end
131
+ end
132
+
133
+ # Checks equality by comparing each attribute.
134
+ # @param [Object] Object to be compared
135
+ def ==(other)
136
+ return true if self.equal?(other)
137
+ self.class == other.class &&
138
+ variant_id == other.variant_id &&
139
+ applied == other.applied &&
140
+ features_settings == other.features_settings &&
141
+ index_settings == other.index_settings &&
142
+ apply_timestamp == other.apply_timestamp &&
143
+ revert_timestamp == other.revert_timestamp &&
144
+ declared_timestamp == other.declared_timestamp &&
145
+ expired_timestamp == other.expired_timestamp
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(other)
151
+ self == other
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Integer] Hash code
156
+ def hash
157
+ [
158
+ variant_id,
159
+ applied,
160
+ features_settings,
161
+ index_settings,
162
+ apply_timestamp,
163
+ revert_timestamp,
164
+ declared_timestamp,
165
+ expired_timestamp
166
+ ].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def self.build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ attributes = attributes.transform_keys(&:to_sym)
175
+ transformed_hash = {}
176
+ types_mapping.each_pair do |key, type|
177
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
178
+ transformed_hash[key.to_sym] = nil
179
+ elsif type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[attribute_map[key]].is_a?(Array)
183
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
184
+ _deserialize(::Regexp.last_match(1), v)
185
+ }
186
+ end
187
+ elsif !attributes[attribute_map[key]].nil?
188
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
189
+ end
190
+ end
191
+
192
+ new(transformed_hash)
193
+ end
194
+
195
+ # Deserializes the data based on type
196
+ # @param string type Data type
197
+ # @param string value Value to be deserialized
198
+ # @return [Object] Deserialized data
199
+ def self._deserialize(type, value)
200
+ case type.to_sym
201
+ when :Time
202
+ Time.parse(value)
203
+ when :Date
204
+ Date.parse(value)
205
+ when :String
206
+ value.to_s
207
+ when :Integer
208
+ value.to_i
209
+ when :Float
210
+ value.to_f
211
+ when :Boolean
212
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
213
+ true
214
+ else
215
+ false
216
+ end
217
+
218
+ when :Object
219
+ # generic object (usually a Hash), return directly
220
+ value
221
+ when /\AArray<(?<inner_type>.+)>\z/
222
+ inner_type = Regexp.last_match[:inner_type]
223
+ value.map { |v| _deserialize(inner_type, v) }
224
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
225
+ k_type = Regexp.last_match[:k_type]
226
+ v_type = Regexp.last_match[:v_type]
227
+ {}.tap do |hash|
228
+ value.each do |k, v|
229
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
230
+ end
231
+ end
232
+ # model
233
+ else
234
+ # models (e.g. Pet) or oneOf
235
+ klass = Algolia::AbtestingV3.const_get(type)
236
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
237
+ .build_from_hash(value)
238
+ end
239
+ end
240
+
241
+ # Returns the string representation of the object
242
+ # @return [String] String presentation of the object
243
+ def to_s
244
+ to_hash.to_s
245
+ end
246
+
247
+ # to_body is an alias to to_hash (backward compatibility)
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_body
250
+ to_hash
251
+ end
252
+
253
+ def to_json(*_args)
254
+ to_hash.to_json
255
+ end
256
+
257
+ # Returns the object in the form of hash
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_hash
260
+ hash = {}
261
+ self.class.attribute_map.each_pair do |attr, param|
262
+ value = send(attr)
263
+ if value.nil?
264
+ is_nullable = self.class.openapi_nullable.include?(attr)
265
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
266
+ end
267
+
268
+ hash[param] = _to_hash(value)
269
+ end
270
+
271
+ hash
272
+ end
273
+
274
+ # Outputs non-array value in the form of hash
275
+ # For object, use to_hash. Otherwise, just return the value
276
+ # @param [Object] value Any valid value
277
+ # @return [Hash] Returns the value in the form of hash
278
+ def _to_hash(value)
279
+ if value.is_a?(Array)
280
+ value.map { |v| _to_hash(v) }
281
+ elsif value.is_a?(Hash)
282
+ {}.tap do |hash|
283
+ value.each { |k, v| hash[k] = _to_hash(v) }
284
+ end
285
+ elsif value.respond_to?(:to_hash)
286
+ value.to_hash
287
+ else
288
+ value
289
+ end
290
+ end
291
+ end
292
+ end
293
+ end
@@ -12,11 +12,15 @@ module Algolia
12
12
 
13
13
  attr_accessor :search_parameters
14
14
 
15
+ # Per-request override for the Algolia Search tool's indices, honored only when the tool is configured with `mode=\"dynamic\"`. A list of index names; the API looks up each name in the agent's static `tool.indices` and reuses that entry, including its description and access-control fields. A name the agent configuration does not list is rejected with HTTP 422 (`index_not_listed_on_tool`) unless the tool sets `allowUnlistedIndices`, in which case the API synthesizes a minimal entry carrying the index name only. Capped at 10 entries. Sending this field against an agent whose tool is in `mode=\"static\"` (the default) is rejected with HTTP 422 — change the tool's `mode` in the agent configuration first. Defaults to `null`, which preserves the existing static behavior.
16
+ attr_accessor :indices
17
+
15
18
  # Attribute mapping from ruby-style variable name to JSON key.
16
19
  def self.attribute_map
17
20
  {
18
21
  :mcp_servers => :mcpServers,
19
- :search_parameters => :searchParameters
22
+ :search_parameters => :searchParameters,
23
+ :indices => :indices
20
24
  }
21
25
  end
22
26
 
@@ -24,7 +28,8 @@ module Algolia
24
28
  def self.types_mapping
25
29
  {
26
30
  :mcp_servers => :"Hash<String, Hash<String, Hash<String, String>>>",
27
- :search_parameters => :"Hash<String, SearchParametersOverrides>"
31
+ :search_parameters => :"Hash<String, SearchParametersOverrides>",
32
+ :indices => :"Array<String>"
28
33
  }
29
34
  end
30
35
 
@@ -71,6 +76,12 @@ module Algolia
71
76
  self.search_parameters = value
72
77
  end
73
78
  end
79
+
80
+ if attributes.key?(:indices)
81
+ if (value = attributes[:indices]).is_a?(Array)
82
+ self.indices = value
83
+ end
84
+ end
74
85
  end
75
86
 
76
87
  # Checks equality by comparing each attribute.
@@ -79,7 +90,8 @@ module Algolia
79
90
  return true if self.equal?(other)
80
91
  self.class == other.class &&
81
92
  mcp_servers == other.mcp_servers &&
82
- search_parameters == other.search_parameters
93
+ search_parameters == other.search_parameters &&
94
+ indices == other.indices
83
95
  end
84
96
 
85
97
  # @see the `==` method
@@ -91,7 +103,7 @@ module Algolia
91
103
  # Calculates hash code according to all attributes.
92
104
  # @return [Integer] Hash code
93
105
  def hash
94
- [mcp_servers, search_parameters].hash
106
+ [mcp_servers, search_parameters, indices].hash
95
107
  end
96
108
 
97
109
  # Builds the object from hash
@@ -46,9 +46,7 @@ module Algolia
46
46
  # List of attributes with nullable: true
47
47
  def self.openapi_nullable
48
48
  Set.new(
49
- [
50
- :messages
51
- ]
49
+ []
52
50
  )
53
51
  end
54
52
 
@@ -0,0 +1,108 @@
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
+ module AgentCompletionRequestUnion
11
+ class << self
12
+ # List of class defined in oneOf (OpenAPI v3)
13
+ def openapi_one_of
14
+ [
15
+ :"AgentCompletionRequest",
16
+ :"AguiCompletionRequest"
17
+ ]
18
+ end
19
+
20
+ # Builds the object
21
+ # @param [Mixed] Data to be matched against the list of oneOf items
22
+ # @return [Object] Returns the model or the data itself
23
+ def build(data)
24
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
25
+ # Note:
26
+ # - We do not attempt to check whether exactly one item matches.
27
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
28
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
29
+ # - TODO: scalar values are de facto behaving as if they were nullable.
30
+ # - TODO: logging when debugging is set.
31
+ openapi_one_of.each do |klass|
32
+ begin
33
+ # "nullable: true"
34
+ next if klass == :AnyType
35
+ typed_data = find_and_cast_into_type(klass, data)
36
+ return typed_data if typed_data
37
+ # rescue all errors so we keep iterating even if the current item lookup raises
38
+ rescue
39
+ end
40
+ end
41
+
42
+ openapi_one_of.include?(:AnyType) ? data : nil
43
+ end
44
+
45
+ private
46
+
47
+ SchemaMismatchError = Class.new(StandardError)
48
+
49
+ def find_and_cast_into_type(klass, data)
50
+ return if data.nil?
51
+
52
+ case klass.to_s
53
+ when "Boolean"
54
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
55
+ when "Float"
56
+ return data if data.instance_of?(Float)
57
+ when "Integer"
58
+ return data if data.instance_of?(Integer)
59
+ when "Time"
60
+ return Time.parse(data)
61
+ when "Date"
62
+ return Date.parse(data)
63
+ when "String"
64
+ return data if data.instance_of?(String)
65
+ # "type: object"
66
+ when "Object"
67
+ return data if data.instance_of?(Hash)
68
+ # "type: array"
69
+ when /\AArray<(?<sub_type>.+)>\z/
70
+ if data.instance_of?(Array)
71
+ sub_type = Regexp.last_match[:sub_type]
72
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
73
+ end
74
+ # "type: object" with "additionalProperties: { ... }"
75
+ when /\AHash<String, (?<sub_type>.+)>\z/
76
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
77
+ sub_type = Regexp.last_match[:sub_type]
78
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
79
+ end
80
+ # model
81
+ else
82
+ const = Algolia::AgentStudio.const_get(klass)
83
+ if const
84
+ if const.respond_to?(:openapi_one_of)
85
+ # nested oneOf model
86
+ model = const.build(data)
87
+ elsif const.respond_to?(:discriminator_attributes)
88
+ if const.discriminator_attributes.all? { |attr| data.key?(attr) }
89
+ model = const.build_from_hash(data)
90
+ end
91
+ else
92
+ # maybe it's an enum, or doens't have discriminators
93
+ model = const.build_from_hash(data)
94
+ end
95
+
96
+ return model if model
97
+ end
98
+ end
99
+
100
+ # if no match by now, raise
101
+ raise
102
+ rescue
103
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -45,7 +45,7 @@ module Algolia
45
45
  :instructions => :"String",
46
46
  :system_prompt => :"String",
47
47
  :config => :"Hash<String, Object>",
48
- :tools => :"Array<ToolConfigInput>"
48
+ :tools => :"Array<ItemsUnion>"
49
49
  }
50
50
  end
51
51
 
@@ -68,7 +68,7 @@ module Algolia
68
68
  :instructions => :"String",
69
69
  :system_prompt => :"String",
70
70
  :config => :"Hash<String, Object>",
71
- :tools => :"Array<ToolConfigInput>",
71
+ :tools => :"Array<ToolConfigOutput>",
72
72
  :template_type => :"String",
73
73
  :created_at => :"String",
74
74
  :updated_at => :"String",