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
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Turbopuffer
|
|
4
|
+
module Models
|
|
5
|
+
class WriteResult < Turbopuffer::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(Turbopuffer::WriteResult, Turbopuffer::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# The billing information for a write request.
|
|
12
|
+
sig { returns(Turbopuffer::WriteBilling) }
|
|
13
|
+
attr_reader :billing
|
|
14
|
+
|
|
15
|
+
sig { params(billing: Turbopuffer::WriteBilling::OrHash).void }
|
|
16
|
+
attr_writer :billing
|
|
17
|
+
|
|
18
|
+
# A message describing the result of the write request.
|
|
19
|
+
sig { returns(String) }
|
|
20
|
+
attr_accessor :message
|
|
21
|
+
|
|
22
|
+
# The number of rows affected by the write request.
|
|
23
|
+
sig { returns(Integer) }
|
|
24
|
+
attr_accessor :rows_affected
|
|
25
|
+
|
|
26
|
+
# The status of the request.
|
|
27
|
+
sig { returns(Symbol) }
|
|
28
|
+
attr_accessor :status
|
|
29
|
+
|
|
30
|
+
# The IDs of documents that were deleted. Only included when `return_affected_ids`
|
|
31
|
+
# is true and at least one document was deleted.
|
|
32
|
+
sig { returns(T.nilable(T::Array[Turbopuffer::ID::Variants])) }
|
|
33
|
+
attr_reader :deleted_ids
|
|
34
|
+
|
|
35
|
+
sig { params(deleted_ids: T::Array[Turbopuffer::ID::Variants]).void }
|
|
36
|
+
attr_writer :deleted_ids
|
|
37
|
+
|
|
38
|
+
# The IDs of documents that were patched. Only included when `return_affected_ids`
|
|
39
|
+
# is true and at least one document was patched.
|
|
40
|
+
sig { returns(T.nilable(T::Array[Turbopuffer::ID::Variants])) }
|
|
41
|
+
attr_reader :patched_ids
|
|
42
|
+
|
|
43
|
+
sig { params(patched_ids: T::Array[Turbopuffer::ID::Variants]).void }
|
|
44
|
+
attr_writer :patched_ids
|
|
45
|
+
|
|
46
|
+
# The performance information for a write request.
|
|
47
|
+
sig { returns(T.nilable(Turbopuffer::WritePerformance)) }
|
|
48
|
+
attr_reader :performance
|
|
49
|
+
|
|
50
|
+
sig { params(performance: Turbopuffer::WritePerformance::OrHash).void }
|
|
51
|
+
attr_writer :performance
|
|
52
|
+
|
|
53
|
+
# The number of rows deleted by the write request.
|
|
54
|
+
sig { returns(T.nilable(Integer)) }
|
|
55
|
+
attr_reader :rows_deleted
|
|
56
|
+
|
|
57
|
+
sig { params(rows_deleted: Integer).void }
|
|
58
|
+
attr_writer :rows_deleted
|
|
59
|
+
|
|
60
|
+
# The number of rows patched by the write request.
|
|
61
|
+
sig { returns(T.nilable(Integer)) }
|
|
62
|
+
attr_reader :rows_patched
|
|
63
|
+
|
|
64
|
+
sig { params(rows_patched: Integer).void }
|
|
65
|
+
attr_writer :rows_patched
|
|
66
|
+
|
|
67
|
+
# Whether more documents match the filter for partial operations.
|
|
68
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
69
|
+
attr_reader :rows_remaining
|
|
70
|
+
|
|
71
|
+
sig { params(rows_remaining: T::Boolean).void }
|
|
72
|
+
attr_writer :rows_remaining
|
|
73
|
+
|
|
74
|
+
# The number of rows upserted by the write request.
|
|
75
|
+
sig { returns(T.nilable(Integer)) }
|
|
76
|
+
attr_reader :rows_upserted
|
|
77
|
+
|
|
78
|
+
sig { params(rows_upserted: Integer).void }
|
|
79
|
+
attr_writer :rows_upserted
|
|
80
|
+
|
|
81
|
+
# The IDs of documents that were upserted. Only included when
|
|
82
|
+
# `return_affected_ids` is true and at least one document was upserted.
|
|
83
|
+
sig { returns(T.nilable(T::Array[Turbopuffer::ID::Variants])) }
|
|
84
|
+
attr_reader :upserted_ids
|
|
85
|
+
|
|
86
|
+
sig { params(upserted_ids: T::Array[Turbopuffer::ID::Variants]).void }
|
|
87
|
+
attr_writer :upserted_ids
|
|
88
|
+
|
|
89
|
+
# The response to a successful write request.
|
|
90
|
+
sig do
|
|
91
|
+
params(
|
|
92
|
+
billing: Turbopuffer::WriteBilling::OrHash,
|
|
93
|
+
message: String,
|
|
94
|
+
rows_affected: Integer,
|
|
95
|
+
deleted_ids: T::Array[Turbopuffer::ID::Variants],
|
|
96
|
+
patched_ids: T::Array[Turbopuffer::ID::Variants],
|
|
97
|
+
performance: Turbopuffer::WritePerformance::OrHash,
|
|
98
|
+
rows_deleted: Integer,
|
|
99
|
+
rows_patched: Integer,
|
|
100
|
+
rows_remaining: T::Boolean,
|
|
101
|
+
rows_upserted: Integer,
|
|
102
|
+
upserted_ids: T::Array[Turbopuffer::ID::Variants],
|
|
103
|
+
status: Symbol
|
|
104
|
+
).returns(T.attached_class)
|
|
105
|
+
end
|
|
106
|
+
def self.new(
|
|
107
|
+
# The billing information for a write request.
|
|
108
|
+
billing:,
|
|
109
|
+
# A message describing the result of the write request.
|
|
110
|
+
message:,
|
|
111
|
+
# The number of rows affected by the write request.
|
|
112
|
+
rows_affected:,
|
|
113
|
+
# The IDs of documents that were deleted. Only included when `return_affected_ids`
|
|
114
|
+
# is true and at least one document was deleted.
|
|
115
|
+
deleted_ids: nil,
|
|
116
|
+
# The IDs of documents that were patched. Only included when `return_affected_ids`
|
|
117
|
+
# is true and at least one document was patched.
|
|
118
|
+
patched_ids: nil,
|
|
119
|
+
# The performance information for a write request.
|
|
120
|
+
performance: nil,
|
|
121
|
+
# The number of rows deleted by the write request.
|
|
122
|
+
rows_deleted: nil,
|
|
123
|
+
# The number of rows patched by the write request.
|
|
124
|
+
rows_patched: nil,
|
|
125
|
+
# Whether more documents match the filter for partial operations.
|
|
126
|
+
rows_remaining: nil,
|
|
127
|
+
# The number of rows upserted by the write request.
|
|
128
|
+
rows_upserted: nil,
|
|
129
|
+
# The IDs of documents that were upserted. Only included when
|
|
130
|
+
# `return_affected_ids` is true and at least one document was upserted.
|
|
131
|
+
upserted_ids: nil,
|
|
132
|
+
# The status of the request.
|
|
133
|
+
status: :OK
|
|
134
|
+
)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
sig do
|
|
138
|
+
override.returns(
|
|
139
|
+
{
|
|
140
|
+
billing: Turbopuffer::WriteBilling,
|
|
141
|
+
message: String,
|
|
142
|
+
rows_affected: Integer,
|
|
143
|
+
status: Symbol,
|
|
144
|
+
deleted_ids: T::Array[Turbopuffer::ID::Variants],
|
|
145
|
+
patched_ids: T::Array[Turbopuffer::ID::Variants],
|
|
146
|
+
performance: Turbopuffer::WritePerformance,
|
|
147
|
+
rows_deleted: Integer,
|
|
148
|
+
rows_patched: Integer,
|
|
149
|
+
rows_remaining: T::Boolean,
|
|
150
|
+
rows_upserted: Integer,
|
|
151
|
+
upserted_ids: T::Array[Turbopuffer::ID::Variants]
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
end
|
|
155
|
+
def to_hash
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
data/rbi/turbopuffer/models.rbi
CHANGED
|
@@ -31,6 +31,11 @@ module Turbopuffer
|
|
|
31
31
|
ContainsAnyTokenFilterParams =
|
|
32
32
|
Turbopuffer::Models::ContainsAnyTokenFilterParams
|
|
33
33
|
|
|
34
|
+
CopyFromNamespaceOperation = Turbopuffer::Models::CopyFromNamespaceOperation
|
|
35
|
+
|
|
36
|
+
CopyFromNamespaceOperationResult =
|
|
37
|
+
Turbopuffer::Models::CopyFromNamespaceOperationResult
|
|
38
|
+
|
|
34
39
|
CopyFromNamespaceParams = Turbopuffer::Models::CopyFromNamespaceParams
|
|
35
40
|
|
|
36
41
|
DecayParams = Turbopuffer::Models::DecayParams
|
|
@@ -49,6 +54,12 @@ module Turbopuffer
|
|
|
49
54
|
|
|
50
55
|
FuzzyParams = Turbopuffer::Models::FuzzyParams
|
|
51
56
|
|
|
57
|
+
HighlightConfigParams = Turbopuffer::Models::HighlightConfigParams
|
|
58
|
+
|
|
59
|
+
HighlightFragmentBy = Turbopuffer::Models::HighlightFragmentBy
|
|
60
|
+
|
|
61
|
+
HighlightOffsetUnits = Turbopuffer::Models::HighlightOffsetUnits
|
|
62
|
+
|
|
52
63
|
ID = Turbopuffer::Models::ID
|
|
53
64
|
|
|
54
65
|
IncludeAttributes = Turbopuffer::Models::IncludeAttributes
|
|
@@ -76,12 +87,17 @@ module Turbopuffer
|
|
|
76
87
|
|
|
77
88
|
NamespaceMultiQueryParams = Turbopuffer::Models::NamespaceMultiQueryParams
|
|
78
89
|
|
|
90
|
+
NamespacePollCopyFromParams = Turbopuffer::Models::NamespacePollCopyFromParams
|
|
91
|
+
|
|
79
92
|
NamespaceQueryParams = Turbopuffer::Models::NamespaceQueryParams
|
|
80
93
|
|
|
81
94
|
NamespaceRecallParams = Turbopuffer::Models::NamespaceRecallParams
|
|
82
95
|
|
|
83
96
|
NamespaceSchemaParams = Turbopuffer::Models::NamespaceSchemaParams
|
|
84
97
|
|
|
98
|
+
NamespaceStartCopyFromParams =
|
|
99
|
+
Turbopuffer::Models::NamespaceStartCopyFromParams
|
|
100
|
+
|
|
85
101
|
NamespaceSummary = Turbopuffer::Models::NamespaceSummary
|
|
86
102
|
|
|
87
103
|
NamespaceUpdateMetadataParams =
|
|
@@ -91,18 +107,24 @@ module Turbopuffer
|
|
|
91
107
|
|
|
92
108
|
NamespaceWriteParams = Turbopuffer::Models::NamespaceWriteParams
|
|
93
109
|
|
|
110
|
+
OperationError = Turbopuffer::Models::OperationError
|
|
111
|
+
|
|
94
112
|
PinningConfig = Turbopuffer::Models::PinningConfig
|
|
95
113
|
|
|
96
114
|
QueryBilling = Turbopuffer::Models::QueryBilling
|
|
97
115
|
|
|
98
116
|
QueryPerformance = Turbopuffer::Models::QueryPerformance
|
|
99
117
|
|
|
118
|
+
RerankLimit = Turbopuffer::Models::RerankLimit
|
|
119
|
+
|
|
100
120
|
Row = Turbopuffer::Models::Row
|
|
101
121
|
|
|
102
122
|
RrfParams = Turbopuffer::Models::RrfParams
|
|
103
123
|
|
|
104
124
|
SaturateParams = Turbopuffer::Models::SaturateParams
|
|
105
125
|
|
|
126
|
+
ShardingConfig = Turbopuffer::Models::ShardingConfig
|
|
127
|
+
|
|
106
128
|
SparseDistanceMetric = Turbopuffer::Models::SparseDistanceMetric
|
|
107
129
|
|
|
108
130
|
Tokenizer = Turbopuffer::Models::Tokenizer
|
|
@@ -114,4 +136,6 @@ module Turbopuffer
|
|
|
114
136
|
WriteBilling = Turbopuffer::Models::WriteBilling
|
|
115
137
|
|
|
116
138
|
WritePerformance = Turbopuffer::Models::WritePerformance
|
|
139
|
+
|
|
140
|
+
WriteResult = Turbopuffer::Models::WriteResult
|
|
117
141
|
end
|
|
@@ -71,6 +71,7 @@ module Turbopuffer
|
|
|
71
71
|
params(
|
|
72
72
|
namespace: String,
|
|
73
73
|
aggregate_by: T::Hash[Symbol, T.anything],
|
|
74
|
+
compute_attributes: T::Hash[Symbol, T.anything],
|
|
74
75
|
consistency:
|
|
75
76
|
Turbopuffer::NamespaceExplainQueryParams::Consistency::OrHash,
|
|
76
77
|
distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
|
|
@@ -79,6 +80,7 @@ module Turbopuffer
|
|
|
79
80
|
group_by: T::Array[T.anything],
|
|
80
81
|
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
|
81
82
|
limit: T.any(Integer, Turbopuffer::Limit::OrHash),
|
|
83
|
+
offset: Integer,
|
|
82
84
|
rank_by: T.anything,
|
|
83
85
|
top_k: Integer,
|
|
84
86
|
vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
|
|
@@ -91,6 +93,10 @@ module Turbopuffer
|
|
|
91
93
|
# Body param: Aggregations to compute over all documents in the namespace that
|
|
92
94
|
# match the filters.
|
|
93
95
|
aggregate_by: nil,
|
|
96
|
+
# Body param: Computes additional values on documents returned by a query. Each
|
|
97
|
+
# key is the name of the computed attribute; each value is an expression
|
|
98
|
+
# describing how to compute it.
|
|
99
|
+
compute_attributes: nil,
|
|
94
100
|
# Body param: The consistency level for a query.
|
|
95
101
|
consistency: nil,
|
|
96
102
|
# Body param: A function used to calculate vector similarity.
|
|
@@ -108,6 +114,9 @@ module Turbopuffer
|
|
|
108
114
|
include_attributes: nil,
|
|
109
115
|
# Body param: Limits the documents returned by a query.
|
|
110
116
|
limit: nil,
|
|
117
|
+
# Body param: Number of documents to skip before returning results. Supported only
|
|
118
|
+
# in v2 queries with an explicit `rank_by` and `top_k` or `limit`.
|
|
119
|
+
offset: nil,
|
|
111
120
|
# Body param: How to rank the documents in the namespace.
|
|
112
121
|
rank_by: nil,
|
|
113
122
|
# Body param: The number of results to return.
|
|
@@ -154,6 +163,8 @@ module Turbopuffer
|
|
|
154
163
|
namespace: String,
|
|
155
164
|
consistency:
|
|
156
165
|
Turbopuffer::NamespaceMultiQueryParams::Consistency::OrHash,
|
|
166
|
+
limit: T.any(Integer, Turbopuffer::RerankLimit::OrHash),
|
|
167
|
+
offset: Integer,
|
|
157
168
|
rerank_by: T.anything,
|
|
158
169
|
vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
|
|
159
170
|
request_options: Turbopuffer::RequestOptions::OrHash
|
|
@@ -166,6 +177,11 @@ module Turbopuffer
|
|
|
166
177
|
namespace: nil,
|
|
167
178
|
# Body param: The consistency level for a query.
|
|
168
179
|
consistency: nil,
|
|
180
|
+
# Body param: Limits the total number of reranked documents returned.
|
|
181
|
+
limit: nil,
|
|
182
|
+
# Body param: Number of reranked documents to skip before returning results.
|
|
183
|
+
# Requires `rerank_by` and `limit`.
|
|
184
|
+
offset: nil,
|
|
169
185
|
# Body param: How to combine the rows returned by each sub-query into a single
|
|
170
186
|
# ranked list.
|
|
171
187
|
rerank_by: nil,
|
|
@@ -175,11 +191,29 @@ module Turbopuffer
|
|
|
175
191
|
)
|
|
176
192
|
end
|
|
177
193
|
|
|
194
|
+
# Retrieve the current status of a copy operation.
|
|
195
|
+
sig do
|
|
196
|
+
params(
|
|
197
|
+
token: String,
|
|
198
|
+
namespace: String,
|
|
199
|
+
request_options: Turbopuffer::RequestOptions::OrHash
|
|
200
|
+
).returns(Turbopuffer::CopyFromNamespaceOperation::Variants)
|
|
201
|
+
end
|
|
202
|
+
def poll_copy_from(
|
|
203
|
+
# The operation token obtained when starting the copy.
|
|
204
|
+
token,
|
|
205
|
+
# The name of the namespace.
|
|
206
|
+
namespace: nil,
|
|
207
|
+
request_options: {}
|
|
208
|
+
)
|
|
209
|
+
end
|
|
210
|
+
|
|
178
211
|
# Query, filter, full-text search and vector search documents.
|
|
179
212
|
sig do
|
|
180
213
|
params(
|
|
181
214
|
namespace: T.nilable(String),
|
|
182
215
|
aggregate_by: T::Hash[Symbol, T.anything],
|
|
216
|
+
compute_attributes: T::Hash[Symbol, T.anything],
|
|
183
217
|
consistency: Turbopuffer::NamespaceQueryParams::Consistency::OrHash,
|
|
184
218
|
distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
|
|
185
219
|
exclude_attributes: T::Array[String],
|
|
@@ -187,6 +221,7 @@ module Turbopuffer
|
|
|
187
221
|
group_by: T::Array[T.anything],
|
|
188
222
|
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
|
189
223
|
limit: T.any(Integer, Turbopuffer::Limit::OrHash),
|
|
224
|
+
offset: Integer,
|
|
190
225
|
rank_by: T.anything,
|
|
191
226
|
top_k: Integer,
|
|
192
227
|
vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
|
|
@@ -199,6 +234,10 @@ module Turbopuffer
|
|
|
199
234
|
# Body param: Aggregations to compute over all documents in the namespace that
|
|
200
235
|
# match the filters.
|
|
201
236
|
aggregate_by: nil,
|
|
237
|
+
# Body param: Computes additional values on documents returned by a query. Each
|
|
238
|
+
# key is the name of the computed attribute; each value is an expression
|
|
239
|
+
# describing how to compute it.
|
|
240
|
+
compute_attributes: nil,
|
|
202
241
|
# Body param: The consistency level for a query.
|
|
203
242
|
consistency: nil,
|
|
204
243
|
# Body param: A function used to calculate vector similarity.
|
|
@@ -216,6 +255,9 @@ module Turbopuffer
|
|
|
216
255
|
include_attributes: nil,
|
|
217
256
|
# Body param: Limits the documents returned by a query.
|
|
218
257
|
limit: nil,
|
|
258
|
+
# Body param: Number of documents to skip before returning results. Supported only
|
|
259
|
+
# in v2 queries with an explicit `rank_by` and `top_k` or `limit`.
|
|
260
|
+
offset: nil,
|
|
219
261
|
# Body param: How to rank the documents in the namespace.
|
|
220
262
|
rank_by: nil,
|
|
221
263
|
# Body param: The number of results to return.
|
|
@@ -271,12 +313,47 @@ module Turbopuffer
|
|
|
271
313
|
)
|
|
272
314
|
end
|
|
273
315
|
|
|
316
|
+
# Start copying all documents from another namespace into this one. Returns an
|
|
317
|
+
# operation token without waiting for the copy to finish. Use the token to poll
|
|
318
|
+
# for progress and the result.
|
|
319
|
+
sig do
|
|
320
|
+
params(
|
|
321
|
+
source_namespace: String,
|
|
322
|
+
namespace: String,
|
|
323
|
+
dest_encryption:
|
|
324
|
+
T.any(
|
|
325
|
+
Turbopuffer::Encryption::CustomerManaged::OrHash,
|
|
326
|
+
Turbopuffer::Encryption::Default::OrHash
|
|
327
|
+
),
|
|
328
|
+
source_api_key: String,
|
|
329
|
+
source_region: String,
|
|
330
|
+
request_options: Turbopuffer::RequestOptions::OrHash
|
|
331
|
+
).returns(Turbopuffer::Models::NamespaceStartCopyFromResponse)
|
|
332
|
+
end
|
|
333
|
+
def start_copy_from(
|
|
334
|
+
# Body param: The namespace to copy documents from.
|
|
335
|
+
source_namespace:,
|
|
336
|
+
# Path param: The name of the namespace.
|
|
337
|
+
namespace: nil,
|
|
338
|
+
# Body param: (Optional) The encryption configuration for the destination
|
|
339
|
+
# namespace.
|
|
340
|
+
dest_encryption: nil,
|
|
341
|
+
# Body param: (Optional) An API key for the organization containing the source
|
|
342
|
+
# namespace
|
|
343
|
+
source_api_key: nil,
|
|
344
|
+
# Body param: (Optional) The region of the source namespace.
|
|
345
|
+
source_region: nil,
|
|
346
|
+
request_options: {}
|
|
347
|
+
)
|
|
348
|
+
end
|
|
349
|
+
|
|
274
350
|
# Update metadata configuration for a namespace.
|
|
275
351
|
sig do
|
|
276
352
|
params(
|
|
277
353
|
namespace: String,
|
|
278
354
|
pinning:
|
|
279
355
|
T.nilable(T.any(T::Boolean, Turbopuffer::PinningConfig::OrHash)),
|
|
356
|
+
read_only: T::Boolean,
|
|
280
357
|
request_options: Turbopuffer::RequestOptions::OrHash
|
|
281
358
|
).returns(Turbopuffer::NamespaceMetadata)
|
|
282
359
|
end
|
|
@@ -290,6 +367,10 @@ module Turbopuffer
|
|
|
290
367
|
# - `true`: enable pinning with default configuration
|
|
291
368
|
# - Object: set pinning configuration
|
|
292
369
|
pinning: nil,
|
|
370
|
+
# Body param: Set to `true` to reject document and schema writes, or `false` to
|
|
371
|
+
# allow them. Writes already in progress may still commit. Metadata updates remain
|
|
372
|
+
# available.
|
|
373
|
+
read_only: nil,
|
|
293
374
|
request_options: {}
|
|
294
375
|
)
|
|
295
376
|
end
|
|
@@ -352,6 +433,7 @@ module Turbopuffer
|
|
|
352
433
|
Symbol,
|
|
353
434
|
T.any(String, Turbopuffer::AttributeSchemaConfig::OrHash)
|
|
354
435
|
],
|
|
436
|
+
sharding: Turbopuffer::ShardingConfig::OrHash,
|
|
355
437
|
upsert_columns: Turbopuffer::Columns::OrHash,
|
|
356
438
|
upsert_condition: T.anything,
|
|
357
439
|
upsert_rows: T::Array[Turbopuffer::Row::OrHash],
|
|
@@ -399,6 +481,11 @@ module Turbopuffer
|
|
|
399
481
|
return_affected_ids: nil,
|
|
400
482
|
# Body param: The schema of the attributes attached to the documents.
|
|
401
483
|
schema: nil,
|
|
484
|
+
# Body param: Configuration for namespace sharding, which partitions a namespace's
|
|
485
|
+
# documents across multiple internal shards to scale indexing and query throughput
|
|
486
|
+
# beyond a single machine. Sharding can only be configured on a namespace's
|
|
487
|
+
# inaugural write, and cannot be added to or changed on an existing namespace.
|
|
488
|
+
sharding: nil,
|
|
402
489
|
# Body param: A list of documents in columnar format. Each key is a column name,
|
|
403
490
|
# mapped to an array of values for that column.
|
|
404
491
|
upsert_columns: nil,
|
|
@@ -82,7 +82,10 @@ module Turbopuffer
|
|
|
82
82
|
extend Turbopuffer::Internal::Type::Union
|
|
83
83
|
|
|
84
84
|
type ann_config =
|
|
85
|
-
{
|
|
85
|
+
{
|
|
86
|
+
distance_metric: Turbopuffer::Models::distance_metric,
|
|
87
|
+
late_interaction: bool
|
|
88
|
+
}
|
|
86
89
|
|
|
87
90
|
class AnnConfig < Turbopuffer::Internal::Type::BaseModel
|
|
88
91
|
attr_reader distance_metric: Turbopuffer::Models::distance_metric?
|
|
@@ -91,12 +94,18 @@ module Turbopuffer
|
|
|
91
94
|
Turbopuffer::Models::distance_metric
|
|
92
95
|
) -> Turbopuffer::Models::distance_metric
|
|
93
96
|
|
|
97
|
+
attr_reader late_interaction: bool?
|
|
98
|
+
|
|
99
|
+
def late_interaction=: (bool) -> bool
|
|
100
|
+
|
|
94
101
|
def initialize: (
|
|
95
|
-
?distance_metric: Turbopuffer::Models::distance_metric
|
|
102
|
+
?distance_metric: Turbopuffer::Models::distance_metric,
|
|
103
|
+
?late_interaction: bool
|
|
96
104
|
) -> void
|
|
97
105
|
|
|
98
106
|
def to_hash: -> {
|
|
99
|
-
distance_metric: Turbopuffer::Models::distance_metric
|
|
107
|
+
distance_metric: Turbopuffer::Models::distance_metric,
|
|
108
|
+
late_interaction: bool
|
|
100
109
|
}
|
|
101
110
|
end
|
|
102
111
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
module Turbopuffer
|
|
2
|
+
module Models
|
|
3
|
+
type copy_from_namespace_operation =
|
|
4
|
+
Turbopuffer::CopyFromNamespaceOperation::Running
|
|
5
|
+
| Turbopuffer::CopyFromNamespaceOperation::Finished
|
|
6
|
+
|
|
7
|
+
module CopyFromNamespaceOperation
|
|
8
|
+
extend Turbopuffer::Internal::Type::Union
|
|
9
|
+
|
|
10
|
+
type running = { start_time: Time, status: :running, progress: String }
|
|
11
|
+
|
|
12
|
+
class Running < Turbopuffer::Internal::Type::BaseModel
|
|
13
|
+
attr_accessor start_time: Time
|
|
14
|
+
|
|
15
|
+
attr_accessor status: :running
|
|
16
|
+
|
|
17
|
+
attr_reader progress: String?
|
|
18
|
+
|
|
19
|
+
def progress=: (String) -> String
|
|
20
|
+
|
|
21
|
+
def initialize: (
|
|
22
|
+
start_time: Time,
|
|
23
|
+
?progress: String,
|
|
24
|
+
?status: :running
|
|
25
|
+
) -> void
|
|
26
|
+
|
|
27
|
+
def to_hash: -> { start_time: Time, status: :running, progress: String }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
type finished =
|
|
31
|
+
{
|
|
32
|
+
finish_time: Time,
|
|
33
|
+
result: Turbopuffer::Models::copy_from_namespace_operation_result,
|
|
34
|
+
start_time: Time,
|
|
35
|
+
status: :finished
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
class Finished < Turbopuffer::Internal::Type::BaseModel
|
|
39
|
+
attr_accessor finish_time: Time
|
|
40
|
+
|
|
41
|
+
attr_accessor result: Turbopuffer::Models::copy_from_namespace_operation_result
|
|
42
|
+
|
|
43
|
+
attr_accessor start_time: Time
|
|
44
|
+
|
|
45
|
+
attr_accessor status: :finished
|
|
46
|
+
|
|
47
|
+
def initialize: (
|
|
48
|
+
finish_time: Time,
|
|
49
|
+
result: Turbopuffer::Models::copy_from_namespace_operation_result,
|
|
50
|
+
start_time: Time,
|
|
51
|
+
?status: :finished
|
|
52
|
+
) -> void
|
|
53
|
+
|
|
54
|
+
def to_hash: -> {
|
|
55
|
+
finish_time: Time,
|
|
56
|
+
result: Turbopuffer::Models::copy_from_namespace_operation_result,
|
|
57
|
+
start_time: Time,
|
|
58
|
+
status: :finished
|
|
59
|
+
}
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self?.variants: -> ::Array[Turbopuffer::Models::copy_from_namespace_operation]
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Turbopuffer
|
|
2
|
+
module Models
|
|
3
|
+
type copy_from_namespace_operation_result =
|
|
4
|
+
Turbopuffer::CopyFromNamespaceOperationResult::Success
|
|
5
|
+
| Turbopuffer::CopyFromNamespaceOperationResult::Error
|
|
6
|
+
|
|
7
|
+
module CopyFromNamespaceOperationResult
|
|
8
|
+
extend Turbopuffer::Internal::Type::Union
|
|
9
|
+
|
|
10
|
+
type success = { success: Turbopuffer::WriteResult }
|
|
11
|
+
|
|
12
|
+
class Success < Turbopuffer::Internal::Type::BaseModel
|
|
13
|
+
attr_accessor success: Turbopuffer::WriteResult
|
|
14
|
+
|
|
15
|
+
def initialize: (success: Turbopuffer::WriteResult) -> void
|
|
16
|
+
|
|
17
|
+
def to_hash: -> { success: Turbopuffer::WriteResult }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
type error = { error: Turbopuffer::OperationError }
|
|
21
|
+
|
|
22
|
+
class Error < Turbopuffer::Internal::Type::BaseModel
|
|
23
|
+
attr_accessor error: Turbopuffer::OperationError
|
|
24
|
+
|
|
25
|
+
def initialize: (error: Turbopuffer::OperationError) -> void
|
|
26
|
+
|
|
27
|
+
def to_hash: -> { error: Turbopuffer::OperationError }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self?.variants: -> ::Array[Turbopuffer::Models::copy_from_namespace_operation_result]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Turbopuffer
|
|
2
|
+
module Models
|
|
3
|
+
type highlight_config_params =
|
|
4
|
+
{
|
|
5
|
+
fragment_by: Turbopuffer::Models::highlight_fragment_by,
|
|
6
|
+
fragment_limit: Integer,
|
|
7
|
+
include_offsets: Turbopuffer::Models::highlight_offset_units,
|
|
8
|
+
rank_fragments_by: top
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class HighlightConfigParams < Turbopuffer::Internal::Type::BaseModel
|
|
12
|
+
attr_reader fragment_by: Turbopuffer::Models::highlight_fragment_by?
|
|
13
|
+
|
|
14
|
+
def fragment_by=: (
|
|
15
|
+
Turbopuffer::Models::highlight_fragment_by
|
|
16
|
+
) -> Turbopuffer::Models::highlight_fragment_by
|
|
17
|
+
|
|
18
|
+
attr_reader fragment_limit: Integer?
|
|
19
|
+
|
|
20
|
+
def fragment_limit=: (Integer) -> Integer
|
|
21
|
+
|
|
22
|
+
attr_reader include_offsets: Turbopuffer::Models::highlight_offset_units?
|
|
23
|
+
|
|
24
|
+
def include_offsets=: (
|
|
25
|
+
Turbopuffer::Models::highlight_offset_units
|
|
26
|
+
) -> Turbopuffer::Models::highlight_offset_units
|
|
27
|
+
|
|
28
|
+
attr_reader rank_fragments_by: top?
|
|
29
|
+
|
|
30
|
+
def rank_fragments_by=: (top) -> top
|
|
31
|
+
|
|
32
|
+
def initialize: (
|
|
33
|
+
?fragment_by: Turbopuffer::Models::highlight_fragment_by,
|
|
34
|
+
?fragment_limit: Integer,
|
|
35
|
+
?include_offsets: Turbopuffer::Models::highlight_offset_units,
|
|
36
|
+
?rank_fragments_by: top
|
|
37
|
+
) -> void
|
|
38
|
+
|
|
39
|
+
def to_hash: -> {
|
|
40
|
+
fragment_by: Turbopuffer::Models::highlight_fragment_by,
|
|
41
|
+
fragment_limit: Integer,
|
|
42
|
+
include_offsets: Turbopuffer::Models::highlight_offset_units,
|
|
43
|
+
rank_fragments_by: top
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Turbopuffer
|
|
2
|
+
module Models
|
|
3
|
+
type highlight_fragment_by = :none | :sentence | :paragraph | :word
|
|
4
|
+
|
|
5
|
+
module HighlightFragmentBy
|
|
6
|
+
extend Turbopuffer::Internal::Type::Enum
|
|
7
|
+
|
|
8
|
+
# Treat the whole attribute as a single fragment.
|
|
9
|
+
NONE: :none
|
|
10
|
+
|
|
11
|
+
# Split the attribute into sentences. This is the default.
|
|
12
|
+
SENTENCE: :sentence
|
|
13
|
+
|
|
14
|
+
# Split the attribute into paragraphs.
|
|
15
|
+
PARAGRAPH: :paragraph
|
|
16
|
+
|
|
17
|
+
# Split the attribute into individual words.
|
|
18
|
+
WORD: :word
|
|
19
|
+
|
|
20
|
+
def self?.values: -> ::Array[Turbopuffer::Models::highlight_fragment_by]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Turbopuffer
|
|
2
|
+
module Models
|
|
3
|
+
type highlight_offset_units = :"utf-8" | :"utf-16" | :codepoints
|
|
4
|
+
|
|
5
|
+
module HighlightOffsetUnits
|
|
6
|
+
extend Turbopuffer::Internal::Type::Enum
|
|
7
|
+
|
|
8
|
+
UTF_8: :"utf-8"
|
|
9
|
+
UTF_16: :"utf-16"
|
|
10
|
+
CODEPOINTS: :codepoints
|
|
11
|
+
|
|
12
|
+
def self?.values: -> ::Array[Turbopuffer::Models::highlight_offset_units]
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|