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,231 @@
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
+ # An Insights event attributed to an assistant message.
11
+ class MessageEvent
12
+ attr_accessor :event_type
13
+
14
+ attr_accessor :event_name
15
+
16
+ attr_accessor :algolia_object_id
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :event_type => :eventType,
22
+ :event_name => :eventName,
23
+ :algolia_object_id => :objectId
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.types_mapping
29
+ {
30
+ :event_type => :"String",
31
+ :event_name => :"String",
32
+ :algolia_object_id => :"String"
33
+ }
34
+ end
35
+
36
+ # List of attributes with nullable: true
37
+ def self.openapi_nullable
38
+ Set.new(
39
+ [
40
+ :algolia_object_id
41
+ ]
42
+ )
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ raise(
50
+ ArgumentError,
51
+ "The input argument (attributes) must be a hash in `Algolia::MessageEvent` initialize method"
52
+ )
53
+ end
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h|
57
+ if (!self.class.attribute_map.key?(k.to_sym))
58
+ raise(
59
+ ArgumentError,
60
+ "`#{k}` is not a valid attribute in `Algolia::MessageEvent`. Please check the name to make sure it's valid. List of attributes: " +
61
+ self.class.attribute_map.keys.inspect
62
+ )
63
+ end
64
+
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:event_type)
69
+ self.event_type = attributes[:event_type]
70
+ else
71
+ self.event_type = nil
72
+ end
73
+
74
+ if attributes.key?(:event_name)
75
+ self.event_name = attributes[:event_name]
76
+ else
77
+ self.event_name = nil
78
+ end
79
+
80
+ if attributes.key?(:algolia_object_id)
81
+ self.algolia_object_id = attributes[:algolia_object_id]
82
+ end
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(other)
88
+ return true if self.equal?(other)
89
+ self.class == other.class &&
90
+ event_type == other.event_type &&
91
+ event_name == other.event_name &&
92
+ algolia_object_id == other.algolia_object_id
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(other)
98
+ self == other
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [event_type, event_name, algolia_object_id].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ transformed_hash = {}
114
+ types_mapping.each_pair do |key, type|
115
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
116
+ transformed_hash[key.to_sym] = nil
117
+ elsif type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[attribute_map[key]].is_a?(Array)
121
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
122
+ _deserialize(::Regexp.last_match(1), v)
123
+ }
124
+ end
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
128
+ end
129
+
130
+ new(transformed_hash)
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def self._deserialize(type, value)
138
+ case type.to_sym
139
+ when :Time
140
+ Time.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ # model
171
+ else
172
+ # models (e.g. Pet) or oneOf
173
+ klass = Algolia::AgentStudio.const_get(type)
174
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
175
+ .build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ def to_json(*_args)
192
+ to_hash.to_json
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+
209
+ hash
210
+ end
211
+
212
+ # Outputs non-array value in the form of hash
213
+ # For object, use to_hash. Otherwise, just return the value
214
+ # @param [Object] value Any valid value
215
+ # @return [Hash] Returns the value in the form of hash
216
+ def _to_hash(value)
217
+ if value.is_a?(Array)
218
+ value.map { |v| _to_hash(v) }
219
+ elsif value.is_a?(Hash)
220
+ {}.tap do |hash|
221
+ value.each { |k, v| hash[k] = _to_hash(v) }
222
+ end
223
+ elsif value.respond_to?(:to_hash)
224
+ value.to_hash
225
+ else
226
+ value
227
+ end
228
+ end
229
+ end
230
+ end
231
+ end
@@ -0,0 +1,123 @@
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 MessagePartAssistantMessageAGUI
11
+ class << self
12
+ # List of class defined in oneOf (OpenAPI v3)
13
+ def openapi_one_of
14
+ [
15
+ :"ReasoningPartAGUI",
16
+ :"TextPartAGUI",
17
+ :"ToolCallPartAGUI",
18
+ :"ToolCallResultPartAGUI"
19
+ ]
20
+ end
21
+
22
+ # Builds the object
23
+ # @param [Mixed] Data to be matched against the list of oneOf items
24
+ # @return [Object] Returns the model or the data itself
25
+ def build(data)
26
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
27
+ # Note:
28
+ # - We do not attempt to check whether exactly one item matches.
29
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
30
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
31
+ # - TODO: scalar values are de facto behaving as if they were nullable.
32
+ # - TODO: logging when debugging is set.
33
+ if data.is_a?(Hash) && data.key?("type")
34
+ case data["type"]
35
+ when "text"
36
+ return find_and_cast_into_type(:"TextPartAGUI", data)
37
+ when "thinking"
38
+ return find_and_cast_into_type(:"ReasoningPartAGUI", data)
39
+ when "tool-call"
40
+ return find_and_cast_into_type(:"ToolCallPartAGUI", data)
41
+ when "tool-result"
42
+ return find_and_cast_into_type(:"ToolCallResultPartAGUI", data)
43
+ end
44
+ end
45
+
46
+ openapi_one_of.each do |klass|
47
+ begin
48
+ # "nullable: true"
49
+ next if klass == :AnyType
50
+ typed_data = find_and_cast_into_type(klass, data)
51
+ return typed_data if typed_data
52
+ # rescue all errors so we keep iterating even if the current item lookup raises
53
+ rescue
54
+ end
55
+ end
56
+
57
+ openapi_one_of.include?(:AnyType) ? data : nil
58
+ end
59
+
60
+ private
61
+
62
+ SchemaMismatchError = Class.new(StandardError)
63
+
64
+ def find_and_cast_into_type(klass, data)
65
+ return if data.nil?
66
+
67
+ case klass.to_s
68
+ when "Boolean"
69
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
70
+ when "Float"
71
+ return data if data.instance_of?(Float)
72
+ when "Integer"
73
+ return data if data.instance_of?(Integer)
74
+ when "Time"
75
+ return Time.parse(data)
76
+ when "Date"
77
+ return Date.parse(data)
78
+ when "String"
79
+ return data if data.instance_of?(String)
80
+ # "type: object"
81
+ when "Object"
82
+ return data if data.instance_of?(Hash)
83
+ # "type: array"
84
+ when /\AArray<(?<sub_type>.+)>\z/
85
+ if data.instance_of?(Array)
86
+ sub_type = Regexp.last_match[:sub_type]
87
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
88
+ end
89
+ # "type: object" with "additionalProperties: { ... }"
90
+ when /\AHash<String, (?<sub_type>.+)>\z/
91
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
92
+ sub_type = Regexp.last_match[:sub_type]
93
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
94
+ end
95
+ # model
96
+ else
97
+ const = Algolia::AgentStudio.const_get(klass)
98
+ if const
99
+ if const.respond_to?(:openapi_one_of)
100
+ # nested oneOf model
101
+ model = const.build(data)
102
+ elsif const.respond_to?(:discriminator_attributes)
103
+ if const.discriminator_attributes.all? { |attr| data.key?(attr) }
104
+ model = const.build_from_hash(data)
105
+ end
106
+ else
107
+ # maybe it's an enum, or doens't have discriminators
108
+ model = const.build_from_hash(data)
109
+ end
110
+
111
+ return model if model
112
+ end
113
+ end
114
+
115
+ # if no match by now, raise
116
+ raise
117
+ rescue
118
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
@@ -27,8 +27,20 @@ module Algolia
27
27
 
