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,228 @@
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 ToolApprovalAGUI
11
+ attr_accessor :id
12
+
13
+ attr_accessor :needs_approval
14
+
15
+ attr_accessor :approved
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :id => :id,
21
+ :needs_approval => :needsApproval,
22
+ :approved => :approved
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.types_mapping
28
+ {
29
+ :id => :"String",
30
+ :needs_approval => :"Boolean",
31
+ :approved => :"Boolean"
32
+ }
33
+ end
34
+
35
+ # List of attributes with nullable: true
36
+ def self.openapi_nullable
37
+ Set.new(
38
+ []
39
+ )
40
+ end
41
+
42
+ # Initializes the object
43
+ # @param [Hash] attributes Model attributes in the form of hash
44
+ def initialize(attributes = {})
45
+ if (!attributes.is_a?(Hash))
46
+ raise(
47
+ ArgumentError,
48
+ "The input argument (attributes) must be a hash in `Algolia::ToolApprovalAGUI` initialize method"
49
+ )
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ raise(
56
+ ArgumentError,
57
+ "`#{k}` is not a valid attribute in `Algolia::ToolApprovalAGUI`. Please check the name to make sure it's valid. List of attributes: " +
58
+ self.class.attribute_map.keys.inspect
59
+ )
60
+ end
61
+
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:id)
66
+ self.id = attributes[:id]
67
+ else
68
+ self.id = nil
69
+ end
70
+
71
+ if attributes.key?(:needs_approval)
72
+ self.needs_approval = attributes[:needs_approval]
73
+ else
74
+ self.needs_approval = nil
75
+ end
76
+
77
+ if attributes.key?(:approved)
78
+ self.approved = attributes[:approved]
79
+ end
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(other)
85
+ return true if self.equal?(other)
86
+ self.class == other.class &&
87
+ id == other.id &&
88
+ needs_approval == other.needs_approval &&
89
+ approved == other.approved
90
+ end
91
+
92
+ # @see the `==` method
93
+ # @param [Object] Object to be compared
94
+ def eql?(other)
95
+ self == other
96
+ end
97
+
98
+ # Calculates hash code according to all attributes.
99
+ # @return [Integer] Hash code
100
+ def hash
101
+ [id, needs_approval, approved].hash
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def self.build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ attributes = attributes.transform_keys(&:to_sym)
110
+ transformed_hash = {}
111
+ types_mapping.each_pair do |key, type|
112
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
113
+ transformed_hash[key.to_sym] = nil
114
+ elsif type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[attribute_map[key]].is_a?(Array)
118
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
119
+ _deserialize(::Regexp.last_match(1), v)
120
+ }
121
+ end
122
+ elsif !attributes[attribute_map[key]].nil?
123
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
124
+ end
125
+ end
126
+
127
+ new(transformed_hash)
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def self._deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ # model
168
+ else
169
+ # models (e.g. Pet) or oneOf
170
+ klass = Algolia::AgentStudio.const_get(type)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
172
+ .build_from_hash(value)
173
+ end
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_body
185
+ to_hash
186
+ end
187
+
188
+ def to_json(*_args)
189
+ to_hash.to_json
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to?(:to_hash)
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+ end
227
+ end
228
+ end
@@ -24,6 +24,8 @@ module Algolia
24
24
 
25
25
  attr_accessor :app_id
26
26
 
27
+ attr_accessor :conversation_id
28
+
27
29
  # Attribute mapping from ruby-style variable name to JSON key.
28
30
  def self.attribute_map
29
31
  {
@@ -34,7 +36,8 @@ module Algolia
34
36
  :description => :description,
35
37
  :provider_options => :providerOptions,
36
38
  :args_hash => :argsHash,
37
- :app_id => :appId
39
+ :app_id => :appId,
40
+ :conversation_id => :conversationId
38
41
  }
39
42
  end
40
43
 
@@ -48,7 +51,8 @@ module Algolia
48
51
  :description => :"String",
49
52
  :provider_options => :"Hash<String, Object>",
50
53
  :args_hash => :"String",
51
- :app_id => :"String"
54
+ :app_id => :"String",
55
+ :conversation_id => :"String"
52
56
  }
53
57
  end
54
58
 
@@ -60,7 +64,8 @@ module Algolia
60
64
  :description,
61
65
  :provider_options,
62
66
  :args_hash,
63
- :app_id
67
+ :app_id,
68
+ :conversation_id
64
69
  ]
65
70
  )
66
71
  end
@@ -129,6 +134,10 @@ module Algolia
129
134
  if attributes.key?(:app_id)
130
135
  self.app_id = attributes[:app_id]
131
136
  end
137
+
138
+ if attributes.key?(:conversation_id)
139
+ self.conversation_id = attributes[:conversation_id]
140
+ end
132
141
  end
133
142
 
134
143
  # Checks equality by comparing each attribute.
@@ -143,7 +152,8 @@ module Algolia
143
152
  description == other.description &&
144
153
  provider_options == other.provider_options &&
145
154
  args_hash == other.args_hash &&
146
- app_id == other.app_id
155
+ app_id == other.app_id &&
156
+ conversation_id == other.conversation_id
147
157
  end
148
158
 
149
159
  # @see the `==` method
@@ -155,7 +165,7 @@ module Algolia
155
165
  # Calculates hash code according to all attributes.
156
166
  # @return [Integer] Hash code
157
167
  def hash
158
- [type, tool_call_id, tool_name, args, description, provider_options, args_hash, app_id].hash
168
+ [type, tool_call_id, tool_name, args, description, provider_options, args_hash, app_id, conversation_id].hash
159
169
  end
160
170
 
161
171
  # Builds the object from hash
