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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/README.md +1 -10
  4. data/lib/turbopuffer/client.rb +2 -2
  5. data/lib/turbopuffer/internal/type/union.rb +17 -7
  6. data/lib/turbopuffer/models/attribute_schema.rb +4 -1
  7. data/lib/turbopuffer/models/attribute_schema_drop.rb +19 -0
  8. data/lib/turbopuffer/models/copy_from_namespace_operation.rb +84 -0
  9. data/lib/turbopuffer/models/copy_from_namespace_operation_result.rb +37 -0
  10. data/lib/turbopuffer/models/namespace_explain_query_params.rb +10 -1
  11. data/lib/turbopuffer/models/namespace_metadata.rb +21 -2
  12. data/lib/turbopuffer/models/namespace_metadata_patch.rb +10 -1
  13. data/lib/turbopuffer/models/namespace_multi_query_params.rb +45 -2
  14. data/lib/turbopuffer/models/namespace_poll_copy_from_params.rb +26 -0
  15. data/lib/turbopuffer/models/namespace_query_params.rb +10 -1
  16. data/lib/turbopuffer/models/namespace_start_copy_from_params.rb +53 -0
  17. data/lib/turbopuffer/models/namespace_start_copy_from_response.rb +17 -0
  18. data/lib/turbopuffer/models/namespace_update_schema_params.rb +2 -2
  19. data/lib/turbopuffer/models/namespace_write_params.rb +15 -3
  20. data/lib/turbopuffer/models/operation_error.rb +46 -0
  21. data/lib/turbopuffer/models/rerank_limit.rb +18 -0
  22. data/lib/turbopuffer/models/write_result.rb +112 -0
  23. data/lib/turbopuffer/models.rb +16 -0
  24. data/lib/turbopuffer/resources/namespaces.rb +85 -7
  25. data/lib/turbopuffer/version.rb +1 -1
  26. data/lib/turbopuffer.rb +9 -0
  27. data/rbi/turbopuffer/client.rbi +2 -2
  28. data/rbi/turbopuffer/models/attribute_schema.rbi +7 -1
  29. data/rbi/turbopuffer/models/attribute_schema_drop.rbi +32 -0
  30. data/rbi/turbopuffer/models/copy_from_namespace_operation.rbi +133 -0
  31. data/rbi/turbopuffer/models/copy_from_namespace_operation_result.rbi +85 -0
  32. data/rbi/turbopuffer/models/namespace_explain_query_params.rbi +13 -0
  33. data/rbi/turbopuffer/models/namespace_metadata.rbi +30 -1
  34. data/rbi/turbopuffer/models/namespace_metadata_patch.rbi +18 -3
  35. data/rbi/turbopuffer/models/namespace_multi_query_params.rbi +54 -0
  36. data/rbi/turbopuffer/models/namespace_poll_copy_from_params.rbi +49 -0
  37. data/rbi/turbopuffer/models/namespace_query_params.rbi +13 -0
  38. data/rbi/turbopuffer/models/namespace_start_copy_from_params.rbi +113 -0
  39. data/rbi/turbopuffer/models/namespace_start_copy_from_response.rbi +30 -0
  40. data/rbi/turbopuffer/models/namespace_update_schema_params.rbi +23 -4
  41. data/rbi/turbopuffer/models/namespace_write_params.rbi +42 -4
  42. data/rbi/turbopuffer/models/operation_error.rbi +77 -0
  43. data/rbi/turbopuffer/models/rerank_limit.rbi +28 -0
  44. data/rbi/turbopuffer/models/write_result.rbi +159 -0
  45. data/rbi/turbopuffer/models.rbi +18 -0
  46. data/rbi/turbopuffer/resources/namespaces.rbi +88 -2
  47. data/sig/turbopuffer/models/attribute_schema.rbs +4 -1
  48. data/sig/turbopuffer/models/attribute_schema_drop.rbs +13 -0
  49. data/sig/turbopuffer/models/copy_from_namespace_operation.rbs +65 -0
  50. data/sig/turbopuffer/models/copy_from_namespace_operation_result.rbs +33 -0
  51. data/sig/turbopuffer/models/namespace_explain_query_params.rbs +7 -0
  52. data/sig/turbopuffer/models/namespace_metadata.rbs +17 -1
  53. data/sig/turbopuffer/models/namespace_metadata_patch.rbs +12 -3
  54. data/sig/turbopuffer/models/namespace_multi_query_params.rbs +31 -0
  55. data/sig/turbopuffer/models/namespace_poll_copy_from_params.rbs +30 -0
  56. data/sig/turbopuffer/models/namespace_query_params.rbs +7 -0
  57. data/sig/turbopuffer/models/namespace_start_copy_from_params.rbs +56 -0
  58. data/sig/turbopuffer/models/namespace_start_copy_from_response.rbs +13 -0
  59. data/sig/turbopuffer/models/namespace_write_params.rbs +7 -0
  60. data/sig/turbopuffer/models/operation_error.rbs +34 -0
  61. data/sig/turbopuffer/models/rerank_limit.rbs +13 -0
  62. data/sig/turbopuffer/models/write_result.rbs +99 -0
  63. data/sig/turbopuffer/models.rbs +16 -0
  64. data/sig/turbopuffer/resources/namespaces.rbs +21 -0
  65. metadata +29 -2