28
28
  attr_accessor :output_tokens
29
29
 
30
+ attr_accessor :reasoning_tokens
31
+
32
+ attr_accessor :input_token_details
33
+
34
+ attr_accessor :output_token_details
35
+
36
+ attr_accessor :is_cache_hit
37
+
30
38
  attr_accessor :turn_context
31
39
 
40
+ attr_accessor :events
41
+
42
+ attr_accessor :guardrail
43
+
32
44
  # Attribute mapping from ruby-style variable name to JSON key.
33
45
  def self.attribute_map
34
46
  {
@@ -41,7 +53,13 @@ module Algolia
41
53
  :model => :model,
42
54
  :input_tokens => :inputTokens,
43
55
  :output_tokens => :outputTokens,
44
- :turn_context => :turnContext
56
+ :reasoning_tokens => :reasoningTokens,
57
+ :input_token_details => :inputTokenDetails,
58
+ :output_token_details => :outputTokenDetails,
59
+ :is_cache_hit => :isCacheHit,
60
+ :turn_context => :turnContext,
61
+ :events => :events,
62
+ :guardrail => :guardrail
45
63
  }
46
64
  end
47
65
 
@@ -57,7 +75,13 @@ module Algolia
57
75
  :model => :"String",
58
76
  :input_tokens => :"Integer",
59
77
  :output_tokens => :"Integer",
60
- :turn_context => :"Hash<String, String>"
78
+ :reasoning_tokens => :"Integer",
79
+ :input_token_details => :"Hash<String, Integer>",
80
+ :output_token_details => :"Hash<String, Integer>",
81
+ :is_cache_hit => :"Boolean",
82
+ :turn_context => :"Hash<String, Object>",
83
+ :events => :"Array<MessageEvent>",
84
+ :guardrail => :"GuardrailOutcome"
61
85
  }
