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.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +2 -2
- data/AGENTS.md +0 -24
- data/CHANGELOG.md +30 -0
- data/Gemfile.lock +1 -1
- data/lib/algolia/api/abtesting_v3_client.rb +196 -7
- data/lib/algolia/api/agent_studio_client.rb +244 -6
- data/lib/algolia/api/recommend_client.rb +2 -2
- data/lib/algolia/api/search_client.rb +17 -3
- data/lib/algolia/configuration.rb +8 -0
- data/lib/algolia/defaults.rb +8 -0
- data/lib/algolia/models/abtesting-v3/ab_test.rb +25 -1
- data/lib/algolia/models/abtesting-v3/ab_test_configuration.rb +22 -4
- data/lib/algolia/models/abtesting-v3/ab_test_settings_response.rb +224 -0
- data/lib/algolia/models/abtesting-v3/add_ab_tests_request.rb +11 -1
- data/lib/algolia/models/abtesting-v3/analysis_method.rb +34 -0
- data/lib/algolia/models/abtesting-v3/bayesian_metric_result.rb +237 -0
- data/lib/algolia/models/abtesting-v3/evidence_status.rb +37 -0
- data/lib/algolia/models/abtesting-v3/feature_settings.rb +224 -0
- data/lib/algolia/models/abtesting-v3/metric_evidence.rb +209 -0
- data/lib/algolia/models/abtesting-v3/metric_metadata.rb +1 -1
- data/lib/algolia/models/abtesting-v3/metric_name.rb +7 -1
- data/lib/algolia/models/abtesting-v3/metric_result.rb +18 -8
- data/lib/algolia/models/abtesting-v3/minimum_detectable_effect.rb +1 -1
- data/lib/algolia/models/abtesting-v3/primary_metric.rb +37 -0
- data/lib/algolia/models/abtesting-v3/save_settings_request.rb +208 -0
- data/lib/algolia/models/abtesting-v3/variant_settings.rb +293 -0
- data/lib/algolia/models/agent-studio/agent_completion_algolia_params.rb +16 -4
- data/lib/algolia/models/agent-studio/agent_completion_request.rb +1 -3
- data/lib/algolia/models/agent-studio/agent_completion_request_union.rb +108 -0
- data/lib/algolia/models/agent-studio/agent_test_configuration.rb +1 -1
- data/lib/algolia/models/agent-studio/agent_with_version_response.rb +1 -1
- data/lib/algolia/models/agent-studio/agui_completion_request.rb +265 -0
- data/lib/algolia/models/agent-studio/agui_resume.rb +231 -0
- data/lib/algolia/models/agent-studio/algolia_grouped_results_compat_tool_config.rb +268 -0
- data/lib/algolia/models/agent-studio/{algolia_display_results_tool_config.rb → algolia_grouped_results_tool_config.rb} +30 -16
- data/lib/algolia/models/agent-studio/{algolia_recommend_tool_config_input.rb → algolia_recommend_tool_config.rb} +3 -3
- data/lib/algolia/models/agent-studio/algolia_search_tool_config.rb +22 -4
- data/lib/algolia/models/agent-studio/assistant_message_agui.rb +280 -0
- data/lib/algolia/models/agent-studio/assistant_message_v4.rb +1 -0
- data/lib/algolia/models/agent-studio/assistant_message_v5.rb +3 -1
- data/lib/algolia/models/agent-studio/assistant_part_v5.rb +2 -0
- data/lib/algolia/models/agent-studio/azure_open_ai_provider_input.rb +1 -1
- data/lib/algolia/models/agent-studio/boolean_param.rb +220 -0
- data/lib/algolia/models/agent-studio/client_side_tool_config.rb +14 -4
- data/lib/algolia/models/agent-studio/compaction_stats.rb +271 -0
- data/lib/algolia/models/agent-studio/compatibility_mode.rb +2 -1
- data/lib/algolia/models/agent-studio/context_compact_request.rb +263 -0
- data/lib/algolia/models/agent-studio/context_response.rb +231 -0
- data/lib/algolia/models/agent-studio/context_stats.rb +258 -0
- data/lib/algolia/models/agent-studio/context_trim_request.rb +239 -0
- data/lib/algolia/models/agent-studio/conversation_base_response.rb +16 -5
- data/lib/algolia/models/agent-studio/conversation_full_response.rb +26 -5
- data/lib/algolia/models/agent-studio/data_guardrail_violation_part_v5.rb +218 -0
- data/lib/algolia/models/agent-studio/data_part_v5.rb +220 -0
- data/lib/algolia/models/agent-studio/facet_filters_union_search_parameters_overrides.rb +108 -0
- data/lib/algolia/models/agent-studio/feedback_update_request.rb +253 -0
- data/lib/algolia/models/agent-studio/forwarded_props.rb +226 -0
- data/lib/algolia/models/agent-studio/function_call_agui.rb +219 -0
- data/lib/algolia/models/agent-studio/guardrail_outcome.rb +231 -0
- data/lib/algolia/models/agent-studio/guardrail_violation_data_v5.rb +230 -0
- data/lib/algolia/models/agent-studio/impact_analytics.rb +242 -0
- data/lib/algolia/models/agent-studio/index_search_parameters.rb +11 -1
- data/lib/algolia/models/agent-studio/input_union.rb +113 -0
- data/lib/algolia/models/agent-studio/items_union.rb +132 -0
- data/lib/algolia/models/agent-studio/items_union_agui_completion_request.rb +123 -0
- data/lib/algolia/models/agent-studio/managed_provider_response_input.rb +209 -0
- data/lib/algolia/models/agent-studio/mcp_server_tool_config.rb +1 -1
- data/lib/algolia/models/agent-studio/memory_record.rb +4 -4
- data/lib/algolia/models/agent-studio/message_event.rb +231 -0
- data/lib/algolia/models/agent-studio/message_part_assistant_message_agui.rb +123 -0
- data/lib/algolia/models/agent-studio/message_response.rb +87 -5
- data/lib/algolia/models/agent-studio/mode_enum.rb +34 -0
- data/lib/algolia/models/agent-studio/one_of_enum.rb +34 -0
- data/lib/algolia/models/agent-studio/open_ai_compatible_provider_input.rb +1 -1
- data/lib/algolia/models/agent-studio/paginated_conversations_response.rb +13 -4
- data/lib/algolia/models/agent-studio/provider_authentication_response.rb +14 -5
- data/lib/algolia/models/agent-studio/provider_input.rb +2 -1
- data/lib/algolia/models/agent-studio/provider_input_nullable.rb +2 -1
- data/lib/algolia/models/agent-studio/provider_name.rb +2 -1
- data/lib/algolia/models/agent-studio/reasoning_message_agui.rb +239 -0
- data/lib/algolia/models/agent-studio/reasoning_part_agui.rb +228 -0
- data/lib/algolia/models/agent-studio/search_parameters.rb +1 -1
- data/lib/algolia/models/agent-studio/search_parameters_overrides.rb +80 -5
- data/lib/algolia/models/agent-studio/status_enum.rb +34 -0
- data/lib/algolia/models/agent-studio/task_kind.rb +33 -0
- data/lib/algolia/models/agent-studio/task_request.rb +240 -0
- data/lib/algolia/models/agent-studio/task_response.rb +211 -0
- data/lib/algolia/models/agent-studio/text_part_agui.rb +219 -0
- data/lib/algolia/models/agent-studio/tool_approval_agui.rb +228 -0
- data/lib/algolia/models/agent-studio/tool_approval_request_part.rb +15 -5
- data/lib/algolia/models/agent-studio/tool_call_agui.rb +237 -0
- data/lib/algolia/models/agent-studio/tool_call_part.rb +13 -1
- data/lib/algolia/models/agent-studio/tool_call_part_agui.rb +272 -0
- data/lib/algolia/models/agent-studio/tool_call_result_part_agui.rb +250 -0
- data/lib/algolia/models/agent-studio/tool_config_input.rb +2 -5
- data/lib/algolia/models/agent-studio/{tool_config.rb → tool_config_or_boolean_union.rb} +1 -1
- data/lib/algolia/models/agent-studio/tool_config_output.rb +126 -0
- data/lib/algolia/models/agent-studio/tool_invocation_v4.rb +10 -2
- data/lib/algolia/models/agent-studio/tool_message_agui.rb +259 -0
- data/lib/algolia/models/agent-studio/tool_part_v5.rb +47 -2
- data/lib/algolia/models/agent-studio/tool_result_part.rb +57 -5
- data/lib/algolia/models/agent-studio/unknown_tool_config.rb +1 -1
- data/lib/algolia/models/agent-studio/user_message_agui.rb +261 -0
- data/lib/algolia/models/agent-studio/user_message_metadata_agui.rb +208 -0
- data/lib/algolia/models/agent-studio/user_message_metadata_v5.rb +4 -2
- data/lib/algolia/models/agent-studio/user_message_v4.rb +4 -1
- data/lib/algolia/models/agent-studio/user_message_v5.rb +4 -1
- data/lib/algolia/models/agent-studio/validation_error.rb +5 -25
- data/lib/algolia/models/agent-studio/xai_provider_input.rb +220 -0
- data/lib/algolia/models/analytics/catalog_entry.rb +1 -1
- data/lib/algolia/models/composition/base_injection_query_parameters.rb +18 -18
- data/lib/algolia/models/composition/distinct.rb +1 -1
- data/lib/algolia/models/composition/external_provider.rb +209 -0
- data/lib/algolia/models/composition/external_provider_ordering.rb +34 -0
- data/lib/algolia/models/composition/hit_metadata.rb +2 -2
- data/lib/algolia/models/composition/injected_item_external.rb +21 -14
- data/lib/algolia/models/composition/injected_item_external_provider.rb +258 -0
- data/lib/algolia/models/composition/injected_item_external_provider_source.rb +216 -0
- data/lib/algolia/models/composition/injected_item_hits_metadata.rb +1 -1
- data/lib/algolia/models/composition/{recommend.rb → injected_item_recommend.rb} +10 -3
- data/lib/algolia/models/composition/injected_item_recommend_source.rb +1 -1
- data/lib/algolia/models/composition/injected_item_search.rb +8 -1
- data/lib/algolia/models/composition/injected_item_source.rb +1 -0
- data/lib/algolia/models/composition/injection_main_external_provider.rb +258 -0
- data/lib/algolia/models/composition/injection_main_external_provider_source.rb +216 -0
- data/lib/algolia/models/composition/{main_recommend.rb → injection_main_recommend.rb} +10 -3
- data/lib/algolia/models/composition/injection_main_recommend_source.rb +1 -1
- data/lib/algolia/models/composition/{main_search.rb → injection_main_search.rb} +11 -4
- data/lib/algolia/models/composition/injection_main_search_source.rb +1 -1
- data/lib/algolia/models/composition/injection_main_source.rb +1 -0
- data/lib/algolia/models/composition/main_injection_query_parameters.rb +22 -22
- data/lib/algolia/models/composition/optional_words.rb +1 -1
- data/lib/algolia/models/composition/params.rb +6 -6
- data/lib/algolia/models/composition/processing_error.rb +209 -0
- data/lib/algolia/models/composition/request_body.rb +13 -4
- data/lib/algolia/models/composition/result_card.rb +208 -0
- data/lib/algolia/models/composition/search_response.rb +16 -4
- data/lib/algolia/models/composition/widgets.rb +13 -4
- data/lib/algolia/models/ingestion/source_update_commercetools.rb +11 -0
- data/lib/algolia/models/recommend/distinct.rb +1 -1
- data/lib/algolia/models/recommend/fallback_params.rb +26 -26
- data/lib/algolia/models/recommend/optional_words.rb +1 -1
- data/lib/algolia/models/recommend/recommend_search_params.rb +26 -26
- data/lib/algolia/models/recommend/result_card.rb +208 -0
- data/lib/algolia/models/recommend/widgets.rb +13 -4
- data/lib/algolia/models/search/api_key.rb +2 -2
- data/lib/algolia/models/search/attribute_criteria_computed_by.rb +35 -0
- data/lib/algolia/models/search/browse_params_object.rb +35 -25
- data/lib/algolia/models/search/consequence_params.rb +35 -25
- data/lib/algolia/models/search/distinct.rb +1 -1
- data/lib/algolia/models/search/get_api_key_response.rb +2 -2
- data/lib/algolia/models/search/index_settings.rb +28 -18
- data/lib/algolia/models/search/optional_words.rb +1 -1
- data/lib/algolia/models/search/result_card.rb +208 -0
- data/lib/algolia/models/search/search_for_facets.rb +35 -25
- data/lib/algolia/models/search/search_for_hits.rb +35 -25
- data/lib/algolia/models/search/search_params_object.rb +35 -25
- data/lib/algolia/models/search/secured_api_key_restrictions.rb +1 -1
- data/lib/algolia/models/search/settings_response.rb +28 -18
- data/lib/algolia/models/search/widgets.rb +13 -4
- data/lib/algolia/transport/transport.rb +82 -10
- data/lib/algolia/version.rb +1 -1
- metadata +72 -8
|
@@ -0,0 +1,239 @@
|
|
|
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
|
+
# Deterministic trim request (no LLM calls).
|
|
11
|
+
class ContextTrimRequest
|
|
12
|
+
attr_accessor :messages
|
|
13
|
+
|
|
14
|
+
# Keep only the last N messages, dropping older ones. Applied before the token budget.
|
|
15
|
+
attr_accessor :keep_last_messages
|
|
16
|
+
|
|
17
|
+
# Drop oldest messages until the estimated token total fits this budget (heuristic).
|
|
18
|
+
attr_accessor :max_tokens_estimate
|
|
19
|
+
|
|
20
|
+
# Strip tool-invocation/result parts from the messages that are kept. Applied before the token budget, so the budget counts only surviving content.
|
|
21
|
+
attr_accessor :drop_tool_parts
|
|
22
|
+
|
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
24
|
+
def self.attribute_map
|
|
25
|
+
{
|
|
26
|
+
:messages => :messages,
|
|
27
|
+
:keep_last_messages => :keepLastMessages,
|
|
28
|
+
:max_tokens_estimate => :maxTokensEstimate,
|
|
29
|
+
:drop_tool_parts => :dropToolParts
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Attribute type mapping.
|
|
34
|
+
def self.types_mapping
|
|
35
|
+
{
|
|
36
|
+
:messages => :"MessagesUnion",
|
|
37
|
+
:keep_last_messages => :"Integer",
|
|
38
|
+
:max_tokens_estimate => :"Integer",
|
|
39
|
+
:drop_tool_parts => :"Boolean"
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# List of attributes with nullable: true
|
|
44
|
+
def self.openapi_nullable
|
|
45
|
+
Set.new(
|
|
46
|
+
[]
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Initializes the object
|
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
52
|
+
def initialize(attributes = {})
|
|
53
|
+
if (!attributes.is_a?(Hash))
|
|
54
|
+
raise(
|
|
55
|
+
ArgumentError,
|
|
56
|
+
"The input argument (attributes) must be a hash in `Algolia::ContextTrimRequest` initialize method"
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
61
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
62
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
63
|
+
raise(
|
|
64
|
+
ArgumentError,
|
|
65
|
+
"`#{k}` is not a valid attribute in `Algolia::ContextTrimRequest`. Please check the name to make sure it's valid. List of attributes: " +
|
|
66
|
+
self.class.attribute_map.keys.inspect
|
|
67
|
+
)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
h[k.to_sym] = v
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if attributes.key?(:messages)
|
|
74
|
+
self.messages = attributes[:messages]
|
|
75
|
+
else
|
|
76
|
+
self.messages = nil
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
if attributes.key?(:keep_last_messages)
|
|
80
|
+
self.keep_last_messages = attributes[:keep_last_messages]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
if attributes.key?(:max_tokens_estimate)
|
|
84
|
+
self.max_tokens_estimate = attributes[:max_tokens_estimate]
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
if attributes.key?(:drop_tool_parts)
|
|
88
|
+
self.drop_tool_parts = attributes[:drop_tool_parts]
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Checks equality by comparing each attribute.
|
|
93
|
+
# @param [Object] Object to be compared
|
|
94
|
+
def ==(other)
|
|
95
|
+
return true if self.equal?(other)
|
|
96
|
+
self.class == other.class &&
|
|
97
|
+
messages == other.messages &&
|
|
98
|
+
keep_last_messages == other.keep_last_messages &&
|
|
99
|
+
max_tokens_estimate == other.max_tokens_estimate &&
|
|
100
|
+
drop_tool_parts == other.drop_tool_parts
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# @see the `==` method
|
|
104
|
+
# @param [Object] Object to be compared
|
|
105
|
+
def eql?(other)
|
|
106
|
+
self == other
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Calculates hash code according to all attributes.
|
|
110
|
+
# @return [Integer] Hash code
|
|
111
|
+
def hash
|
|
112
|
+
[messages, keep_last_messages, max_tokens_estimate, drop_tool_parts].hash
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Builds the object from hash
|
|
116
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
117
|
+
# @return [Object] Returns the model itself
|
|
118
|
+
def self.build_from_hash(attributes)
|
|
119
|
+
return nil unless attributes.is_a?(Hash)
|
|
120
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
121
|
+
transformed_hash = {}
|
|
122
|
+
types_mapping.each_pair do |key, type|
|
|
123
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
124
|
+
transformed_hash[key.to_sym] = nil
|
|
125
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
126
|
+
# check to ensure the input is an array given that the attribute
|
|
127
|
+
# is documented as an array but the input is not
|
|
128
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
129
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
|
130
|
+
_deserialize(::Regexp.last_match(1), v)
|
|
131
|
+
}
|
|
132
|
+
end
|
|
133
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
134
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
new(transformed_hash)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Deserializes the data based on type
|
|
142
|
+
# @param string type Data type
|
|
143
|
+
# @param string value Value to be deserialized
|
|
144
|
+
# @return [Object] Deserialized data
|
|
145
|
+
def self._deserialize(type, value)
|
|
146
|
+
case type.to_sym
|
|
147
|
+
when :Time
|
|
148
|
+
Time.parse(value)
|
|
149
|
+
when :Date
|
|
150
|
+
Date.parse(value)
|
|
151
|
+
when :String
|
|
152
|
+
value.to_s
|
|
153
|
+
when :Integer
|
|
154
|
+
value.to_i
|
|
155
|
+
when :Float
|
|
156
|
+
value.to_f
|
|
157
|
+
when :Boolean
|
|
158
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
159
|
+
true
|
|
160
|
+
else
|
|
161
|
+
false
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
when :Object
|
|
165
|
+
# generic object (usually a Hash), return directly
|
|
166
|
+
value
|
|
167
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
168
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
169
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
170
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
171
|
+
k_type = Regexp.last_match[:k_type]
|
|
172
|
+
v_type = Regexp.last_match[:v_type]
|
|
173
|
+
{}.tap do |hash|
|
|
174
|
+
value.each do |k, v|
|
|
175
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
# model
|
|
179
|
+
else
|
|
180
|
+
# models (e.g. Pet) or oneOf
|
|
181
|
+
klass = Algolia::AgentStudio.const_get(type)
|
|
182
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
|
183
|
+
.build_from_hash(value)
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Returns the string representation of the object
|
|
188
|
+
# @return [String] String presentation of the object
|
|
189
|
+
def to_s
|
|
190
|
+
to_hash.to_s
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
|
195
|
+
def to_body
|
|
196
|
+
to_hash
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def to_json(*_args)
|
|
200
|
+
to_hash.to_json
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Returns the object in the form of hash
|
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
|
205
|
+
def to_hash
|
|
206
|
+
hash = {}
|
|
207
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
208
|
+
value = send(attr)
|
|
209
|
+
if value.nil?
|
|
210
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
211
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
hash[param] = _to_hash(value)
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
hash
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Outputs non-array value in the form of hash
|
|
221
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
222
|
+
# @param [Object] value Any valid value
|
|
223
|
+
# @return [Hash] Returns the value in the form of hash
|
|
224
|
+
def _to_hash(value)
|
|
225
|
+
if value.is_a?(Array)
|
|
226
|
+
value.map { |v| _to_hash(v) }
|
|
227
|
+
elsif value.is_a?(Hash)
|
|
228
|
+
{}.tap do |hash|
|
|
229
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
230
|
+
end
|
|
231
|
+
elsif value.respond_to?(:to_hash)
|
|
232
|
+
value.to_hash
|
|
233
|
+
else
|
|
234
|
+
value
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
end
|
|
@@ -37,6 +37,8 @@ module Algolia
|
|
|
37
37
|
|
|
38
38
|
attr_accessor :feedback
|
|
39
39
|
|
|
40
|
+
attr_accessor :impact_analytics
|
|
41
|
+
|
|
40
42
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
41
43
|
def self.attribute_map
|
|
42
44
|
{
|
|
@@ -53,7 +55,8 @@ module Algolia
|
|
|
53
55
|
:total_output_tokens => :totalOutputTokens,
|
|
54
56
|
:total_tokens => :totalTokens,
|
|
55
57
|
:conversation_metadata => :conversationMetadata,
|
|
56
|
-
:feedback => :feedback
|
|
58
|
+
:feedback => :feedback,
|
|
59
|
+
:impact_analytics => :impactAnalytics
|
|
57
60
|
}
|
|
58
61
|
end
|
|
59
62
|
|
|
@@ -73,7 +76,8 @@ module Algolia
|
|
|
73
76
|
:total_output_tokens => :"Integer",
|
|
74
77
|
:total_tokens => :"Integer",
|
|
75
78
|
:conversation_metadata => :"ConversationMetadata",
|
|
76
|
-
:feedback => :"Array<FeedbackResponse>"
|
|
79
|
+
:feedback => :"Array<FeedbackResponse>",
|
|
80
|
+
:impact_analytics => :"ImpactAnalytics"
|
|
77
81
|
}
|
|
78
82
|
end
|
|
79
83
|
|
|
@@ -85,7 +89,8 @@ module Algolia
|
|
|
85
89
|
:last_activity_at,
|
|
86
90
|
:user_token,
|
|
87
91
|
:conversation_metadata,
|
|
88
|
-
:feedback
|
|
92
|
+
:feedback,
|
|
93
|
+
:impact_analytics
|
|
89
94
|
]
|
|
90
95
|
)
|
|
91
96
|
end
|
|
@@ -178,6 +183,10 @@ module Algolia
|
|
|
178
183
|
self.feedback = value
|
|
179
184
|
end
|
|
180
185
|
end
|
|
186
|
+
|
|
187
|
+
if attributes.key?(:impact_analytics)
|
|
188
|
+
self.impact_analytics = attributes[:impact_analytics]
|
|
189
|
+
end
|
|
181
190
|
end
|
|
182
191
|
|
|
183
192
|
# Checks equality by comparing each attribute.
|
|
@@ -198,7 +207,8 @@ module Algolia
|
|
|
198
207
|
total_output_tokens == other.total_output_tokens &&
|
|
199
208
|
total_tokens == other.total_tokens &&
|
|
200
209
|
conversation_metadata == other.conversation_metadata &&
|
|
201
|
-
feedback == other.feedback
|
|
210
|
+
feedback == other.feedback &&
|
|
211
|
+
impact_analytics == other.impact_analytics
|
|
202
212
|
end
|
|
203
213
|
|
|
204
214
|
# @see the `==` method
|
|
@@ -224,7 +234,8 @@ module Algolia
|
|
|
224
234
|
total_output_tokens,
|
|
225
235
|
total_tokens,
|
|
226
236
|
conversation_metadata,
|
|
227
|
-
feedback
|
|
237
|
+
feedback,
|
|
238
|
+
impact_analytics
|
|
228
239
|
].hash
|
|
229
240
|
end
|
|
230
241
|
|
|
@@ -37,8 +37,12 @@ module Algolia
|
|
|
37
37
|
|
|
38
38
|
attr_accessor :feedback
|
|
39
39
|
|
|
40
|
+
attr_accessor :impact_analytics
|
|
41
|
+
|
|
40
42
|
attr_accessor :messages
|
|
41
43
|
|
|
44
|
+
attr_accessor :analytics_degraded
|
|
45
|
+
|
|
42
46
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
43
47
|
def self.attribute_map
|
|
44
48
|
{
|
|
@@ -56,7 +60,9 @@ module Algolia
|
|
|
56
60
|
:total_tokens => :totalTokens,
|
|
57
61
|
:conversation_metadata => :conversationMetadata,
|
|
58
62
|
:feedback => :feedback,
|
|
59
|
-
:
|
|
63
|
+
:impact_analytics => :impactAnalytics,
|
|
64
|
+
:messages => :messages,
|
|
65
|
+
:analytics_degraded => :analyticsDegraded
|
|
60
66
|
}
|
|
61
67
|
end
|
|
62
68
|
|
|
@@ -77,7 +83,9 @@ module Algolia
|
|
|
77
83
|
:total_tokens => :"Integer",
|
|
78
84
|
:conversation_metadata => :"ConversationMetadata",
|
|
79
85
|
:feedback => :"Array<FeedbackResponse>",
|
|
80
|
-
:
|
|
86
|
+
:impact_analytics => :"ImpactAnalytics",
|
|
87
|
+
:messages => :"Array<MessageResponse>",
|
|
88
|
+
:analytics_degraded => :"Boolean"
|
|
81
89
|
}
|
|
82
90
|
end
|
|
83
91
|
|
|
@@ -89,7 +97,8 @@ module Algolia
|
|
|
89
97
|
:last_activity_at,
|
|
90
98
|
:user_token,
|
|
91
99
|
:conversation_metadata,
|
|
92
|
-
:feedback
|
|
100
|
+
:feedback,
|
|
101
|
+
:impact_analytics
|
|
93
102
|
]
|
|
94
103
|
)
|
|
95
104
|
end
|
|
@@ -183,6 +192,10 @@ module Algolia
|
|
|
183
192
|
end
|
|
184
193
|
end
|
|
185
194
|
|
|
195
|
+
if attributes.key?(:impact_analytics)
|
|
196
|
+
self.impact_analytics = attributes[:impact_analytics]
|
|
197
|
+
end
|
|
198
|
+
|
|
186
199
|
if attributes.key?(:messages)
|
|
187
200
|
if (value = attributes[:messages]).is_a?(Array)
|
|
188
201
|
self.messages = value
|
|
@@ -190,6 +203,10 @@ module Algolia
|
|
|
190
203
|
else
|
|
191
204
|
self.messages = nil
|
|
192
205
|
end
|
|
206
|
+
|
|
207
|
+
if attributes.key?(:analytics_degraded)
|
|
208
|
+
self.analytics_degraded = attributes[:analytics_degraded]
|
|
209
|
+
end
|
|
193
210
|
end
|
|
194
211
|
|
|
195
212
|
# Checks equality by comparing each attribute.
|
|
@@ -211,7 +228,9 @@ module Algolia
|
|
|
211
228
|
total_tokens == other.total_tokens &&
|
|
212
229
|
conversation_metadata == other.conversation_metadata &&
|
|
213
230
|
feedback == other.feedback &&
|
|
214
|
-
|
|
231
|
+
impact_analytics == other.impact_analytics &&
|
|
232
|
+
messages == other.messages &&
|
|
233
|
+
analytics_degraded == other.analytics_degraded
|
|
215
234
|
end
|
|
216
235
|
|
|
217
236
|
# @see the `==` method
|
|
@@ -238,7 +257,9 @@ module Algolia
|
|
|
238
257
|
total_tokens,
|
|
239
258
|
conversation_metadata,
|
|
240
259
|
feedback,
|
|
241
|
-
|
|
260
|
+
impact_analytics,
|
|
261
|
+
messages,
|
|
262
|
+
analytics_degraded
|
|
242
263
|
].hash
|
|
243
264
|
end
|
|
244
265
|
|
|
@@ -0,0 +1,218 @@
|
|
|
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
|
+
# A ``data-guardrail-violation`` part that an AI SDK v5 client sends back. Send this part to tell the completions endpoint that a guardrail blocked the previous turn.
|
|
11
|
+
class DataGuardrailViolationPartV5
|
|
12
|
+
attr_accessor :type
|
|
13
|
+
|
|
14
|
+
attr_accessor :data
|
|
15
|
+
|
|
16
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
17
|
+
def self.attribute_map
|
|
18
|
+
{
|
|
19
|
+
:type => :type,
|
|
20
|
+
:data => :data
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Attribute type mapping.
|
|
25
|
+
def self.types_mapping
|
|
26
|
+
{
|
|
27
|
+
:type => :"String",
|
|
28
|
+
:data => :"GuardrailViolationDataV5"
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# List of attributes with nullable: true
|
|
33
|
+
def self.openapi_nullable
|
|
34
|
+
Set.new(
|
|
35
|
+
[]
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Initializes the object
|
|
40
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
41
|
+
def initialize(attributes = {})
|
|
42
|
+
if (!attributes.is_a?(Hash))
|
|
43
|
+
raise(
|
|
44
|
+
ArgumentError,
|
|
45
|
+
"The input argument (attributes) must be a hash in `Algolia::DataGuardrailViolationPartV5` initialize method"
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
50
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
51
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
52
|
+
raise(
|
|
53
|
+
ArgumentError,
|
|
54
|
+
"`#{k}` is not a valid attribute in `Algolia::DataGuardrailViolationPartV5`. Please check the name to make sure it's valid. List of attributes: " +
|
|
55
|
+
self.class.attribute_map.keys.inspect
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
h[k.to_sym] = v
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if attributes.key?(:type)
|
|
63
|
+
self.type = attributes[:type]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
if attributes.key?(:data)
|
|
67
|
+
self.data = attributes[:data]
|
|
68
|
+
else
|
|
69
|
+
self.data = nil
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Checks equality by comparing each attribute.
|
|
74
|
+
# @param [Object] Object to be compared
|
|
75
|
+
def ==(other)
|
|
76
|
+
return true if self.equal?(other)
|
|
77
|
+
self.class == other.class &&
|
|
78
|
+
type == other.type &&
|
|
79
|
+
data == other.data
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# @see the `==` method
|
|
83
|
+
# @param [Object] Object to be compared
|
|
84
|
+
def eql?(other)
|
|
85
|
+
self == other
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Calculates hash code according to all attributes.
|
|
89
|
+
# @return [Integer] Hash code
|
|
90
|
+
def hash
|
|
91
|
+
[type, data].hash
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Builds the object from hash
|
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
96
|
+
# @return [Object] Returns the model itself
|
|
97
|
+
def self.build_from_hash(attributes)
|
|
98
|
+
return nil unless attributes.is_a?(Hash)
|
|
99
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
100
|
+
transformed_hash = {}
|
|
101
|
+
types_mapping.each_pair do |key, type|
|
|
102
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
103
|
+
transformed_hash[key.to_sym] = nil
|
|
104
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
105
|
+
# check to ensure the input is an array given that the attribute
|
|
106
|
+
# is documented as an array but the input is not
|
|
107
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
108
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
|
109
|
+
_deserialize(::Regexp.last_match(1), v)
|
|
110
|
+
}
|
|
111
|
+
end
|
|
112
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
113
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
new(transformed_hash)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Deserializes the data based on type
|
|
121
|
+
# @param string type Data type
|
|
122
|
+
# @param string value Value to be deserialized
|
|
123
|
+
# @return [Object] Deserialized data
|
|
124
|
+
def self._deserialize(type, value)
|
|
125
|
+
case type.to_sym
|
|
126
|
+
when :Time
|
|
127
|
+
Time.parse(value)
|
|
128
|
+
when :Date
|
|
129
|
+
Date.parse(value)
|
|
130
|
+
when :String
|
|
131
|
+
value.to_s
|
|
132
|
+
when :Integer
|
|
133
|
+
value.to_i
|
|
134
|
+
when :Float
|
|
135
|
+
value.to_f
|
|
136
|
+
when :Boolean
|
|
137
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
138
|
+
true
|
|
139
|
+
else
|
|
140
|
+
false
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
when :Object
|
|
144
|
+
# generic object (usually a Hash), return directly
|
|
145
|
+
value
|
|
146
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
147
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
148
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
149
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
150
|
+
k_type = Regexp.last_match[:k_type]
|
|
151
|
+
v_type = Regexp.last_match[:v_type]
|
|
152
|
+
{}.tap do |hash|
|
|
153
|
+
value.each do |k, v|
|
|
154
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
# model
|
|
158
|
+
else
|
|
159
|
+
# models (e.g. Pet) or oneOf
|
|
160
|
+
klass = Algolia::AgentStudio.const_get(type)
|
|
161
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
|
162
|
+
.build_from_hash(value)
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Returns the string representation of the object
|
|
167
|
+
# @return [String] String presentation of the object
|
|
168
|
+
def to_s
|
|
169
|
+
to_hash.to_s
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
|
174
|
+
def to_body
|
|
175
|
+
to_hash
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def to_json(*_args)
|
|
179
|
+
to_hash.to_json
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Returns the object in the form of hash
|
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
|
184
|
+
def to_hash
|
|
185
|
+
hash = {}
|
|
186
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
187
|
+
value = send(attr)
|
|
188
|
+
if value.nil?
|
|
189
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
190
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
hash[param] = _to_hash(value)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
hash
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Outputs non-array value in the form of hash
|
|
200
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
201
|
+
# @param [Object] value Any valid value
|
|
202
|
+
# @return [Hash] Returns the value in the form of hash
|
|
203
|
+
def _to_hash(value)
|
|
204
|
+
if value.is_a?(Array)
|
|
205
|
+
value.map { |v| _to_hash(v) }
|
|
206
|
+
elsif value.is_a?(Hash)
|
|
207
|
+
{}.tap do |hash|
|
|
208
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
209
|
+
end
|
|
210
|
+
elsif value.respond_to?(:to_hash)
|
|
211
|
+
value.to_hash
|
|
212
|
+
else
|
|
213
|
+
value
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
end
|