@@ -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
@@ -24,7 +24,14 @@ module Turbopuffer
24
24
  sig do
25
25
  returns(
26
26
  T.nilable(
27
- T::Hash[Symbol, T.any(String, Turbopuffer::AttributeSchemaConfig)]
27
+ T::Hash[
28
+ Symbol,
29
+ T.any(
30
+ String,
31
+ Turbopuffer::AttributeSchemaConfig,
32
+ Turbopuffer::AttributeSchemaDrop
33
+ )
34
+ ]
28
35
  )
29
36
  )
30
37
  end
@@ -35,7 +42,11 @@ module Turbopuffer
35
42
  schema:
36
43
  T::Hash[
37
44
  Symbol,
38
- T.any(String, Turbopuffer::AttributeSchemaConfig::OrHash)
45
+ T.any(
46
+ String,
47
+ Turbopuffer::AttributeSchemaConfig::OrHash,
48
+ Turbopuffer::AttributeSchemaDrop::OrHash
49
+ )
39
50
  ]
40
51
  ).void
41
52
  end
@@ -47,7 +58,11 @@ module Turbopuffer
47
58
  schema:
48
59
  T::Hash[
49
60
  Symbol,
50
- T.any(String, Turbopuffer::AttributeSchemaConfig::OrHash)
61
+ T.any(
62
+ String,
63
+ Turbopuffer::AttributeSchemaConfig::OrHash,
64
+ Turbopuffer::AttributeSchemaDrop::OrHash
65
+ )
51
66
  ],
52
67
  request_options: Turbopuffer::RequestOptions::OrHash
53
68
  ).returns(T.attached_class)
@@ -67,7 +82,11 @@ module Turbopuffer
67
82
  schema:
68
83
  T::Hash[
69
84
  Symbol,
70
- T.any(String, Turbopuffer::AttributeSchemaConfig)
85
+ T.any(
86
+ String,
87
+ Turbopuffer::AttributeSchemaConfig,
88
+ Turbopuffer::AttributeSchemaDrop
89
+ )
71
90
  ],
72
91
  request_options: Turbopuffer::RequestOptions
73
92
  }
@@ -68,6 +68,17 @@ module Turbopuffer
68
68
  end
69
69
  attr_writer :copy_from_namespace
70
70
 
71
+ # If `true`, ensures the namespace is created, even if the request writes no
72
+ # documents. Creating an empty namespace requires the `id` type to be declared in
73
+ # `schema`. If `false`, a namespace is never created, and a 404 is returned if it
74
+ # does not exist. If omitted, a namespace is created by the first request that
75
+ # writes documents.
76
+ sig { returns(T.nilable(T::Boolean)) }
77
+ attr_reader :create_namespace
78
+
79
+ sig { params(create_namespace: T::Boolean).void }
80
+ attr_writer :create_namespace
81
+
71
82
  # The filter specifying which documents to delete.
72
83
  sig { returns(T.nilable(T.anything)) }
73
84
  attr_reader :delete_by_filter
@@ -192,7 +203,14 @@ module Turbopuffer
192
203
  sig do