@@ -0,0 +1,237 @@
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 ToolCallAGUI
11
+ attr_accessor :id
12
+
13
+ attr_accessor :type
14
+
15
+ attr_accessor :function
16
+
17
+ attr_accessor :encrypted_value
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :id => :id,
23
+ :type => :type,
24
+ :function => :function,
25
+ :encrypted_value => :encryptedValue
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.types_mapping
31
+ {
32
+ :id => :"String",
33
+ :type => :"String",
34
+ :function => :"FunctionCallAGUI",
35
+ :encrypted_value => :"String"
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new(
42
+ []
43
+ )
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ raise(
51
+ ArgumentError,
52
+ "The input argument (attributes) must be a hash in `Algolia::ToolCallAGUI` initialize method"
53
+ )
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ raise(
60
+ ArgumentError,
61
+ "`#{k}` is not a valid attribute in `Algolia::ToolCallAGUI`. Please check the name to make sure it's valid. List of attributes: " +
62
+ self.class.attribute_map.keys.inspect
63
+ )
64
+ end
65
+
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:id)
70
+ self.id = attributes[:id]
71
+ else
72
+ self.id = nil
73
+ end
74
+
75
+ if attributes.key?(:type)
76
+ self.type = attributes[:type]
77
+ end
78
+
79
+ if attributes.key?(:function)
80
+ self.function = attributes[:function]
81
+ else
82
+ self.function = nil
83
+ end
84
+
85
+ if attributes.key?(:encrypted_value)
86
+ self.encrypted_value = attributes[:encrypted_value]
87
+ end
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(other)
93
+ return true if self.equal?(other)
94
+ self.class == other.class &&
95
+ id == other.id &&
96
+ type == other.type &&
97
+ function == other.function &&
98
+ encrypted_value == other.encrypted_value
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(other)
104
+ self == other
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
109
+ def hash
110
+ [id, type, function, encrypted_value].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ attributes = attributes.transform_keys(&:to_sym)
119
+ transformed_hash = {}
120
+ types_mapping.each_pair do |key, type|
121
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
122
+ transformed_hash[key.to_sym] = nil
123
+ elsif type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[attribute_map[key]].is_a?(Array)
127
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
128
+ _deserialize(::Regexp.last_match(1), v)
129
+ }
130
+ end
131
+ elsif !attributes[attribute_map[key]].nil?
132
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
133
+ end
134
+ end
135
+
136
+ new(transformed_hash)
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def self._deserialize(type, value)
144
+ case type.to_sym
145
+ when :Time
146
+ Time.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :Boolean
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ # model
177
+ else
178
+ # models (e.g. Pet) or oneOf
179
+ klass = Algolia::AgentStudio.const_get(type)
180
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
181
+ .build_from_hash(value)
182
+ end
183
+ end
184
+
185
+ # Returns the string representation of the object
186
+ # @return [String] String presentation of the object
187
+ def to_s
188
+ to_hash.to_s
189
+ end
190
+
191
+ # to_body is an alias to to_hash (backward compatibility)
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_body
194
+ to_hash
195
+ end
196
+
197
+ def to_json(*_args)
198
+ to_hash.to_json
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = send(attr)
207
+ if value.nil?
208
+ is_nullable = self.class.openapi_nullable.include?(attr)
209
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
210
+ end
211
+
212
+ hash[param] = _to_hash(value)
213
+ end
214
+
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to?(:to_hash)
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+ end
236
+ end
237
+ end
@@ -16,6 +16,8 @@ module Algolia
16
16
 
17
17
  attr_accessor :args
18
18
 
19
+ attr_accessor :raw_args
20
+
19
21
  attr_accessor :requires_approval
20
22
 
21
23
  attr_accessor :provider_options
@@ -27,6 +29,7 @@ module Algolia
27
29
  :tool_call_id => :toolCallId,
28
30
  :tool_name => :toolName,
29
31
  :args => :args,
32
+ :raw_args => :rawArgs,
30
33
  :requires_approval => :requiresApproval,
31
34
  :provider_options => :providerOptions
32
35
  }
@@ -39,6 +42,7 @@ module Algolia
39
42
  :tool_call_id => :"String",
40
43
  :tool_name => :"String",
41
44
  :args => :"Object",
45
+ :raw_args => :"Hash<String, Object>",
42
46
  :requires_approval => :"Boolean",
43
47
  :provider_options => :"Hash<String, Object>"
44
48
  }
@@ -49,6 +53,7 @@ module Algolia
49
53
  Set.new(
50
54
  [
51
55
  :args,
56
+ :raw_args,
52
57
  :requires_approval,
53
58
  :provider_options
54
59
  ]
@@ -102,6 +107,12 @@ module Algolia
102
107
  self.args = nil
103
108
  end
104
109
 
110
+ if attributes.key?(:raw_args)
111
+ if (value = attributes[:raw_args]).is_a?(Hash)
112
+ self.raw_args = value
113
+ end
114
+ end
115
+
105
116
  if attributes.key?(:requires_approval)
106
117
  self.requires_approval = attributes[:requires_approval]
107
118
  end
@@ -122,6 +133,7 @@ module Algolia
122
133
  tool_call_id == other.tool_call_id &&
123
134
  tool_name == other.tool_name &&
124
135
  args == other.args &&
136
+ raw_args == other.raw_args &&
125
137
  requires_approval == other.requires_approval &&
126
138
  provider_options == other.provider_options
127
139
  end
@@ -135,7 +147,7 @@ module Algolia
135
147
  # Calculates hash code according to all attributes.
136
148
  # @return [Integer] Hash code
137
149
  def hash
138
- [type, tool_call_id, tool_name, args, requires_approval, provider_options].hash
150
+ [type, tool_call_id, tool_name, args, raw_args, requires_approval, provider_options].hash
139
151
  end
140
152
 
141
153
  # Builds the object from hash