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,271 @@
|
|
|
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
|
+
# Compaction-specific telemetry, returned only by ``/context/compact``. ``compacted`` makes the short-conversation passthrough detectable: without it a caller cannot tell a no-op from a summary that happened to be short.
|
|
11
|
+
class CompactionStats
|
|
12
|
+
# Whether a summary was actually produced. `false` means the payload passed through untouched (nothing older than the kept tail, or no summarizable text).
|
|
13
|
+
attr_accessor :compacted
|
|
14
|
+
|
|
15
|
+
# Number of transcript chunks summarized in the map phase. 0 on passthrough, 1 when the transcript fit in a single summarizer call.
|
|
16
|
+
attr_accessor :chunks_processed
|
|
17
|
+
|
|
18
|
+
# Number of summarizer rounds. 1 for a direct summary; 2+ when chunk summaries had to be merged (map-reduce).
|
|
19
|
+
attr_accessor :passes
|
|
20
|
+
|
|
21
|
+
# Provider-reported input tokens summed across every summarizer call. Null when the provider reported no usage metadata.
|
|
22
|
+
attr_accessor :summarizer_prompt_tokens
|
|
23
|
+
|
|
24
|
+
# Provider-reported output tokens summed across every summarizer call. Null when the provider reported no usage metadata.
|
|
25
|
+
attr_accessor :summarizer_completion_tokens
|
|
26
|
+
|
|
27
|
+
# The requested output budget, echoed back when `targetTokensEstimate` was set.
|
|
28
|
+
attr_accessor :target_tokens_estimate
|
|
29
|
+
|
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
31
|
+
def self.attribute_map
|
|
32
|
+
{
|
|
33
|
+
:compacted => :compacted,
|
|
34
|
+
:chunks_processed => :chunksProcessed,
|
|
35
|
+
:passes => :passes,
|
|
36
|
+
:summarizer_prompt_tokens => :summarizerPromptTokens,
|
|
37
|
+
:summarizer_completion_tokens => :summarizerCompletionTokens,
|
|
38
|
+
:target_tokens_estimate => :targetTokensEstimate
|
|
39
|
+
}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Attribute type mapping.
|
|
43
|
+
def self.types_mapping
|
|
44
|
+
{
|
|
45
|
+
:compacted => :"Boolean",
|
|
46
|
+
:chunks_processed => :"Integer",
|
|
47
|
+
:passes => :"Integer",
|
|
48
|
+
:summarizer_prompt_tokens => :"Integer",
|
|
49
|
+
:summarizer_completion_tokens => :"Integer",
|
|
50
|
+
:target_tokens_estimate => :"Integer"
|
|
51
|
+
}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# List of attributes with nullable: true
|
|
55
|
+
def self.openapi_nullable
|
|
56
|
+
Set.new(
|
|
57
|
+
[
|
|
58
|
+
:summarizer_prompt_tokens,
|
|
59
|
+
:summarizer_completion_tokens,
|
|
60
|
+
:target_tokens_estimate
|
|
61
|
+
]
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Initializes the object
|
|
66
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
67
|
+
def initialize(attributes = {})
|
|
68
|
+
if (!attributes.is_a?(Hash))
|
|
69
|
+
raise(
|
|
70
|
+
ArgumentError,
|
|
71
|
+
"The input argument (attributes) must be a hash in `Algolia::CompactionStats` initialize method"
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
76
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
77
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
78
|
+
raise(
|
|
79
|
+
ArgumentError,
|
|
80
|
+
"`#{k}` is not a valid attribute in `Algolia::CompactionStats`. Please check the name to make sure it's valid. List of attributes: " +
|
|
81
|
+
self.class.attribute_map.keys.inspect
|
|
82
|
+
)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
h[k.to_sym] = v
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if attributes.key?(:compacted)
|
|
89
|
+
self.compacted = attributes[:compacted]
|
|
90
|
+
else
|
|
91
|
+
self.compacted = nil
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:chunks_processed)
|
|
95
|
+
self.chunks_processed = attributes[:chunks_processed]
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:passes)
|
|
99
|
+
self.passes = attributes[:passes]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if attributes.key?(:summarizer_prompt_tokens)
|
|
103
|
+
self.summarizer_prompt_tokens = attributes[:summarizer_prompt_tokens]
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if attributes.key?(:summarizer_completion_tokens)
|
|
107
|
+
self.summarizer_completion_tokens = attributes[:summarizer_completion_tokens]
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:target_tokens_estimate)
|
|
111
|
+
self.target_tokens_estimate = attributes[:target_tokens_estimate]
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Checks equality by comparing each attribute.
|
|
116
|
+
# @param [Object] Object to be compared
|
|
117
|
+
def ==(other)
|
|
118
|
+
return true if self.equal?(other)
|
|
119
|
+
self.class == other.class &&
|
|
120
|
+
compacted == other.compacted &&
|
|
121
|
+
chunks_processed == other.chunks_processed &&
|
|
122
|
+
passes == other.passes &&
|
|
123
|
+
summarizer_prompt_tokens == other.summarizer_prompt_tokens &&
|
|
124
|
+
summarizer_completion_tokens == other.summarizer_completion_tokens &&
|
|
125
|
+
target_tokens_estimate == other.target_tokens_estimate
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# @see the `==` method
|
|
129
|
+
# @param [Object] Object to be compared
|
|
130
|
+
def eql?(other)
|
|
131
|
+
self == other
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Calculates hash code according to all attributes.
|
|
135
|
+
# @return [Integer] Hash code
|
|
136
|
+
def hash
|
|
137
|
+
[
|
|
138
|
+
compacted,
|
|
139
|
+
chunks_processed,
|
|
140
|
+
passes,
|
|
141
|
+
summarizer_prompt_tokens,
|
|
142
|
+
summarizer_completion_tokens,
|
|
143
|
+
target_tokens_estimate
|
|
144
|
+
].hash
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Builds the object from hash
|
|
148
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
149
|
+
# @return [Object] Returns the model itself
|
|
150
|
+
def self.build_from_hash(attributes)
|
|
151
|
+
return nil unless attributes.is_a?(Hash)
|
|
152
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
153
|
+
transformed_hash = {}
|
|
154
|
+
types_mapping.each_pair do |key, type|
|
|
155
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
156
|
+
transformed_hash[key.to_sym] = nil
|
|
157
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
158
|
+
# check to ensure the input is an array given that the attribute
|
|
159
|
+
# is documented as an array but the input is not
|
|
160
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
161
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
|
162
|
+
_deserialize(::Regexp.last_match(1), v)
|
|
163
|
+
}
|
|
164
|
+
end
|
|
165
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
166
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
new(transformed_hash)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Deserializes the data based on type
|
|
174
|
+
# @param string type Data type
|
|
175
|
+
# @param string value Value to be deserialized
|
|
176
|
+
# @return [Object] Deserialized data
|
|
177
|
+
def self._deserialize(type, value)
|
|
178
|
+
case type.to_sym
|
|
179
|
+
when :Time
|
|
180
|
+
Time.parse(value)
|
|
181
|
+
when :Date
|
|
182
|
+
Date.parse(value)
|
|
183
|
+
when :String
|
|
184
|
+
value.to_s
|
|
185
|
+
when :Integer
|
|
186
|
+
value.to_i
|
|
187
|
+
when :Float
|
|
188
|
+
value.to_f
|
|
189
|
+
when :Boolean
|
|
190
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
191
|
+
true
|
|
192
|
+
else
|
|
193
|
+
false
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
when :Object
|
|
197
|
+
# generic object (usually a Hash), return directly
|
|
198
|
+
value
|
|
199
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
200
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
201
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
202
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
203
|
+
k_type = Regexp.last_match[:k_type]
|
|
204
|
+
v_type = Regexp.last_match[:v_type]
|
|
205
|
+
{}.tap do |hash|
|
|
206
|
+
value.each do |k, v|
|
|
207
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
# model
|
|
211
|
+
else
|
|
212
|
+
# models (e.g. Pet) or oneOf
|
|
213
|
+
klass = Algolia::AgentStudio.const_get(type)
|
|
214
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
|
215
|
+
.build_from_hash(value)
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Returns the string representation of the object
|
|
220
|
+
# @return [String] String presentation of the object
|
|
221
|
+
def to_s
|
|
222
|
+
to_hash.to_s
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
226
|
+
# @return [Hash] Returns the object in the form of hash
|
|
227
|
+
def to_body
|
|
228
|
+
to_hash
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
def to_json(*_args)
|
|
232
|
+
to_hash.to_json
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Returns the object in the form of hash
|
|
236
|
+
# @return [Hash] Returns the object in the form of hash
|
|
237
|
+
def to_hash
|
|
238
|
+
hash = {}
|
|
239
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
240
|
+
value = send(attr)
|
|
241
|
+
if value.nil?
|
|
242
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
243
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
hash[param] = _to_hash(value)
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
hash
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Outputs non-array value in the form of hash
|
|
253
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
254
|
+
# @param [Object] value Any valid value
|
|
255
|
+
# @return [Hash] Returns the value in the form of hash
|
|
256
|
+
def _to_hash(value)
|
|
257
|
+
if value.is_a?(Array)
|
|
258
|
+
value.map { |v| _to_hash(v) }
|
|
259
|
+
elsif value.is_a?(Hash)
|
|
260
|
+
{}.tap do |hash|
|
|
261
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
262
|
+
end
|
|
263
|
+
elsif value.respond_to?(:to_hash)
|
|
264
|
+
value.to_hash
|
|
265
|
+
else
|
|
266
|
+
value
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
end
|
|
@@ -10,9 +10,10 @@ module Algolia
|
|
|
10
10
|
class CompatibilityMode
|
|
11
11
|
AI_SDK_4 = "ai-sdk-4".freeze
|
|
12
12
|
AI_SDK_5 = "ai-sdk-5".freeze
|
|
13
|
+
AG_UI = "ag-ui".freeze
|
|
13
14
|
|
|
14
15
|
def self.all_vars
|
|
15
|
-
@all_vars ||= [AI_SDK_4, AI_SDK_5].freeze
|
|
16
|
+
@all_vars ||= [AI_SDK_4, AI_SDK_5, AG_UI].freeze
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
# Builds the enum from string
|
|
@@ -0,0 +1,263 @@
|
|
|
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
|
+
# LLM-summarization request. Your provider runs the summary, so the provider adds the cost to your account.
|
|
11
|
+
class ContextCompactRequest
|
|
12
|
+
# Provider UUID for LLM credentials.
|
|
13
|
+
attr_accessor :provider_id
|
|
14
|
+
|
|
15
|
+
# Model name (e.g., gpt-4o-mini).
|
|
16
|
+
attr_accessor :model
|
|
17
|
+
|
|
18
|
+
attr_accessor :messages
|
|
19
|
+
|
|
20
|
+
# Number of trailing messages kept verbatim; everything older is summarized.
|
|
21
|
+
attr_accessor :keep_last_messages
|
|
22
|
+
|
|
23
|
+
# Extra guidance for the summarizer (e.g. 'keep every product reference'). Appended inside the server-owned prompt frame, so it steers the summary without the model echoing your wording back into it.
|
|
24
|
+
attr_accessor :instructions
|
|
25
|
+
|
|
26
|
+
# Desired size of the final summary, in tokens. Translated into word-count guidance for the summarizer (best-effort, not a hard cap). Omit to let the summarizer default to a concise summary.
|
|
27
|
+
attr_accessor :target_tokens_estimate
|
|
28
|
+
|
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
30
|
+
def self.attribute_map
|
|
31
|
+
{
|
|
32
|
+
:provider_id => :providerID,
|
|
33
|
+
:model => :model,
|
|
34
|
+
:messages => :messages,
|
|
35
|
+
:keep_last_messages => :keepLastMessages,
|
|
36
|
+
:instructions => :instructions,
|
|
37
|
+
:target_tokens_estimate => :targetTokensEstimate
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Attribute type mapping.
|
|
42
|
+
def self.types_mapping
|
|
43
|
+
{
|
|
44
|
+
:provider_id => :"String",
|
|
45
|
+
:model => :"String",
|
|
46
|
+
:messages => :"MessagesUnion",
|
|
47
|
+
:keep_last_messages => :"Integer",
|
|
48
|
+
:instructions => :"String",
|
|
49
|
+
:target_tokens_estimate => :"Integer"
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# List of attributes with nullable: true
|
|
54
|
+
def self.openapi_nullable
|
|
55
|
+
Set.new(
|
|
56
|
+
[]
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Initializes the object
|
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
62
|
+
def initialize(attributes = {})
|
|
63
|
+
if (!attributes.is_a?(Hash))
|
|
64
|
+
raise(
|
|
65
|
+
ArgumentError,
|
|
66
|
+
"The input argument (attributes) must be a hash in `Algolia::ContextCompactRequest` initialize method"
|
|
67
|
+
)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
71
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
72
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
73
|
+
raise(
|
|
74
|
+
ArgumentError,
|
|
75
|
+
"`#{k}` is not a valid attribute in `Algolia::ContextCompactRequest`. Please check the name to make sure it's valid. List of attributes: " +
|
|
76
|
+
self.class.attribute_map.keys.inspect
|
|
77
|
+
)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
h[k.to_sym] = v
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if attributes.key?(:provider_id)
|
|
84
|
+
self.provider_id = attributes[:provider_id]
|
|
85
|
+
else
|
|
86
|
+
self.provider_id = nil
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
if attributes.key?(:model)
|
|
90
|
+
self.model = attributes[:model]
|
|
91
|
+
else
|
|
92
|
+
self.model = nil
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:messages)
|
|
96
|
+
self.messages = attributes[:messages]
|
|
97
|
+
else
|
|
98
|
+
self.messages = nil
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.key?(:keep_last_messages)
|
|
102
|
+
self.keep_last_messages = attributes[:keep_last_messages]
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if attributes.key?(:instructions)
|
|
106
|
+
self.instructions = attributes[:instructions]
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if attributes.key?(:target_tokens_estimate)
|
|
110
|
+
self.target_tokens_estimate = attributes[:target_tokens_estimate]
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Checks equality by comparing each attribute.
|
|
115
|
+
# @param [Object] Object to be compared
|
|
116
|
+
def ==(other)
|
|
117
|
+
return true if self.equal?(other)
|
|
118
|
+
self.class == other.class &&
|
|
119
|
+
provider_id == other.provider_id &&
|
|
120
|
+
model == other.model &&
|
|
121
|
+
messages == other.messages &&
|
|
122
|
+
keep_last_messages == other.keep_last_messages &&
|
|
123
|
+
instructions == other.instructions &&
|
|
124
|
+
target_tokens_estimate == other.target_tokens_estimate
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# @see the `==` method
|
|
128
|
+
# @param [Object] Object to be compared
|
|
129
|
+
def eql?(other)
|
|
130
|
+
self == other
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Calculates hash code according to all attributes.
|
|
134
|
+
# @return [Integer] Hash code
|
|
135
|
+
def hash
|
|
136
|
+
[provider_id, model, messages, keep_last_messages, instructions, target_tokens_estimate].hash
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Builds the object from hash
|
|
140
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
141
|
+
# @return [Object] Returns the model itself
|
|
142
|
+
def self.build_from_hash(attributes)
|
|
143
|
+
return nil unless attributes.is_a?(Hash)
|
|
144
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
145
|
+
transformed_hash = {}
|
|
146
|
+
types_mapping.each_pair do |key, type|
|
|
147
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
148
|
+
transformed_hash[key.to_sym] = nil
|
|
149
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
150
|
+
# check to ensure the input is an array given that the attribute
|
|
151
|
+
# is documented as an array but the input is not
|
|
152
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
153
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
|
154
|
+
_deserialize(::Regexp.last_match(1), v)
|
|
155
|
+
}
|
|
156
|
+
end
|
|
157
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
158
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
new(transformed_hash)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Deserializes the data based on type
|
|
166
|
+
# @param string type Data type
|
|
167
|
+
# @param string value Value to be deserialized
|
|
168
|
+
# @return [Object] Deserialized data
|
|
169
|
+
def self._deserialize(type, value)
|
|
170
|
+
case type.to_sym
|
|
171
|
+
when :Time
|
|
172
|
+
Time.parse(value)
|
|
173
|
+
when :Date
|
|
174
|
+
Date.parse(value)
|
|
175
|
+
when :String
|
|
176
|
+
value.to_s
|
|
177
|
+
when :Integer
|
|
178
|
+
value.to_i
|
|
179
|
+
when :Float
|
|
180
|
+
value.to_f
|
|
181
|
+
when :Boolean
|
|
182
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
183
|
+
true
|
|
184
|
+
else
|
|
185
|
+
false
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
when :Object
|
|
189
|
+
# generic object (usually a Hash), return directly
|
|
190
|
+
value
|
|
191
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
192
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
193
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
194
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
195
|
+
k_type = Regexp.last_match[:k_type]
|
|
196
|
+
v_type = Regexp.last_match[:v_type]
|
|
197
|
+
{}.tap do |hash|
|
|
198
|
+
value.each do |k, v|
|
|
199
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
# model
|
|
203
|
+
else
|
|
204
|
+
# models (e.g. Pet) or oneOf
|
|
205
|
+
klass = Algolia::AgentStudio.const_get(type)
|
|
206
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
|
207
|
+
.build_from_hash(value)
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Returns the string representation of the object
|
|
212
|
+
# @return [String] String presentation of the object
|
|
213
|
+
def to_s
|
|
214
|
+
to_hash.to_s
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
218
|
+
# @return [Hash] Returns the object in the form of hash
|
|
219
|
+
def to_body
|
|
220
|
+
to_hash
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def to_json(*_args)
|
|
224
|
+
to_hash.to_json
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Returns the object in the form of hash
|
|
228
|
+
# @return [Hash] Returns the object in the form of hash
|
|
229
|
+
def to_hash
|
|
230
|
+
hash = {}
|
|
231
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
232
|
+
value = send(attr)
|
|
233
|
+
if value.nil?
|
|
234
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
235
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
hash[param] = _to_hash(value)
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
hash
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Outputs non-array value in the form of hash
|
|
245
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
246
|
+
# @param [Object] value Any valid value
|
|
247
|
+
# @return [Hash] Returns the value in the form of hash
|
|
248
|
+
def _to_hash(value)
|
|
249
|
+
if value.is_a?(Array)
|
|
250
|
+
value.map { |v| _to_hash(v) }
|
|
251
|
+
elsif value.is_a?(Hash)
|
|
252
|
+
{}.tap do |hash|
|
|
253
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
254
|
+
end
|
|
255
|
+
elsif value.respond_to?(:to_hash)
|
|
256
|
+
value.to_hash
|
|
257
|
+
else
|
|
258
|
+
value
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
end
|