193
204
  returns(
194
205
  T.nilable(
195
- T::Hash[Symbol, T.any(String, Turbopuffer::AttributeSchemaConfig)]
206
+ T::Hash[
207
+ Symbol,
208
+ T.any(
209
+ String,
210
+ Turbopuffer::AttributeSchemaConfig,
211
+ Turbopuffer::AttributeSchemaDrop
212
+ )
213
+ ]
196
214
  )
197
215
  )
198
216
  end
@@ -203,7 +221,11 @@ module Turbopuffer
203
221
  schema:
204
222
  T::Hash[
205
223
  Symbol,
206
- T.any(String, Turbopuffer::AttributeSchemaConfig::OrHash)
224
+ T.any(
225
+ String,
226
+ Turbopuffer::AttributeSchemaConfig::OrHash,
227
+ Turbopuffer::AttributeSchemaDrop::OrHash
228
+ )
207
229
  ]
208
230
  ).void
209
231
  end
@@ -254,6 +276,7 @@ module Turbopuffer
254
276
  String,
255
277
  Turbopuffer::CopyFromNamespaceParams::CopyFromNamespaceConfig::OrHash
256
278
  ),
279
+ create_namespace: T::Boolean,
257
280
  delete_by_filter: T.anything,
258
281
  delete_by_filter_allow_partial: T::Boolean,
259
282
  delete_condition: T.anything,
@@ -275,7 +298,11 @@ module Turbopuffer
275
298
  schema:
276
299
  T::Hash[
277
300
  Symbol,
278
- T.any(String, Turbopuffer::AttributeSchemaConfig::OrHash)
301
+ T.any(
302
+ String,
303
+ Turbopuffer::AttributeSchemaConfig::OrHash,
304
+ Turbopuffer::AttributeSchemaDrop::OrHash
305
+ )
279
306
  ],
280
307
  sharding: Turbopuffer::ShardingConfig::OrHash,
281
308
  upsert_columns: Turbopuffer::Columns::OrHash,
@@ -290,6 +317,12 @@ module Turbopuffer
290
317
  branch_from_namespace: nil,
291
318
  # The namespace to copy documents from.
292
319
  copy_from_namespace: nil,
320
+ # If `true`, ensures the namespace is created, even if the request writes no
321
+ # documents. Creating an empty namespace requires the `id` type to be declared in
322
+ # `schema`. If `false`, a namespace is never created, and a 404 is returned if it
323
+ # does not exist. If omitted, a namespace is created by the first request that
324
+ # writes documents.
325
+ create_namespace: nil,
293
326
  # The filter specifying which documents to delete.
294
327
  delete_by_filter: nil,
295
328
  # Allow partial completion when filter matches too many documents.
@@ -351,6 +384,7 @@ module Turbopuffer
351
384
  String,
352
385
  Turbopuffer::CopyFromNamespaceParams::CopyFromNamespaceConfig
353
386
  ),
387
+ create_namespace: T::Boolean,
354
388
  delete_by_filter: T.anything,
355
389
  delete_by_filter_allow_partial: T::Boolean,
356
390
  delete_condition: T.anything,
@@ -371,7 +405,11 @@ module Turbopuffer
371
405
  schema:
372
406
  T::Hash[
373
407
  Symbol,
374
- T.any(String, Turbopuffer::AttributeSchemaConfig)
408
+ T.any(
409
+ String,
410
+ Turbopuffer::AttributeSchemaConfig,
411
+ Turbopuffer::AttributeSchemaDrop
412
+ )
375
413
  ],
376
414
  sharding: Turbopuffer::ShardingConfig,
377
415
  upsert_columns: Turbopuffer::Columns,
@@ -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
@@ -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
@@ -15,6 +15,8 @@ module Turbopuffer
15
15
 
16
16
  AttributeSchemaConfig = Turbopuffer::Models::AttributeSchemaConfig
17
17
 
18
+ AttributeSchemaDrop = Turbopuffer::Models::AttributeSchemaDrop
19
+
18
20
  AttributeType = Turbopuffer::Models::AttributeType
19
21
 
20
22
  Bm25ClauseParams = Turbopuffer::Models::Bm25ClauseParams
