turbopuffer 2.4.0 → 2.6.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 +28 -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.rb +4 -1
- data/lib/turbopuffer/models/attribute_schema_drop.rb +19 -0
- 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/namespace_explain_query_params.rb +10 -1
- data/lib/turbopuffer/models/namespace_metadata.rb +21 -2
- data/lib/turbopuffer/models/namespace_metadata_patch.rb +10 -1
- data/lib/turbopuffer/models/namespace_multi_query_params.rb +45 -2
- data/lib/turbopuffer/models/namespace_poll_copy_from_params.rb +26 -0
- data/lib/turbopuffer/models/namespace_query_params.rb +10 -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_update_schema_params.rb +2 -2
- data/lib/turbopuffer/models/namespace_write_params.rb +15 -3
- data/lib/turbopuffer/models/operation_error.rb +46 -0
- data/lib/turbopuffer/models/rerank_limit.rb +18 -0
- data/lib/turbopuffer/models/write_result.rb +112 -0
- data/lib/turbopuffer/models.rb +16 -0
- data/lib/turbopuffer/resources/namespaces.rb +85 -7
- data/lib/turbopuffer/version.rb +1 -1
- data/lib/turbopuffer.rb +9 -0
- data/rbi/turbopuffer/client.rbi +2 -2
- data/rbi/turbopuffer/models/attribute_schema.rbi +7 -1
- data/rbi/turbopuffer/models/attribute_schema_drop.rbi +32 -0
- 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/namespace_explain_query_params.rbi +13 -0
- data/rbi/turbopuffer/models/namespace_metadata.rbi +30 -1
- data/rbi/turbopuffer/models/namespace_metadata_patch.rbi +18 -3
- data/rbi/turbopuffer/models/namespace_multi_query_params.rbi +54 -0
- data/rbi/turbopuffer/models/namespace_poll_copy_from_params.rbi +49 -0
- data/rbi/turbopuffer/models/namespace_query_params.rbi +13 -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_update_schema_params.rbi +23 -4
- data/rbi/turbopuffer/models/namespace_write_params.rbi +42 -4
- data/rbi/turbopuffer/models/operation_error.rbi +77 -0
- data/rbi/turbopuffer/models/rerank_limit.rbi +28 -0
- data/rbi/turbopuffer/models/write_result.rbi +159 -0
- data/rbi/turbopuffer/models.rbi +18 -0
- data/rbi/turbopuffer/resources/namespaces.rbi +88 -2
- data/sig/turbopuffer/models/attribute_schema.rbs +4 -1
- data/sig/turbopuffer/models/attribute_schema_drop.rbs +13 -0
- 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/namespace_explain_query_params.rbs +7 -0
- data/sig/turbopuffer/models/namespace_metadata.rbs +17 -1
- data/sig/turbopuffer/models/namespace_metadata_patch.rbs +12 -3
- data/sig/turbopuffer/models/namespace_multi_query_params.rbs +31 -0
- data/sig/turbopuffer/models/namespace_poll_copy_from_params.rbs +30 -0
- data/sig/turbopuffer/models/namespace_query_params.rbs +7 -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 +7 -0
- data/sig/turbopuffer/models/operation_error.rbs +34 -0
- data/sig/turbopuffer/models/rerank_limit.rbs +13 -0
- data/sig/turbopuffer/models/write_result.rbs +99 -0
- data/sig/turbopuffer/models.rbs +16 -0
- data/sig/turbopuffer/resources/namespaces.rbs +21 -0
- metadata +29 -2
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Turbopuffer
|
|
4
|
+
module Models
|
|
5
|
+
# The current status of a copy operation.
|
|
6
|
+
module CopyFromNamespaceOperation
|
|
7
|
+
extend Turbopuffer::Internal::Type::Union
|
|
8
|
+
|
|
9
|
+
Variants =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Turbopuffer::CopyFromNamespaceOperation::Running,
|
|
13
|
+
Turbopuffer::CopyFromNamespaceOperation::Finished
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Running < Turbopuffer::Internal::Type::BaseModel
|
|
18
|
+
OrHash =
|
|
19
|
+
T.type_alias do
|
|
20
|
+
T.any(
|
|
21
|
+
Turbopuffer::CopyFromNamespaceOperation::Running,
|
|
22
|
+
Turbopuffer::Internal::AnyHash
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# The time at which the operation started.
|
|
27
|
+
sig { returns(Time) }
|
|
28
|
+
attr_accessor :start_time
|
|
29
|
+
|
|
30
|
+
sig { returns(Symbol) }
|
|
31
|
+
attr_accessor :status
|
|
32
|
+
|
|
33
|
+
# A freeform description of the operation's progress. May be absent, and its
|
|
34
|
+
# format may change.
|
|
35
|
+
sig { returns(T.nilable(String)) }
|
|
36
|
+
attr_reader :progress
|
|
37
|
+
|
|
38
|
+
sig { params(progress: String).void }
|
|
39
|
+
attr_writer :progress
|
|
40
|
+
|
|
41
|
+
sig do
|
|
42
|
+
params(start_time: Time, progress: String, status: Symbol).returns(
|
|
43
|
+
T.attached_class
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
def self.new(
|
|
47
|
+
# The time at which the operation started.
|
|
48
|
+
start_time:,
|
|
49
|
+
# A freeform description of the operation's progress. May be absent, and its
|
|
50
|
+
# format may change.
|
|
51
|
+
progress: nil,
|
|
52
|
+
status: :running
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
sig do
|
|
57
|
+
override.returns(
|
|
58
|
+
{ start_time: Time, status: Symbol, progress: String }
|
|
59
|
+
)
|
|
60
|
+
end
|
|
61
|
+
def to_hash
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
class Finished < Turbopuffer::Internal::Type::BaseModel
|
|
66
|
+
OrHash =
|
|
67
|
+
T.type_alias do
|
|
68
|
+
T.any(
|
|
69
|
+
Turbopuffer::CopyFromNamespaceOperation::Finished,
|
|
70
|
+
Turbopuffer::Internal::AnyHash
|
|
71
|
+
)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# The time at which the operation finished.
|
|
75
|
+
sig { returns(Time) }
|
|
76
|
+
attr_accessor :finish_time
|
|
77
|
+
|
|
78
|
+
sig { returns(Turbopuffer::CopyFromNamespaceOperationResult::Variants) }
|
|
79
|
+
attr_accessor :result
|
|
80
|
+
|
|
81
|
+
# The time at which the operation started.
|
|
82
|
+
sig { returns(Time) }
|
|
83
|
+
attr_accessor :start_time
|
|
84
|
+
|
|
85
|
+
sig { returns(Symbol) }
|
|
86
|
+
attr_accessor :status
|
|
87
|
+
|
|
88
|
+
sig do
|
|
89
|
+
params(
|
|
90
|
+
finish_time: Time,
|
|
91
|
+
result:
|
|
92
|
+
T.any(
|
|
93
|
+
Turbopuffer::CopyFromNamespaceOperationResult::Success::OrHash,
|
|
94
|
+
Turbopuffer::CopyFromNamespaceOperationResult::Error::OrHash
|
|
95
|
+
),
|
|
96
|
+
start_time: Time,
|
|
97
|
+
status: Symbol
|
|
98
|
+
).returns(T.attached_class)
|
|
99
|
+
end
|
|
100
|
+
def self.new(
|
|
101
|
+
# The time at which the operation finished.
|
|
102
|
+
finish_time:,
|
|
103
|
+
result:,
|
|
104
|
+
# The time at which the operation started.
|
|
105
|
+
start_time:,
|
|
106
|
+
status: :finished
|
|
107
|
+
)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
sig do
|
|
111
|
+
override.returns(
|
|
112
|
+
{
|
|
113
|
+
finish_time: Time,
|
|
114
|
+
result: Turbopuffer::CopyFromNamespaceOperationResult::Variants,
|
|
115
|
+
start_time: Time,
|
|
116
|
+
status: Symbol
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
end
|
|
120
|
+
def to_hash
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
sig do
|
|
125
|
+
override.returns(
|
|
126
|
+
T::Array[Turbopuffer::CopyFromNamespaceOperation::Variants]
|
|
127
|
+
)
|
|
128
|
+
end
|
|
129
|
+
def self.variants
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Turbopuffer
|
|
4
|
+
module Models
|
|
5
|
+
module CopyFromNamespaceOperationResult
|
|
6
|
+
extend Turbopuffer::Internal::Type::Union
|
|
7
|
+
|
|
8
|
+
Variants =
|
|
9
|
+
T.type_alias do
|
|
10
|
+
T.any(
|
|
11
|
+
Turbopuffer::CopyFromNamespaceOperationResult::Success,
|
|
12
|
+
Turbopuffer::CopyFromNamespaceOperationResult::Error
|
|
13
|
+
)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class Success < Turbopuffer::Internal::Type::BaseModel
|
|
17
|
+
OrHash =
|
|
18
|
+
T.type_alias do
|
|
19
|
+
T.any(
|
|
20
|
+
Turbopuffer::CopyFromNamespaceOperationResult::Success,
|
|
21
|
+
Turbopuffer::Internal::AnyHash
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# The response to a successful write request.
|
|
26
|
+
sig { returns(Turbopuffer::WriteResult) }
|
|
27
|
+
attr_reader :success
|
|
28
|
+
|
|
29
|
+
sig { params(success: Turbopuffer::WriteResult::OrHash).void }
|
|
30
|
+
attr_writer :success
|
|
31
|
+
|
|
32
|
+
sig do
|
|
33
|
+
params(success: Turbopuffer::WriteResult::OrHash).returns(
|
|
34
|
+
T.attached_class
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
def self.new(
|
|
38
|
+
# The response to a successful write request.
|
|
39
|
+
success:
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
sig { override.returns({ success: Turbopuffer::WriteResult }) }
|
|
44
|
+
def to_hash
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
class Error < Turbopuffer::Internal::Type::BaseModel
|
|
49
|
+
OrHash =
|
|
50
|
+
T.type_alias do
|
|
51
|
+
T.any(
|
|
52
|
+
Turbopuffer::CopyFromNamespaceOperationResult::Error,
|
|
53
|
+
Turbopuffer::Internal::AnyHash
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
sig { returns(Turbopuffer::OperationError) }
|
|
58
|
+
attr_reader :error
|
|
59
|
+
|
|
60
|
+
sig { params(error: Turbopuffer::OperationError::OrHash).void }
|
|
61
|
+
attr_writer :error
|
|
62
|
+
|
|
63
|
+
sig do
|
|
64
|
+
params(error: Turbopuffer::OperationError::OrHash).returns(
|
|
65
|
+
T.attached_class
|
|
66
|
+
)
|
|
67
|
+
end
|
|
68
|
+
def self.new(error:)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
sig { override.returns({ error: Turbopuffer::OperationError }) }
|
|
72
|
+
def to_hash
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
sig do
|
|
77
|
+
override.returns(
|
|
78
|
+
T::Array[Turbopuffer::CopyFromNamespaceOperationResult::Variants]
|
|
79
|
+
)
|
|
80
|
+
end
|
|
81
|
+
def self.variants
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -104,6 +104,14 @@ module Turbopuffer
|
|
|
104
104
|
sig { params(limit: T.any(Integer, Turbopuffer::Limit::OrHash)).void }
|
|
105
105
|
attr_writer :limit
|
|
106
106
|
|
|
107
|
+
# Number of documents to skip before returning results. Supported only in v2
|
|
108
|
+
# queries with an explicit `rank_by` and `top_k` or `limit`.
|
|
109
|
+
sig { returns(T.nilable(Integer)) }
|
|
110
|
+
attr_reader :offset
|
|
111
|
+
|
|
112
|
+
sig { params(offset: Integer).void }
|
|
113
|
+
attr_writer :offset
|
|
114
|
+
|
|
107
115
|
# How to rank the documents in the namespace.
|
|
108
116
|
sig { returns(T.nilable(T.anything)) }
|
|
109
117
|
attr_reader :rank_by
|
|
@@ -140,6 +148,7 @@ module Turbopuffer
|
|
|
140
148
|
group_by: T::Array[T.anything],
|
|
141
149
|
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
|
142
150
|
limit: T.any(Integer, Turbopuffer::Limit::OrHash),
|
|
151
|
+
offset: Integer,
|
|
143
152
|
rank_by: T.anything,
|
|
144
153
|
top_k: Integer,
|
|
145
154
|
vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
|
|
@@ -172,6 +181,9 @@ module Turbopuffer
|
|
|
172
181
|
include_attributes: nil,
|
|
173
182
|
# Limits the documents returned by a query.
|
|
174
183
|
limit: nil,
|
|
184
|
+
# Number of documents to skip before returning results. Supported only in v2
|
|
185
|
+
# queries with an explicit `rank_by` and `top_k` or `limit`.
|
|
186
|
+
offset: nil,
|
|
175
187
|
# How to rank the documents in the namespace.
|
|
176
188
|
rank_by: nil,
|
|
177
189
|
# The number of results to return.
|
|
@@ -195,6 +207,7 @@ module Turbopuffer
|
|
|
195
207
|
group_by: T::Array[T.anything],
|
|
196
208
|
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
|
197
209
|
limit: T.any(Integer, Turbopuffer::Limit),
|
|
210
|
+
offset: Integer,
|
|
198
211
|
rank_by: T.anything,
|
|
199
212
|
top_k: Integer,
|
|
200
213
|
vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
|
|
@@ -45,6 +45,13 @@ module Turbopuffer
|
|
|
45
45
|
end
|
|
46
46
|
attr_writer :pinning
|
|
47
47
|
|
|
48
|
+
# Whether document and schema writes are rejected. Omitted when `false`.
|
|
49
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
50
|
+
attr_reader :read_only
|
|
51
|
+
|
|
52
|
+
sig { params(read_only: T::Boolean).void }
|
|
53
|
+
attr_writer :read_only
|
|
54
|
+
|
|
48
55
|
# Configuration for namespace sharding, which partitions a namespace's documents
|
|
49
56
|
# across multiple internal shards to scale indexing and query throughput beyond a
|
|
50
57
|
# single machine. Sharding can only be configured on a namespace's inaugural
|
|
@@ -74,6 +81,7 @@ module Turbopuffer
|
|
|
74
81
|
schema: T::Hash[Symbol, Turbopuffer::AttributeSchemaConfig::OrHash],
|
|
75
82
|
updated_at: Time,
|
|
76
83
|
pinning: Turbopuffer::NamespaceMetadata::Pinning::OrHash,
|
|
84
|
+
read_only: T::Boolean,
|
|
77
85
|
sharding: Turbopuffer::ShardingConfig::OrHash
|
|
78
86
|
).returns(T.attached_class)
|
|
79
87
|
end
|
|
@@ -94,6 +102,8 @@ module Turbopuffer
|
|
|
94
102
|
# Configuration for namespace pinning, along with the current status of the pinned
|
|
95
103
|
# namespace.
|
|
96
104
|
pinning: nil,
|
|
105
|
+
# Whether document and schema writes are rejected. Omitted when `false`.
|
|
106
|
+
read_only: nil,
|
|
97
107
|
# Configuration for namespace sharding, which partitions a namespace's documents
|
|
98
108
|
# across multiple internal shards to scale indexing and query throughput beyond a
|
|
99
109
|
# single machine. Sharding can only be configured on a namespace's inaugural
|
|
@@ -113,6 +123,7 @@ module Turbopuffer
|
|
|
113
123
|
schema: T::Hash[Symbol, Turbopuffer::AttributeSchemaConfig],
|
|
114
124
|
updated_at: Time,
|
|
115
125
|
pinning: Turbopuffer::NamespaceMetadata::Pinning,
|
|
126
|
+
read_only: T::Boolean,
|
|
116
127
|
sharding: Turbopuffer::ShardingConfig
|
|
117
128
|
}
|
|
118
129
|
)
|
|
@@ -252,6 +263,13 @@ module Turbopuffer
|
|
|
252
263
|
sig { returns(Integer) }
|
|
253
264
|
attr_accessor :ready_replicas
|
|
254
265
|
|
|
266
|
+
# The number of running replicas for the namespace. Replicas are billed once
|
|
267
|
+
# running, even before they finish warming their caches and become ready to serve
|
|
268
|
+
# traffic. This count is updated independently and may briefly disagree with the
|
|
269
|
+
# other status fields.
|
|
270
|
+
sig { returns(Integer) }
|
|
271
|
+
attr_accessor :replicas
|
|
272
|
+
|
|
255
273
|
# The timestamp of the latest pinning status snapshot.
|
|
256
274
|
sig { returns(Time) }
|
|
257
275
|
attr_accessor :updated_at
|
|
@@ -265,6 +283,7 @@ module Turbopuffer
|
|
|
265
283
|
sig do
|
|
266
284
|
params(
|
|
267
285
|
ready_replicas: Integer,
|
|
286
|
+
replicas: Integer,
|
|
268
287
|
updated_at: Time,
|
|
269
288
|
utilization: Float
|
|
270
289
|
).returns(T.attached_class)
|
|
@@ -272,6 +291,11 @@ module Turbopuffer
|
|
|
272
291
|
def self.new(
|
|
273
292
|
# The number of replicas that are warm and serving traffic.
|
|
274
293
|
ready_replicas:,
|
|
294
|
+
# The number of running replicas for the namespace. Replicas are billed once
|
|
295
|
+
# running, even before they finish warming their caches and become ready to serve
|
|
296
|
+
# traffic. This count is updated independently and may briefly disagree with the
|
|
297
|
+
# other status fields.
|
|
298
|
+
replicas:,
|
|
275
299
|
# The timestamp of the latest pinning status snapshot.
|
|
276
300
|
updated_at:,
|
|
277
301
|
# Aggregate utilization for the pinned namespace, reported as a value between 0.0
|
|
@@ -282,7 +306,12 @@ module Turbopuffer
|
|
|
282
306
|
|
|
283
307
|
sig do
|
|
284
308
|
override.returns(
|
|
285
|
-
{
|
|
309
|
+
{
|
|
310
|
+
ready_replicas: Integer,
|
|
311
|
+
replicas: Integer,
|
|
312
|
+
updated_at: Time,
|
|
313
|
+
utilization: Float
|
|
314
|
+
}
|
|
286
315
|
)
|
|
287
316
|
end
|
|
288
317
|
def to_hash
|
|
@@ -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
|
|
@@ -170,6 +196,14 @@ module Turbopuffer
|
|
|
170
196
|
sig { params(limit: T.any(Integer, Turbopuffer::Limit::OrHash)).void }
|
|
171
197
|
attr_writer :limit
|
|
172
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
|
+
|
|
173
207
|
# How to rank the documents in the namespace.
|
|
174
208
|
sig { returns(T.nilable(T.anything)) }
|
|
175
209
|
attr_reader :rank_by
|
|
@@ -195,6 +229,7 @@ module Turbopuffer
|
|
|
195
229
|
group_by: T::Array[T.anything],
|
|
196
230
|
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
|
197
231
|
limit: T.any(Integer, Turbopuffer::Limit::OrHash),
|
|
232
|
+
offset: Integer,
|
|
198
233
|
rank_by: T.anything,
|
|
199
234
|
top_k: Integer
|
|
200
235
|
).returns(T.attached_class)
|
|
@@ -222,6 +257,9 @@ module Turbopuffer
|
|
|
222
257
|
include_attributes: nil,
|
|
223
258
|
# Limits the documents returned by a query.
|
|
224
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,
|
|
225
263
|
# How to rank the documents in the namespace.
|
|
226
264
|
rank_by: nil,
|
|
227
265
|
# The number of results to return.
|
|
@@ -240,6 +278,7 @@ module Turbopuffer
|
|
|
240
278
|
group_by: T::Array[T.anything],
|
|
241
279
|
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
|
242
280
|
limit: T.any(Integer, Turbopuffer::Limit),
|
|
281
|
+
offset: Integer,
|
|
243
282
|
rank_by: T.anything,
|
|
244
283
|
top_k: Integer
|
|
245
284
|
}
|
|
@@ -355,6 +394,21 @@ module Turbopuffer
|
|
|
355
394
|
end
|
|
356
395
|
end
|
|
357
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
|
|
358
412
|
end
|
|
359
413
|
end
|
|
360
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
|
|
@@ -99,6 +99,14 @@ module Turbopuffer
|
|
|
99
99
|
sig { params(limit: T.any(Integer, Turbopuffer::Limit::OrHash)).void }
|
|
100
100
|
attr_writer :limit
|
|
101
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
|
+
|
|
102
110
|
# How to rank the documents in the namespace.
|
|
103
111
|
sig { returns(T.nilable(T.anything)) }
|
|
104
112
|
attr_reader :rank_by
|
|
@@ -134,6 +142,7 @@ module Turbopuffer
|
|
|
134
142
|
group_by: T::Array[T.anything],
|
|
135
143
|
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
|
136
144
|
limit: T.any(Integer, Turbopuffer::Limit::OrHash),
|
|
145
|
+
offset: Integer,
|
|
137
146
|
rank_by: T.anything,
|
|
138
147
|
top_k: Integer,
|
|
139
148
|
vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
|
|
@@ -166,6 +175,9 @@ module Turbopuffer
|
|
|
166
175
|
include_attributes: nil,
|
|
167
176
|
# Limits the documents returned by a query.
|
|
168
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,
|
|
169
181
|
# How to rank the documents in the namespace.
|
|
170
182
|
rank_by: nil,
|
|
171
183
|
# The number of results to return.
|
|
@@ -189,6 +201,7 @@ module Turbopuffer
|
|
|
189
201
|
group_by: T::Array[T.anything],
|
|
190
202
|
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
|
191
203
|
limit: T.any(Integer, Turbopuffer::Limit),
|
|
204
|
+
offset: Integer,
|
|
192
205
|
rank_by: T.anything,
|
|
193
206
|
top_k: Integer,
|
|
194
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
|