62
86
  end
63
87
 
@@ -68,7 +92,12 @@ module Algolia
68
92
  :model,
69
93
  :input_tokens,
70
94
  :output_tokens,
71
- :turn_context
95
+ :reasoning_tokens,
96
+ :input_token_details,
97
+ :output_token_details,
98
+ :is_cache_hit,
99
+ :turn_context,
100
+ :guardrail
72
101
  ]
73
102
  )
74
103
  end
@@ -146,11 +175,41 @@ module Algolia
146
175
  self.output_tokens = attributes[:output_tokens]
147
176
  end
148
177
 
178
+ if attributes.key?(:reasoning_tokens)
179
+ self.reasoning_tokens = attributes[:reasoning_tokens]
180
+ end
181
+
182
+ if attributes.key?(:input_token_details)
183
+ if (value = attributes[:input_token_details]).is_a?(Hash)
184
+ self.input_token_details = value
185
+ end
186
+ end
187
+
188
+ if attributes.key?(:output_token_details)
189
+ if (value = attributes[:output_token_details]).is_a?(Hash)
190
+ self.output_token_details = value
191
+ end
192
+ end
193
+
194
+ if attributes.key?(:is_cache_hit)
195
+ self.is_cache_hit = attributes[:is_cache_hit]
196
+ end
197
+
149
198
  if attributes.key?(:turn_context)
150
199
  if (value = attributes[:turn_context]).is_a?(Hash)
151
200
  self.turn_context = value
152
201
  end
153
202
  end
203
+
204
+ if attributes.key?(:events)
205
+ if (value = attributes[:events]).is_a?(Array)
206
+ self.events = value
207
+ end
208
+ end
209
+
210
+ if attributes.key?(:guardrail)
211
+ self.guardrail = attributes[:guardrail]
212
+ end
154
213
  end
155
214
 
156
215
  # Checks equality by comparing each attribute.
@@ -167,7 +226,13 @@ module Algolia
167
226
  model == other.model &&
168
227
  input_tokens == other.input_tokens &&
169
228
  output_tokens == other.output_tokens &&
170
- turn_context == other.turn_context
229
+ reasoning_tokens == other.reasoning_tokens &&
230
+ input_token_details == other.input_token_details &&
231
+ output_token_details == other.output_token_details &&
232
+ is_cache_hit == other.is_cache_hit &&
233
+ turn_context == other.turn_context &&
234
+ events == other.events &&
235
+ guardrail == other.guardrail
171
236
  end
172
237
 
173
238
  # @see the `==` method
@@ -179,7 +244,24 @@ module Algolia
179
244
  # Calculates hash code according to all attributes.
180
245
  # @return [Integer] Hash code
181
246
  def hash
182
- [id, conversation_id, role, parts, created_at, updated_at, model, input_tokens, output_tokens, turn_context].hash
247
+ [
248
+ id,
249
+ conversation_id,
250
+ role,
251
+ parts,
252
+ created_at,
253
+ updated_at,
254
+ model,
255
+ input_tokens,
256
+ output_tokens,
257
+ reasoning_tokens,
258
+ input_token_details,
259
+ output_token_details,
260
+ is_cache_hit,
261
+ turn_context,
262
+ events,
263
+ guardrail
264
+ ].hash
183
265
  end
184
266
 
185
267
  # Builds the object from hash
@@ -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 ModeEnum
11
+ STATIC = "static".freeze
12
+ DYNAMIC = "dynamic".freeze
13
+
14
+ def self.all_vars
15
+ @all_vars ||= [STATIC, DYNAMIC].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 ModeEnum.all_vars.include?(value)
30
+ raise "Invalid ENUM value #{value} for class #ModeEnum"
31
+ end
32
+ end
33
+ end
34
+ 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 OneOfEnum
11
+ INPUT = "input".freeze
12
+ OUTPUT = "output".freeze
13
+
14
+ def self.all_vars
15
+ @all_vars ||= [INPUT, OUTPUT].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 OneOfEnum.all_vars.include?(value)
30
+ raise "Invalid ENUM value #{value} for class #OneOfEnum"
31
+ end
32
+ end
33
+ end
34
+ end
@@ -7,7 +7,7 @@ require "time"
7
7
 
8
8
  module Algolia
9
9
  module AgentStudio
10
- # OpenAI-compatible provider input. Contrary to the OpenAIProviderInput, the base_url is required. A model is required to verify connectivity and get saved as the default model. This can later be changed at the Agent level.
10
+ # Input for a provider with an OpenAI-compatible API.
11
11
  class OpenAICompatibleProviderInput