@@ -31,6 +33,11 @@ module Turbopuffer
31
33
  ContainsAnyTokenFilterParams =
32
34
  Turbopuffer::Models::ContainsAnyTokenFilterParams
33
35
 
36
+ CopyFromNamespaceOperation = Turbopuffer::Models::CopyFromNamespaceOperation
37
+
38
+ CopyFromNamespaceOperationResult =
39
+ Turbopuffer::Models::CopyFromNamespaceOperationResult
40
+
34
41
  CopyFromNamespaceParams = Turbopuffer::Models::CopyFromNamespaceParams
35
42
 
36
43
  DecayParams = Turbopuffer::Models::DecayParams
@@ -82,12 +89,17 @@ module Turbopuffer
82
89
 
83
90
  NamespaceMultiQueryParams = Turbopuffer::Models::NamespaceMultiQueryParams
84
91
 
92
+ NamespacePollCopyFromParams = Turbopuffer::Models::NamespacePollCopyFromParams
93
+
85
94
  NamespaceQueryParams = Turbopuffer::Models::NamespaceQueryParams
86
95
 
87
96
  NamespaceRecallParams = Turbopuffer::Models::NamespaceRecallParams
88
97
 
89
98
  NamespaceSchemaParams = Turbopuffer::Models::NamespaceSchemaParams
90
99
 
100
+ NamespaceStartCopyFromParams =
101
+ Turbopuffer::Models::NamespaceStartCopyFromParams
102
+
91
103
  NamespaceSummary = Turbopuffer::Models::NamespaceSummary
92
104
 
93
105
  NamespaceUpdateMetadataParams =
@@ -97,12 +109,16 @@ module Turbopuffer
97
109
 
98
110
  NamespaceWriteParams = Turbopuffer::Models::NamespaceWriteParams
99
111
 
112
+ OperationError = Turbopuffer::Models::OperationError
113
+
100
114
  PinningConfig = Turbopuffer::Models::PinningConfig
101
115
 
102
116
  QueryBilling = Turbopuffer::Models::QueryBilling
103
117
 
104
118
  QueryPerformance = Turbopuffer::Models::QueryPerformance
105
119
 
120
+ RerankLimit = Turbopuffer::Models::RerankLimit
121
+
106
122
  Row = Turbopuffer::Models::Row
107
123
 
108
124
  RrfParams = Turbopuffer::Models::RrfParams
@@ -122,4 +138,6 @@ module Turbopuffer
122
138
  WriteBilling = Turbopuffer::Models::WriteBilling
123
139
 
124
140
  WritePerformance = Turbopuffer::Models::WritePerformance
141
+
142
+ WriteResult = Turbopuffer::Models::WriteResult
125
143
  end
@@ -80,6 +80,7 @@ module Turbopuffer
80
80
  group_by: T::Array[T.anything],
81
81
  include_attributes: Turbopuffer::IncludeAttributes::Variants,
82
82
  limit: T.any(Integer, Turbopuffer::Limit::OrHash),
83
+ offset: Integer,
83
84
  rank_by: T.anything,
84
85
  top_k: Integer,
85
86
  vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
@@ -113,6 +114,9 @@ module Turbopuffer
113
114
  include_attributes: nil,
114
115
  # Body param: Limits the documents returned by a query.
115
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,
116
120
  # Body param: How to rank the documents in the namespace.
117
121
  rank_by: nil,
118
122
  # Body param: The number of results to return.
@@ -159,6 +163,8 @@ module Turbopuffer
159
163
  namespace: String,
160
164
  consistency:
161
165
  Turbopuffer::NamespaceMultiQueryParams::Consistency::OrHash,
166
+ limit: T.any(Integer, Turbopuffer::RerankLimit::OrHash),
167
+ offset: Integer,
162
168
  rerank_by: T.anything,
163
169
  vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
164
170
  request_options: Turbopuffer::RequestOptions::OrHash
@@ -171,6 +177,11 @@ module Turbopuffer
171
177
  namespace: nil,
172
178
  # Body param: The consistency level for a query.
173
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,
174
185
  # Body param: How to combine the rows returned by each sub-query into a single
175
186
  # ranked list.
176
187
  rerank_by: nil,
