turbopuffer 2.3.0 → 2.5.0
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/CHANGELOG.md +40 -0
- data/README.md +1 -10
- data/lib/turbopuffer/client.rb +2 -2
- data/lib/turbopuffer/internal/type/union.rb +17 -7
- data/lib/turbopuffer/models/attribute_schema_config.rb +14 -1
- data/lib/turbopuffer/models/copy_from_namespace_operation.rb +84 -0
- data/lib/turbopuffer/models/copy_from_namespace_operation_result.rb +37 -0
- data/lib/turbopuffer/models/highlight_config_params.rb +46 -0
- data/lib/turbopuffer/models/highlight_fragment_by.rb +25 -0
- data/lib/turbopuffer/models/highlight_offset_units.rb +17 -0
- data/lib/turbopuffer/models/namespace_explain_query_params.rb +20 -1
- data/lib/turbopuffer/models/namespace_metadata.rb +32 -2
- data/lib/turbopuffer/models/namespace_metadata_patch.rb +10 -1
- data/lib/turbopuffer/models/namespace_multi_query_params.rb +55 -2
- data/lib/turbopuffer/models/namespace_poll_copy_from_params.rb +26 -0
- data/lib/turbopuffer/models/namespace_query_params.rb +20 -1
- data/lib/turbopuffer/models/namespace_start_copy_from_params.rb +53 -0
- data/lib/turbopuffer/models/namespace_start_copy_from_response.rb +17 -0
- data/lib/turbopuffer/models/namespace_write_params.rb +12 -1
- data/lib/turbopuffer/models/operation_error.rb +46 -0
- data/lib/turbopuffer/models/rerank_limit.rb +18 -0
- data/lib/turbopuffer/models/rrf_params.rb +14 -1
- data/lib/turbopuffer/models/sharding_config.rb +21 -0
- data/lib/turbopuffer/models/write_result.rb +112 -0
- data/lib/turbopuffer/models.rb +22 -0
- data/lib/turbopuffer/resources/namespaces.rb +87 -5
- data/lib/turbopuffer/version.rb +1 -1
- data/lib/turbopuffer.rb +12 -0
- data/rbi/turbopuffer/client.rbi +2 -2
- data/rbi/turbopuffer/models/attribute_schema_config.rbi +20 -3
- data/rbi/turbopuffer/models/copy_from_namespace_operation.rbi +133 -0
- data/rbi/turbopuffer/models/copy_from_namespace_operation_result.rbi +85 -0
- data/rbi/turbopuffer/models/highlight_config_params.rbi +85 -0
- data/rbi/turbopuffer/models/highlight_fragment_by.rbi +36 -0
- data/rbi/turbopuffer/models/highlight_offset_units.rbi +27 -0
- data/rbi/turbopuffer/models/namespace_explain_query_params.rbi +28 -0
- data/rbi/turbopuffer/models/namespace_metadata.rbi +50 -4
- data/rbi/turbopuffer/models/namespace_metadata_patch.rbi +18 -3
- data/rbi/turbopuffer/models/namespace_multi_query_params.rbi +69 -0
- data/rbi/turbopuffer/models/namespace_poll_copy_from_params.rbi +49 -0
- data/rbi/turbopuffer/models/namespace_query_params.rbi +28 -0
- data/rbi/turbopuffer/models/namespace_start_copy_from_params.rbi +113 -0
- data/rbi/turbopuffer/models/namespace_start_copy_from_response.rbi +30 -0
- data/rbi/turbopuffer/models/namespace_write_params.rbi +17 -0
- data/rbi/turbopuffer/models/operation_error.rbi +77 -0
- data/rbi/turbopuffer/models/rerank_limit.rbi +28 -0
- data/rbi/turbopuffer/models/rrf_params.rbi +22 -3
- data/rbi/turbopuffer/models/sharding_config.rbi +31 -0
- data/rbi/turbopuffer/models/write_result.rbi +159 -0
- data/rbi/turbopuffer/models.rbi +24 -0
- data/rbi/turbopuffer/resources/namespaces.rbi +87 -0
- data/sig/turbopuffer/models/attribute_schema_config.rbs +12 -3
- data/sig/turbopuffer/models/copy_from_namespace_operation.rbs +65 -0
- data/sig/turbopuffer/models/copy_from_namespace_operation_result.rbs +33 -0
- data/sig/turbopuffer/models/highlight_config_params.rbs +47 -0
- data/sig/turbopuffer/models/highlight_fragment_by.rbs +23 -0
- data/sig/turbopuffer/models/highlight_offset_units.rbs +15 -0
- data/sig/turbopuffer/models/namespace_explain_query_params.rbs +14 -0
- data/sig/turbopuffer/models/namespace_metadata.rbs +29 -4
- data/sig/turbopuffer/models/namespace_metadata_patch.rbs +12 -3
- data/sig/turbopuffer/models/namespace_multi_query_params.rbs +38 -0
- data/sig/turbopuffer/models/namespace_poll_copy_from_params.rbs +30 -0
- data/sig/turbopuffer/models/namespace_query_params.rbs +14 -0
- data/sig/turbopuffer/models/namespace_start_copy_from_params.rbs +56 -0
- data/sig/turbopuffer/models/namespace_start_copy_from_response.rbs +13 -0
- data/sig/turbopuffer/models/namespace_write_params.rbs +9 -0
- data/sig/turbopuffer/models/operation_error.rbs +34 -0
- data/sig/turbopuffer/models/rerank_limit.rbs +13 -0
- data/sig/turbopuffer/models/rrf_params.rbs +10 -3
- data/sig/turbopuffer/models/sharding_config.rbs +13 -0
- data/sig/turbopuffer/models/write_result.rbs +99 -0
- data/sig/turbopuffer/models.rbs +22 -0
- data/sig/turbopuffer/resources/namespaces.rbs +23 -0
- metadata +38 -2
|
@@ -20,11 +20,20 @@ module Turbopuffer
|
|
|
20
20
|
sig { returns(T.nilable(T.any(T::Boolean, Turbopuffer::PinningConfig))) }
|
|
21
21
|
attr_accessor :pinning
|
|
22
22
|
|
|
23
|
+
# Set to `true` to reject document and schema writes, or `false` to allow them.
|
|
24
|
+
# Writes already in progress may still commit. Metadata updates remain available.
|
|
25
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
26
|
+
attr_reader :read_only
|
|
27
|
+
|
|
28
|
+
sig { params(read_only: T::Boolean).void }
|
|
29
|
+
attr_writer :read_only
|
|
30
|
+
|
|
23
31
|
# Request to update namespace metadata configuration.
|
|
24
32
|
sig do
|
|
25
33
|
params(
|
|
26
34
|
pinning:
|
|
27
|
-
T.nilable(T.any(T::Boolean, Turbopuffer::PinningConfig::OrHash))
|
|
35
|
+
T.nilable(T.any(T::Boolean, Turbopuffer::PinningConfig::OrHash)),
|
|
36
|
+
read_only: T::Boolean
|
|
28
37
|
).returns(T.attached_class)
|
|
29
38
|
end
|
|
30
39
|
def self.new(
|
|
@@ -34,13 +43,19 @@ module Turbopuffer
|
|
|
34
43
|
# - `null` or `false`: explicitly remove pinning
|
|
35
44
|
# - `true`: enable pinning with default configuration
|
|
36
45
|
# - Object: set pinning configuration
|
|
37
|
-
pinning: nil
|
|
46
|
+
pinning: nil,
|
|
47
|
+
# Set to `true` to reject document and schema writes, or `false` to allow them.
|
|
48
|
+
# Writes already in progress may still commit. Metadata updates remain available.
|
|
49
|
+
read_only: nil
|
|
38
50
|
)
|
|
39
51
|
end
|
|
40
52
|
|
|
41
53
|
sig do
|
|
42
54
|
override.returns(
|
|
43
|
-
{
|
|
55
|
+
{
|
|
56
|
+
pinning: T.nilable(T.any(T::Boolean, Turbopuffer::PinningConfig)),
|
|
57
|
+
read_only: T::Boolean
|
|
58
|
+
}
|
|
44
59
|
)
|
|
45
60
|
end
|
|
46
61
|
def to_hash
|
|
@@ -37,6 +37,23 @@ module Turbopuffer
|
|
|
37
37
|
end
|
|
38
38
|
attr_writer :consistency
|
|
39
39
|
|
|
40
|
+
# Limits the total number of reranked documents returned.
|
|
41
|
+
sig { returns(T.nilable(T.any(Integer, Turbopuffer::RerankLimit))) }
|
|
42
|
+
attr_reader :limit
|
|
43
|
+
|
|
44
|
+
sig do
|
|
45
|
+
params(limit: T.any(Integer, Turbopuffer::RerankLimit::OrHash)).void
|
|
46
|
+
end
|
|
47
|
+
attr_writer :limit
|
|
48
|
+
|
|
49
|
+
# Number of reranked documents to skip before returning results. Requires
|
|
50
|
+
# `rerank_by` and `limit`.
|
|
51
|
+
sig { returns(T.nilable(Integer)) }
|
|
52
|
+
attr_reader :offset
|
|
53
|
+
|
|
54
|
+
sig { params(offset: Integer).void }
|
|
55
|
+
attr_writer :offset
|
|
56
|
+
|
|
40
57
|
# How to combine the rows returned by each sub-query into a single ranked list.
|
|
41
58
|
sig { returns(T.nilable(T.anything)) }
|
|
42
59
|
attr_reader :rerank_by
|
|
@@ -60,6 +77,8 @@ module Turbopuffer
|
|
|
60
77
|
namespace: String,
|
|
61
78
|
consistency:
|
|
62
79
|
Turbopuffer::NamespaceMultiQueryParams::Consistency::OrHash,
|
|
80
|
+
limit: T.any(Integer, Turbopuffer::RerankLimit::OrHash),
|
|
81
|
+
offset: Integer,
|
|
63
82
|
rerank_by: T.anything,
|
|
64
83
|
vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
|
|
65
84
|
request_options: Turbopuffer::RequestOptions::OrHash
|
|
@@ -70,6 +89,11 @@ module Turbopuffer
|
|
|
70
89
|
namespace: nil,
|
|
71
90
|
# The consistency level for a query.
|
|
72
91
|
consistency: nil,
|
|
92
|
+
# Limits the total number of reranked documents returned.
|
|
93
|
+
limit: nil,
|
|
94
|
+
# Number of reranked documents to skip before returning results. Requires
|
|
95
|
+
# `rerank_by` and `limit`.
|
|
96
|
+
offset: nil,
|
|
73
97
|
# How to combine the rows returned by each sub-query into a single ranked list.
|
|
74
98
|
rerank_by: nil,
|
|
75
99
|
# The encoding to use for vectors in the response.
|
|
@@ -84,6 +108,8 @@ module Turbopuffer
|
|
|
84
108
|
namespace: String,
|
|
85
109
|
queries: T::Array[Turbopuffer::NamespaceMultiQueryParams::Query],
|
|
86
110
|
consistency: Turbopuffer::NamespaceMultiQueryParams::Consistency,
|
|
111
|
+
limit: T.any(Integer, Turbopuffer::RerankLimit),
|
|
112
|
+
offset: Integer,
|
|
87
113
|
rerank_by: T.anything,
|
|
88
114
|
vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
|
|
89
115
|
request_options: Turbopuffer::RequestOptions
|
|
@@ -110,6 +136,15 @@ module Turbopuffer
|
|
|
110
136
|
sig { params(aggregate_by: T::Hash[Symbol, T.anything]).void }
|
|
111
137
|
attr_writer :aggregate_by
|
|
112
138
|
|
|
139
|
+
# Computes additional values on documents returned by a query. Each key is the
|
|
140
|
+
# name of the computed attribute; each value is an expression describing how to
|
|
141
|
+
# compute it.
|
|
142
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
143
|
+
attr_reader :compute_attributes
|
|
144
|
+
|
|
145
|
+
sig { params(compute_attributes: T::Hash[Symbol, T.anything]).void }
|
|
146
|
+
attr_writer :compute_attributes
|
|
147
|
+
|
|
113
148
|
# A function used to calculate vector similarity.
|
|
114
149
|
sig { returns(T.nilable(Turbopuffer::DistanceMetric::OrSymbol)) }
|
|
115
150
|
attr_reader :distance_metric
|
|
@@ -161,6 +196,14 @@ module Turbopuffer
|
|
|
161
196
|
sig { params(limit: T.any(Integer, Turbopuffer::Limit::OrHash)).void }
|
|
162
197
|
attr_writer :limit
|
|
163
198
|
|
|
199
|
+
# Number of documents to skip before returning results. Supported only in v2
|
|
200
|
+
# queries with an explicit `rank_by` and `top_k` or `limit`.
|
|
201
|
+
sig { returns(T.nilable(Integer)) }
|
|
202
|
+
attr_reader :offset
|
|
203
|
+
|
|
204
|
+
sig { params(offset: Integer).void }
|
|
205
|
+
attr_writer :offset
|
|
206
|
+
|
|
164
207
|
# How to rank the documents in the namespace.
|
|
165
208
|
sig { returns(T.nilable(T.anything)) }
|
|
166
209
|
attr_reader :rank_by
|
|
@@ -179,12 +222,14 @@ module Turbopuffer
|
|
|
179
222
|
sig do
|
|
180
223
|
params(
|
|
181
224
|
aggregate_by: T::Hash[Symbol, T.anything],
|
|
225
|
+
compute_attributes: T::Hash[Symbol, T.anything],
|
|
182
226
|
distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
|
|
183
227
|
exclude_attributes: T::Array[String],
|
|
184
228
|
filters: T.anything,
|
|
185
229
|
group_by: T::Array[T.anything],
|
|
186
230
|
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
|
187
231
|
limit: T.any(Integer, Turbopuffer::Limit::OrHash),
|
|
232
|
+
offset: Integer,
|
|
188
233
|
rank_by: T.anything,
|
|
189
234
|
top_k: Integer
|
|
190
235
|
).returns(T.attached_class)
|
|
@@ -193,6 +238,10 @@ module Turbopuffer
|
|
|
193
238
|
# Aggregations to compute over all documents in the namespace that match the
|
|
194
239
|
# filters.
|
|
195
240
|
aggregate_by: nil,
|
|
241
|
+
# Computes additional values on documents returned by a query. Each key is the
|
|
242
|
+
# name of the computed attribute; each value is an expression describing how to
|
|
243
|
+
# compute it.
|
|
244
|
+
compute_attributes: nil,
|
|
196
245
|
# A function used to calculate vector similarity.
|
|
197
246
|
distance_metric: nil,
|
|
198
247
|
# List of attribute names to exclude from the response. All other attributes will
|
|
@@ -208,6 +257,9 @@ module Turbopuffer
|
|
|
208
257
|
include_attributes: nil,
|
|
209
258
|
# Limits the documents returned by a query.
|
|
210
259
|
limit: nil,
|
|
260
|
+
# Number of documents to skip before returning results. Supported only in v2
|
|
261
|
+
# queries with an explicit `rank_by` and `top_k` or `limit`.
|
|
262
|
+
offset: nil,
|
|
211
263
|
# How to rank the documents in the namespace.
|
|
212
264
|
rank_by: nil,
|
|
213
265
|
# The number of results to return.
|
|
@@ -219,12 +271,14 @@ module Turbopuffer
|
|
|
219
271
|
override.returns(
|
|
220
272
|
{
|
|
221
273
|
aggregate_by: T::Hash[Symbol, T.anything],
|
|
274
|
+
compute_attributes: T::Hash[Symbol, T.anything],
|
|
222
275
|
distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
|
|
223
276
|
exclude_attributes: T::Array[String],
|
|
224
277
|
filters: T.anything,
|
|
225
278
|
group_by: T::Array[T.anything],
|
|
226
279
|
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
|
227
280
|
limit: T.any(Integer, Turbopuffer::Limit),
|
|
281
|
+
offset: Integer,
|
|
228
282
|
rank_by: T.anything,
|
|
229
283
|
top_k: Integer
|
|
230
284
|
}
|
|
@@ -340,6 +394,21 @@ module Turbopuffer
|
|
|
340
394
|
end
|
|
341
395
|
end
|
|
342
396
|
end
|
|
397
|
+
|
|
398
|
+
# Limits the total number of reranked documents returned.
|
|
399
|
+
module Limit
|
|
400
|
+
extend Turbopuffer::Internal::Type::Union
|
|
401
|
+
|
|
402
|
+
Variants = T.type_alias { T.any(Integer, Turbopuffer::RerankLimit) }
|
|
403
|
+
|
|
404
|
+
sig do
|
|
405
|
+
override.returns(
|
|
406
|
+
T::Array[Turbopuffer::NamespaceMultiQueryParams::Limit::Variants]
|
|
407
|
+
)
|
|
408
|
+
end
|
|
409
|
+
def self.variants
|
|
410
|
+
end
|
|
411
|
+
end
|
|
343
412
|
end
|
|
344
413
|
end
|
|
345
414
|
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Turbopuffer
|
|
4
|
+
module Models
|
|
5
|
+
class NamespacePollCopyFromParams < Turbopuffer::Internal::Type::BaseModel
|
|
6
|
+
extend Turbopuffer::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include Turbopuffer::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Turbopuffer::NamespacePollCopyFromParams,
|
|
13
|
+
Turbopuffer::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
sig { returns(T.nilable(String)) }
|
|
18
|
+
attr_reader :namespace
|
|
19
|
+
|
|
20
|
+
sig { params(namespace: String).void }
|
|
21
|
+
attr_writer :namespace
|
|
22
|
+
|
|
23
|
+
sig { returns(String) }
|
|
24
|
+
attr_accessor :token
|
|
25
|
+
|
|
26
|
+
sig do
|
|
27
|
+
params(
|
|
28
|
+
token: String,
|
|
29
|
+
namespace: String,
|
|
30
|
+
request_options: Turbopuffer::RequestOptions::OrHash
|
|
31
|
+
).returns(T.attached_class)
|
|
32
|
+
end
|
|
33
|
+
def self.new(token:, namespace: nil, request_options: {})
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
sig do
|
|
37
|
+
override.returns(
|
|
38
|
+
{
|
|
39
|
+
namespace: String,
|
|
40
|
+
token: String,
|
|
41
|
+
request_options: Turbopuffer::RequestOptions
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
def to_hash
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -28,6 +28,15 @@ module Turbopuffer
|
|
|
28
28
|
sig { params(aggregate_by: T::Hash[Symbol, T.anything]).void }
|
|
29
29
|
attr_writer :aggregate_by
|
|
30
30
|
|
|
31
|
+
# Computes additional values on documents returned by a query. Each key is the
|
|
32
|
+
# name of the computed attribute; each value is an expression describing how to
|
|
33
|
+
# compute it.
|
|
34
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
35
|
+
attr_reader :compute_attributes
|
|
36
|
+
|
|
37
|
+
sig { params(compute_attributes: T::Hash[Symbol, T.anything]).void }
|
|
38
|
+
attr_writer :compute_attributes
|
|
39
|
+
|
|
31
40
|
# The consistency level for a query.
|
|
32
41
|
sig { returns(T.nilable(Turbopuffer::NamespaceQueryParams::Consistency)) }
|
|
33
42
|
attr_reader :consistency
|
|
@@ -90,6 +99,14 @@ module Turbopuffer
|
|
|
90
99
|
sig { params(limit: T.any(Integer, Turbopuffer::Limit::OrHash)).void }
|
|
91
100
|
attr_writer :limit
|
|
92
101
|
|
|
102
|
+
# Number of documents to skip before returning results. Supported only in v2
|
|
103
|
+
# queries with an explicit `rank_by` and `top_k` or `limit`.
|
|
104
|
+
sig { returns(T.nilable(Integer)) }
|
|
105
|
+
attr_reader :offset
|
|
106
|
+
|
|
107
|
+
sig { params(offset: Integer).void }
|
|
108
|
+
attr_writer :offset
|
|
109
|
+
|
|
93
110
|
# How to rank the documents in the namespace.
|
|
94
111
|
sig { returns(T.nilable(T.anything)) }
|
|
95
112
|
attr_reader :rank_by
|
|
@@ -117,6 +134,7 @@ module Turbopuffer
|
|
|
117
134
|
params(
|
|
118
135
|
namespace: String,
|
|
119
136
|
aggregate_by: T::Hash[Symbol, T.anything],
|
|
137
|
+
compute_attributes: T::Hash[Symbol, T.anything],
|
|
120
138
|
consistency: Turbopuffer::NamespaceQueryParams::Consistency::OrHash,
|
|
121
139
|
distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
|
|
122
140
|
exclude_attributes: T::Array[String],
|
|
@@ -124,6 +142,7 @@ module Turbopuffer
|
|
|
124
142
|
group_by: T::Array[T.anything],
|
|
125
143
|
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
|
126
144
|
limit: T.any(Integer, Turbopuffer::Limit::OrHash),
|
|
145
|
+
offset: Integer,
|
|
127
146
|
rank_by: T.anything,
|
|
128
147
|
top_k: Integer,
|
|
129
148
|
vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
|
|
@@ -135,6 +154,10 @@ module Turbopuffer
|
|
|
135
154
|
# Aggregations to compute over all documents in the namespace that match the
|
|
136
155
|
# filters.
|
|
137
156
|
aggregate_by: nil,
|
|
157
|
+
# Computes additional values on documents returned by a query. Each key is the
|
|
158
|
+
# name of the computed attribute; each value is an expression describing how to
|
|
159
|
+
# compute it.
|
|
160
|
+
compute_attributes: nil,
|
|
138
161
|
# The consistency level for a query.
|
|
139
162
|
consistency: nil,
|
|
140
163
|
# A function used to calculate vector similarity.
|
|
@@ -152,6 +175,9 @@ module Turbopuffer
|
|
|
152
175
|
include_attributes: nil,
|
|
153
176
|
# Limits the documents returned by a query.
|
|
154
177
|
limit: nil,
|
|
178
|
+
# Number of documents to skip before returning results. Supported only in v2
|
|
179
|
+
# queries with an explicit `rank_by` and `top_k` or `limit`.
|
|
180
|
+
offset: nil,
|
|
155
181
|
# How to rank the documents in the namespace.
|
|
156
182
|
rank_by: nil,
|
|
157
183
|
# The number of results to return.
|
|
@@ -167,6 +193,7 @@ module Turbopuffer
|
|
|
167
193
|
{
|
|
168
194
|
namespace: String,
|
|
169
195
|
aggregate_by: T::Hash[Symbol, T.anything],
|
|
196
|
+
compute_attributes: T::Hash[Symbol, T.anything],
|
|
170
197
|
consistency: Turbopuffer::NamespaceQueryParams::Consistency,
|
|
171
198
|
distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
|
|
172
199
|
exclude_attributes: T::Array[String],
|
|
@@ -174,6 +201,7 @@ module Turbopuffer
|
|
|
174
201
|
group_by: T::Array[T.anything],
|
|
175
202
|
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
|
176
203
|
limit: T.any(Integer, Turbopuffer::Limit),
|
|
204
|
+
offset: Integer,
|
|
177
205
|
rank_by: T.anything,
|
|
178
206
|
top_k: Integer,
|
|
179
207
|
vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Turbopuffer
|
|
4
|
+
module Models
|
|
5
|
+
class NamespaceStartCopyFromParams < Turbopuffer::Internal::Type::BaseModel
|
|
6
|
+
extend Turbopuffer::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include Turbopuffer::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Turbopuffer::NamespaceStartCopyFromParams,
|
|
13
|
+
Turbopuffer::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
sig { returns(T.nilable(String)) }
|
|
18
|
+
attr_reader :namespace
|
|
19
|
+
|
|
20
|
+
sig { params(namespace: String).void }
|
|
21
|
+
attr_writer :namespace
|
|
22
|
+
|
|
23
|
+
# The namespace to copy documents from.
|
|
24
|
+
sig { returns(String) }
|
|
25
|
+
attr_accessor :source_namespace
|
|
26
|
+
|
|
27
|
+
# (Optional) The encryption configuration for the destination namespace.
|
|
28
|
+
sig do
|
|
29
|
+
returns(
|
|
30
|
+
T.nilable(
|
|
31
|
+
T.any(
|
|
32
|
+
Turbopuffer::Encryption::CustomerManaged,
|
|
33
|
+
Turbopuffer::Encryption::Default
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
attr_reader :dest_encryption
|
|
39
|
+
|
|
40
|
+
sig do
|
|
41
|
+
params(
|
|
42
|
+
dest_encryption:
|
|
43
|
+
T.any(
|
|
44
|
+
Turbopuffer::Encryption::CustomerManaged::OrHash,
|
|
45
|
+
Turbopuffer::Encryption::Default::OrHash
|
|
46
|
+
)
|
|
47
|
+
).void
|
|
48
|
+
end
|
|
49
|
+
attr_writer :dest_encryption
|
|
50
|
+
|
|
51
|
+
# (Optional) An API key for the organization containing the source namespace
|
|
52
|
+
sig { returns(T.nilable(String)) }
|
|
53
|
+
attr_reader :source_api_key
|
|
54
|
+
|
|
55
|
+
sig { params(source_api_key: String).void }
|
|
56
|
+
attr_writer :source_api_key
|
|
57
|
+
|
|
58
|
+
# (Optional) The region of the source namespace.
|
|
59
|
+
sig { returns(T.nilable(String)) }
|
|
60
|
+
attr_reader :source_region
|
|
61
|
+
|
|
62
|
+
sig { params(source_region: String).void }
|
|
63
|
+
attr_writer :source_region
|
|
64
|
+
|
|
65
|
+
sig do
|
|
66
|
+
params(
|
|
67
|
+
source_namespace: String,
|
|
68
|
+
namespace: String,
|
|
69
|
+
dest_encryption:
|
|
70
|
+
T.any(
|
|
71
|
+
Turbopuffer::Encryption::CustomerManaged::OrHash,
|
|
72
|
+
Turbopuffer::Encryption::Default::OrHash
|
|
73
|
+
),
|
|
74
|
+
source_api_key: String,
|
|
75
|
+
source_region: String,
|
|
76
|
+
request_options: Turbopuffer::RequestOptions::OrHash
|
|
77
|
+
).returns(T.attached_class)
|
|
78
|
+
end
|
|
79
|
+
def self.new(
|
|
80
|
+
# The namespace to copy documents from.
|
|
81
|
+
source_namespace:,
|
|
82
|
+
namespace: nil,
|
|
83
|
+
# (Optional) The encryption configuration for the destination namespace.
|
|
84
|
+
dest_encryption: nil,
|
|
85
|
+
# (Optional) An API key for the organization containing the source namespace
|
|
86
|
+
source_api_key: nil,
|
|
87
|
+
# (Optional) The region of the source namespace.
|
|
88
|
+
source_region: nil,
|
|
89
|
+
request_options: {}
|
|
90
|
+
)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
sig do
|
|
94
|
+
override.returns(
|
|
95
|
+
{
|
|
96
|
+
namespace: String,
|
|
97
|
+
source_namespace: String,
|
|
98
|
+
dest_encryption:
|
|
99
|
+
T.any(
|
|
100
|
+
Turbopuffer::Encryption::CustomerManaged,
|
|
101
|
+
Turbopuffer::Encryption::Default
|
|
102
|
+
),
|
|
103
|
+
source_api_key: String,
|
|
104
|
+
source_region: String,
|
|
105
|
+
request_options: Turbopuffer::RequestOptions
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
end
|
|
109
|
+
def to_hash
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Turbopuffer
|
|
4
|
+
module Models
|
|
5
|
+
class NamespaceStartCopyFromResponse < Turbopuffer::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(
|
|
9
|
+
Turbopuffer::Models::NamespaceStartCopyFromResponse,
|
|
10
|
+
Turbopuffer::Internal::AnyHash
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# The token identifying the copy operation.
|
|
15
|
+
sig { returns(String) }
|
|
16
|
+
attr_accessor :token
|
|
17
|
+
|
|
18
|
+
sig { params(token: String).returns(T.attached_class) }
|
|
19
|
+
def self.new(
|
|
20
|
+
# The token identifying the copy operation.
|
|
21
|
+
token:
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
sig { override.returns({ token: String }) }
|
|
26
|
+
def to_hash
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -209,6 +209,16 @@ module Turbopuffer
|
|
|
209
209
|
end
|
|
210
210
|
attr_writer :schema
|
|
211
211
|
|
|
212
|
+
# Configuration for namespace sharding, which partitions a namespace's documents
|
|
213
|
+
# across multiple internal shards to scale indexing and query throughput beyond a
|
|
214
|
+
# single machine. Sharding can only be configured on a namespace's inaugural
|
|
215
|
+
# write, and cannot be added to or changed on an existing namespace.
|
|
216
|
+
sig { returns(T.nilable(Turbopuffer::ShardingConfig)) }
|
|
217
|
+
attr_reader :sharding
|
|
218
|
+
|
|
219
|
+
sig { params(sharding: Turbopuffer::ShardingConfig::OrHash).void }
|
|
220
|
+
attr_writer :sharding
|
|
221
|
+
|
|
212
222
|
# A list of documents in columnar format. Each key is a column name, mapped to an
|
|
213
223
|
# array of values for that column.
|
|
214
224
|
sig { returns(T.nilable(Turbopuffer::Columns)) }
|
|
@@ -267,6 +277,7 @@ module Turbopuffer
|
|
|
267
277
|
Symbol,
|
|
268
278
|
T.any(String, Turbopuffer::AttributeSchemaConfig::OrHash)
|
|
269
279
|
],
|
|
280
|
+
sharding: Turbopuffer::ShardingConfig::OrHash,
|
|
270
281
|
upsert_columns: Turbopuffer::Columns::OrHash,
|
|
271
282
|
upsert_condition: T.anything,
|
|
272
283
|
upsert_rows: T::Array[Turbopuffer::Row::OrHash],
|
|
@@ -310,6 +321,11 @@ module Turbopuffer
|
|
|
310
321
|
return_affected_ids: nil,
|
|
311
322
|
# The schema of the attributes attached to the documents.
|
|
312
323
|
schema: nil,
|
|
324
|
+
# Configuration for namespace sharding, which partitions a namespace's documents
|
|
325
|
+
# across multiple internal shards to scale indexing and query throughput beyond a
|
|
326
|
+
# single machine. Sharding can only be configured on a namespace's inaugural
|
|
327
|
+
# write, and cannot be added to or changed on an existing namespace.
|
|
328
|
+
sharding: nil,
|
|
313
329
|
# A list of documents in columnar format. Each key is a column name, mapped to an
|
|
314
330
|
# array of values for that column.
|
|
315
331
|
upsert_columns: nil,
|
|
@@ -357,6 +373,7 @@ module Turbopuffer
|
|
|
357
373
|
Symbol,
|
|
358
374
|
T.any(String, Turbopuffer::AttributeSchemaConfig)
|
|
359
375
|
],
|
|
376
|
+
sharding: Turbopuffer::ShardingConfig,
|
|
360
377
|
upsert_columns: Turbopuffer::Columns,
|
|
361
378
|
upsert_condition: T.anything,
|
|
362
379
|
upsert_rows: T::Array[Turbopuffer::Row],
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Turbopuffer
|
|
4
|
+
module Models
|
|
5
|
+
class OperationError < Turbopuffer::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(Turbopuffer::OperationError, Turbopuffer::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# The response to an unsuccessful request.
|
|
12
|
+
sig { returns(Turbopuffer::OperationError::Detail) }
|
|
13
|
+
attr_reader :detail
|
|
14
|
+
|
|
15
|
+
sig { params(detail: Turbopuffer::OperationError::Detail::OrHash).void }
|
|
16
|
+
attr_writer :detail
|
|
17
|
+
|
|
18
|
+
# The HTTP status code of the operation's error.
|
|
19
|
+
sig { returns(Integer) }
|
|
20
|
+
attr_accessor :status_code
|
|
21
|
+
|
|
22
|
+
sig do
|
|
23
|
+
params(
|
|
24
|
+
detail: Turbopuffer::OperationError::Detail::OrHash,
|
|
25
|
+
status_code: Integer
|
|
26
|
+
).returns(T.attached_class)
|
|
27
|
+
end
|
|
28
|
+
def self.new(
|
|
29
|
+
# The response to an unsuccessful request.
|
|
30
|
+
detail:,
|
|
31
|
+
# The HTTP status code of the operation's error.
|
|
32
|
+
status_code:
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
sig do
|
|
37
|
+
override.returns(
|
|
38
|
+
{ detail: Turbopuffer::OperationError::Detail, status_code: Integer }
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
def to_hash
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class Detail < Turbopuffer::Internal::Type::BaseModel
|
|
45
|
+
OrHash =
|
|
46
|
+
T.type_alias do
|
|
47
|
+
T.any(
|
|
48
|
+
Turbopuffer::OperationError::Detail,
|
|
49
|
+
Turbopuffer::Internal::AnyHash
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# The error message.
|
|
54
|
+
sig { returns(String) }
|
|
55
|
+
attr_accessor :error
|
|
56
|
+
|
|
57
|
+
# The status of the request.
|
|
58
|
+
sig { returns(Symbol) }
|
|
59
|
+
attr_accessor :status
|
|
60
|
+
|
|
61
|
+
# The response to an unsuccessful request.
|
|
62
|
+
sig { params(error: String, status: Symbol).returns(T.attached_class) }
|
|
63
|
+
def self.new(
|
|
64
|
+
# The error message.
|
|
65
|
+
error:,
|
|
66
|
+
# The status of the request.
|
|
67
|
+
status: :error
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
sig { override.returns({ error: String, status: Symbol }) }
|
|
72
|
+
def to_hash
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Turbopuffer
|
|
4
|
+
module Models
|
|
5
|
+
class RerankLimit < Turbopuffer::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(Turbopuffer::RerankLimit, Turbopuffer::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# Limits the total number of documents returned after reranking.
|
|
12
|
+
sig { returns(Integer) }
|
|
13
|
+
attr_accessor :total
|
|
14
|
+
|
|
15
|
+
# Limits the total number of reranked documents returned.
|
|
16
|
+
sig { params(total: Integer).returns(T.attached_class) }
|
|
17
|
+
def self.new(
|
|
18
|
+
# Limits the total number of documents returned after reranking.
|
|
19
|
+
total:
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
sig { override.returns({ total: Integer }) }
|
|
24
|
+
def to_hash
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -15,15 +15,34 @@ module Turbopuffer
|
|
|
15
15
|
sig { params(rank_constant: Integer).void }
|
|
16
16
|
attr_writer :rank_constant
|
|
17
17
|
|
|
18
|
+
# A positive weight for each subquery, in the same order as `queries`. The number
|
|
19
|
+
# of weights must match the number of subqueries. When omitted, every subquery has
|
|
20
|
+
# a weight of `1`.
|
|
21
|
+
sig { returns(T.nilable(T::Array[Float])) }
|
|
22
|
+
attr_reader :weights
|
|
23
|
+
|
|
24
|
+
sig { params(weights: T::Array[Float]).void }
|
|
25
|
+
attr_writer :weights
|
|
26
|
+
|
|
18
27
|
# Configuration options for RRF.
|
|
19
|
-
sig
|
|
28
|
+
sig do
|
|
29
|
+
params(rank_constant: Integer, weights: T::Array[Float]).returns(
|
|
30
|
+
T.attached_class
|
|
31
|
+
)
|
|
32
|
+
end
|
|
20
33
|
def self.new(
|
|
21
34
|
# RRF rank constant (`k`). Must be greater than zero. Defaults to `60`.
|
|
22
|
-
rank_constant: nil
|
|
35
|
+
rank_constant: nil,
|
|
36
|
+
# A positive weight for each subquery, in the same order as `queries`. The number
|
|
37
|
+
# of weights must match the number of subqueries. When omitted, every subquery has
|
|
38
|
+
# a weight of `1`.
|
|
39
|
+
weights: nil
|
|
23
40
|
)
|
|
24
41
|
end
|
|
25
42
|
|
|
26
|
-
sig
|
|
43
|
+
sig do
|
|
44
|
+
override.returns({ rank_constant: Integer, weights: T::Array[Float] })
|
|
45
|
+
end
|
|
27
46
|
def to_hash
|
|
28
47
|
end
|
|
29
48
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Turbopuffer
|
|
4
|
+
module Models
|
|
5
|
+
class ShardingConfig < Turbopuffer::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(Turbopuffer::ShardingConfig, Turbopuffer::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# The number of shards to partition the namespace into.
|
|
12
|
+
sig { returns(Integer) }
|
|
13
|
+
attr_accessor :num_shards
|
|
14
|
+
|
|
15
|
+
# Configuration for namespace sharding, which partitions a namespace's documents
|
|
16
|
+
# across multiple internal shards to scale indexing and query throughput beyond a
|
|
17
|
+
# single machine. Sharding can only be configured on a namespace's inaugural
|
|
18
|
+
# write, and cannot be added to or changed on an existing namespace.
|
|
19
|
+
sig { params(num_shards: Integer).returns(T.attached_class) }
|
|
20
|
+
def self.new(
|
|
21
|
+
# The number of shards to partition the namespace into.
|
|
22
|
+
num_shards:
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
sig { override.returns({ num_shards: Integer }) }
|
|
27
|
+
def to_hash
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|