12
12
  attr_accessor :api_key
13
13
 
@@ -12,11 +12,14 @@ module Algolia
12
12
 
13
13
  attr_accessor :pagination
14
14
 
15
+ attr_accessor :analytics_degraded
16
+
15
17
  # Attribute mapping from ruby-style variable name to JSON key.
16
18
  def self.attribute_map
17
19
  {
18
20
  :data => :data,
19
- :pagination => :pagination
21
+ :pagination => :pagination,
22
+ :analytics_degraded => :analyticsDegraded
20
23
  }
21
24
  end
22
25
 
@@ -24,7 +27,8 @@ module Algolia
24
27
  def self.types_mapping
25
28
  {
26
29
  :data => :"Array<ConversationBaseResponse>",
27
- :pagination => :"PaginationMetadata"
30
+ :pagination => :"PaginationMetadata",
31
+ :analytics_degraded => :"Boolean"
28
32
  }
29
33
  end
30
34
 
@@ -71,6 +75,10 @@ module Algolia
71
75
  else
72
76
  self.pagination = nil
73
77
  end
78
+
79
+ if attributes.key?(:analytics_degraded)
80
+ self.analytics_degraded = attributes[:analytics_degraded]
81
+ end
74
82
  end
75
83
 
76
84
  # Checks equality by comparing each attribute.
@@ -79,7 +87,8 @@ module Algolia
79
87
  return true if self.equal?(other)
80
88
  self.class == other.class &&
81
89
  data == other.data &&
82
- pagination == other.pagination
90
+ pagination == other.pagination &&
91
+ analytics_degraded == other.analytics_degraded
83
92
  end
84
93
 
85
94
  # @see the `==` method
@@ -91,7 +100,7 @@ module Algolia
91
100
  # Calculates hash code according to all attributes.
92
101
  # @return [Integer] Hash code
93
102
  def hash
94
- [data, pagination].hash
103
+ [data, pagination, analytics_degraded].hash
95
104
  end
96
105
 
97
106
  # Builds the object from hash
@@ -22,6 +22,8 @@ module Algolia
22
22
 
23
23
  attr_accessor :last_used_at
24
24
 
25
+ attr_accessor :is_algolia_managed
26
+
25
27
  # Attribute mapping from ruby-style variable name to JSON key.
26
28
  def self.attribute_map
27
29
  {
@@ -31,7 +33,8 @@ module Algolia
31
33
  :input => :input,
32
34
  :created_at => :createdAt,
33
35
  :updated_at => :updatedAt,
34
- :last_used_at => :lastUsedAt
36
+ :last_used_at => :lastUsedAt,
37
+ :is_algolia_managed => :isAlgoliaManaged
35
38
  }
36
39
  end
37
40
 
@@ -41,10 +44,11 @@ module Algolia
41
44
  :id => :"String",
42
45
  :name => :"String",
43
46
  :provider_name => :"String",
44
- :input => :"ProviderInput",
47
+ :input => :"InputUnion",
45
48
  :created_at => :"String",
46
49
  :updated_at => :"String",
47
- :last_used_at => :"String"
50
+ :last_used_at => :"String",
51
+ :is_algolia_managed => :"Boolean"
48
52
  }
49
53
  end
50
54
 
@@ -119,6 +123,10 @@ module Algolia
119
123
  if attributes.key?(:last_used_at)
120
124
  self.last_used_at = attributes[:last_used_at]
121
125
  end
126
+
127
+ if attributes.key?(:is_algolia_managed)
128
+ self.is_algolia_managed = attributes[:is_algolia_managed]
129
+ end
122
130
  end
123
131
 
124
132
  # Checks equality by comparing each attribute.
@@ -132,7 +140,8 @@ module Algolia
132
140
  input == other.input &&
133
141
  created_at == other.created_at &&
134
142
  updated_at == other.updated_at &&
135
- last_used_at == other.last_used_at
143
+ last_used_at == other.last_used_at &&
144
+ is_algolia_managed == other.is_algolia_managed
136
145
  end
137
146
 
138
147
  # @see the `==` method
@@ -144,7 +153,7 @@ module Algolia
144
153
  # Calculates hash code according to all attributes.
145
154
  # @return [Integer] Hash code
146
155
  def hash
147
- [id, name, provider_name, input, created_at, updated_at, last_used_at].hash
156
+ [id, name, provider_name, input, created_at, updated_at, last_used_at, is_algolia_managed].hash
148
157
  end
149
158
 
150
159
  # Builds the object from hash