@@ -180,6 +191,23 @@ module Turbopuffer
180
191
  )
181
192
  end
182
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
+
183
211
  # Query, filter, full-text search and vector search documents.
184
212
  sig do
185
213
  params(
@@ -193,6 +221,7 @@ module Turbopuffer
193
221
  group_by: T::Array[T.anything],
194
222
  include_attributes: Turbopuffer::IncludeAttributes::Variants,
195
223
  limit: T.any(Integer, Turbopuffer::Limit::OrHash),
224
+ offset: Integer,
196
225
  rank_by: T.anything,
197
226
  top_k: Integer,
198
227
  vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
@@ -226,6 +255,9 @@ module Turbopuffer
226
255
  include_attributes: nil,
227
256
  # Body param: Limits the documents returned by a query.
228
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,
229
261
  # Body param: How to rank the documents in the namespace.
230
262
  rank_by: nil,
231
263
  # Body param: The number of results to return.
@@ -281,12 +313,47 @@ module Turbopuffer
281
313
  )
282
314
  end
283
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
+
284
350
  # Update metadata configuration for a namespace.
285
351
  sig do
286
352
  params(
287
353
  namespace: String,
288
354
  pinning:
289
355
  T.nilable(T.any(T::Boolean, Turbopuffer::PinningConfig::OrHash)),
356
+ read_only: T::Boolean,
290
357
  request_options: Turbopuffer::RequestOptions::OrHash
291
358
  ).returns(Turbopuffer::NamespaceMetadata)
292
359
  end
@@ -300,6 +367,10 @@ module Turbopuffer
300
367
  # - `true`: enable pinning with default configuration
301
368
  # - Object: set pinning configuration
302
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,
303
374
  request_options: {}
304
375
  )
305
376
  end
@@ -311,7 +382,11 @@ module Turbopuffer
311
382
  schema:
312
383
  T::Hash[
313
384
  Symbol,
314
- T.any(String, Turbopuffer::AttributeSchemaConfig::OrHash)
385
+ T.any(
386
+ String,
387
+ Turbopuffer::AttributeSchemaConfig::OrHash,
388
+ Turbopuffer::AttributeSchemaDrop::OrHash
389
+ )
315
390
  ],
316
391
  request_options: Turbopuffer::RequestOptions::OrHash
317
392
  ).returns(T::Hash[Symbol, Turbopuffer::AttributeSchemaConfig])
@@ -339,6 +414,7 @@ module Turbopuffer
339
414
  String,
340
415
  Turbopuffer::CopyFromNamespaceParams::CopyFromNamespaceConfig::OrHash
341
416
  ),
417
+ create_namespace: T::Boolean,
342
418
  delete_by_filter: T.anything,
343
419
  delete_by_filter_allow_partial: T::Boolean,
344
420
  delete_condition: T.anything,
@@ -360,7 +436,11 @@ module Turbopuffer
360
436
  schema:
361
437
  T::Hash[
362
438
  Symbol,
363
- T.any(String, Turbopuffer::AttributeSchemaConfig::OrHash)
439
+ T.any(
440
+ String,
441
+ Turbopuffer::AttributeSchemaConfig::OrHash,
442
+ Turbopuffer::AttributeSchemaDrop::OrHash
443
+ )
364
444
  ],
365
445
  sharding: Turbopuffer::ShardingConfig::OrHash,
366
446
  upsert_columns: Turbopuffer::Columns::OrHash,
@@ -376,6 +456,12 @@ module Turbopuffer
376
456
  branch_from_namespace: nil,
377
457
  # Body param: The namespace to copy documents from.
378
458
  copy_from_namespace: nil,
459
+ # Body param: If `true`, ensures the namespace is created, even if the request
460
+ # writes no documents. Creating an empty namespace requires the `id` type to be
461
+ # declared in `schema`. If `false`, a namespace is never created, and a 404 is
462
+ # returned if it does not exist. If omitted, a namespace is created by the first
463
+ # request that writes documents.
464
+ create_namespace: nil,
379
465
  # Body param: The filter specifying which documents to delete.
380
466
  delete_by_filter: nil,
381
467
  # Body param: Allow partial completion when filter matches too many documents.