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
@@ -24,6 +24,16 @@ module Turbopuffer
24
24
  # @return [String, Turbopuffer::Models::CopyFromNamespaceParams::CopyFromNamespaceConfig, nil]
25
25
  optional :copy_from_namespace, union: -> { Turbopuffer::CopyFromNamespaceParams }
26
26
 
27
+ # @!attribute create_namespace
28
+ # If `true`, ensures the namespace is created, even if the request writes no
29
+ # documents. Creating an empty namespace requires the `id` type to be declared in
30
+ # `schema`. If `false`, a namespace is never created, and a 404 is returned if it
31
+ # does not exist. If omitted, a namespace is created by the first request that
32
+ # writes documents.
33
+ #
34
+ # @return [Boolean, nil]
35
+ optional :create_namespace, Turbopuffer::Internal::Type::Boolean
36
+
27
37
  # @!attribute delete_by_filter
28
38
  # The filter specifying which documents to delete.
29
39
  #
@@ -108,7 +118,7 @@ module Turbopuffer
108
118
  # @!attribute schema
109
119
  # The schema of the attributes attached to the documents.
110
120
  #
111
- # @return [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig}, nil]
121
+ # @return [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig, Turbopuffer::Models::AttributeSchemaDrop}, nil]
112
122
  optional :schema, -> { Turbopuffer::Internal::Type::HashOf[union: Turbopuffer::AttributeSchema] }
113
123
 
114
124
  # @!attribute sharding
@@ -139,7 +149,7 @@ module Turbopuffer
139
149
  # @return [Array<Turbopuffer::Models::Row>, nil]
140
150
  optional :upsert_rows, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
141
151
 
142
- # @!method initialize(namespace: nil, branch_from_namespace: nil, copy_from_namespace: nil, delete_by_filter: nil, delete_by_filter_allow_partial: nil, delete_condition: nil, deletes: nil, disable_backpressure: nil, distance_metric: nil, encryption: nil, patch_by_filter: nil, patch_by_filter_allow_partial: nil, patch_columns: nil, patch_condition: nil, patch_rows: nil, return_affected_ids: nil, schema: nil, sharding: nil, upsert_columns: nil, upsert_condition: nil, upsert_rows: nil, request_options: {})
152
+ # @!method initialize(namespace: nil, branch_from_namespace: nil, copy_from_namespace: nil, create_namespace: nil, delete_by_filter: nil, delete_by_filter_allow_partial: nil, delete_condition: nil, deletes: nil, disable_backpressure: nil, distance_metric: nil, encryption: nil, patch_by_filter: nil, patch_by_filter_allow_partial: nil, patch_columns: nil, patch_condition: nil, patch_rows: nil, return_affected_ids: nil, schema: nil, sharding: nil, upsert_columns: nil, upsert_condition: nil, upsert_rows: nil, request_options: {})
143
153
  # Some parameter documentations has been truncated, see
144
154
  # {Turbopuffer::Models::NamespaceWriteParams} for more details.
145
155
  #
@@ -149,6 +159,8 @@ module Turbopuffer
149
159
  #
150
160
  # @param copy_from_namespace [String, Turbopuffer::Models::CopyFromNamespaceParams::CopyFromNamespaceConfig] The namespace to copy documents from.
151
161
  #
162
+ # @param create_namespace [Boolean] If `true`, ensures the namespace is created, even if the request writes no docum
163
+ #
152
164
  # @param delete_by_filter [Object] The filter specifying which documents to delete.
153
165
  #
154
166
  # @param delete_by_filter_allow_partial [Boolean] Allow partial completion when filter matches too many documents.
@@ -175,7 +187,7 @@ module Turbopuffer
175
187
  #
176
188
  # @param return_affected_ids [Boolean] If true, return the IDs of affected rows (deleted, patched, upserted) in the res
177
189
  #
178
- # @param schema [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig}] The schema of the attributes attached to the documents.
190
+ # @param schema [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig, Turbopuffer::Models::AttributeSchemaDrop}] The schema of the attributes attached to the documents.
179
191
  #
180
192
  # @param sharding [Turbopuffer::Models::ShardingConfig] Configuration for namespace sharding, which partitions a namespace's documents a
181
193
  #
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class OperationError < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute detail
7
+ # The response to an unsuccessful request.
8
+ #
9
+ # @return [Turbopuffer::Models::OperationError::Detail]
10
+ required :detail, -> { Turbopuffer::OperationError::Detail }
11
+
12
+ # @!attribute status_code
13
+ # The HTTP status code of the operation's error.
14
+ #
15
+ # @return [Integer]
16
+ required :status_code, Integer
17
+
18
+ # @!method initialize(detail:, status_code:)
19
+ # @param detail [Turbopuffer::Models::OperationError::Detail] The response to an unsuccessful request.
20
+ #
21
+ # @param status_code [Integer] The HTTP status code of the operation's error.
22
+
23
+ # @see Turbopuffer::Models::OperationError#detail
24
+ class Detail < Turbopuffer::Internal::Type::BaseModel
25
+ # @!attribute error
26
+ # The error message.
27
+ #
28
+ # @return [String]
29
+ required :error, String
30
+
31
+ # @!attribute status
32
+ # The status of the request.
33
+ #
34
+ # @return [Symbol, :error]
35
+ required :status, const: :error
36
+
37
+ # @!method initialize(error:, status: :error)
38
+ # The response to an unsuccessful request.
39
+ #
40
+ # @param error [String] The error message.
41
+ #
42
+ # @param status [Symbol, :error] The status of the request.
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class RerankLimit < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute total
7
+ # Limits the total number of documents returned after reranking.
8
+ #
9
+ # @return [Integer]
10
+ required :total, Integer
11
+
12
+ # @!method initialize(total:)
13
+ # Limits the total number of reranked documents returned.
14
+ #
15
+ # @param total [Integer] Limits the total number of documents returned after reranking.
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class WriteResult < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute billing
7
+ # The billing information for a write request.
8
+ #
9
+ # @return [Turbopuffer::Models::WriteBilling]
10
+ required :billing, -> { Turbopuffer::WriteBilling }
11
+
12
+ # @!attribute message
13
+ # A message describing the result of the write request.
14
+ #
15
+ # @return [String]
16
+ required :message, String
17
+
18
+ # @!attribute rows_affected
19
+ # The number of rows affected by the write request.
20
+ #
21
+ # @return [Integer]
22
+ required :rows_affected, Integer
23
+
24
+ # @!attribute status
25
+ # The status of the request.
26
+ #
27
+ # @return [Symbol, :OK]
28
+ required :status, const: :OK
29
+
30
+ # @!attribute deleted_ids
31
+ # The IDs of documents that were deleted. Only included when `return_affected_ids`
32
+ # is true and at least one document was deleted.
33
+ #
34
+ # @return [Array<String, Integer>, nil]
35
+ optional :deleted_ids, -> { Turbopuffer::Internal::Type::ArrayOf[union: Turbopuffer::ID] }
36
+
37
+ # @!attribute patched_ids
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
+ #
41
+ # @return [Array<String, Integer>, nil]
42
+ optional :patched_ids, -> { Turbopuffer::Internal::Type::ArrayOf[union: Turbopuffer::ID] }
43
+
44
+ # @!attribute performance
45
+ # The performance information for a write request.
46
+ #
47
+ # @return [Turbopuffer::Models::WritePerformance, nil]
48
+ optional :performance, -> { Turbopuffer::WritePerformance }
49
+
50
+ # @!attribute rows_deleted
51
+ # The number of rows deleted by the write request.
52
+ #
53
+ # @return [Integer, nil]
54
+ optional :rows_deleted, Integer
55
+
56
+ # @!attribute rows_patched
57
+ # The number of rows patched by the write request.
58
+ #
59
+ # @return [Integer, nil]
60
+ optional :rows_patched, Integer
61
+
62
+ # @!attribute rows_remaining
63
+ # Whether more documents match the filter for partial operations.
64
+ #
65
+ # @return [Boolean, nil]
66
+ optional :rows_remaining, Turbopuffer::Internal::Type::Boolean
67
+
68
+ # @!attribute rows_upserted
69
+ # The number of rows upserted by the write request.
70
+ #
71
+ # @return [Integer, nil]
72
+ optional :rows_upserted, Integer
73
+
74
+ # @!attribute upserted_ids
75
+ # The IDs of documents that were upserted. Only included when
76
+ # `return_affected_ids` is true and at least one document was upserted.
77
+ #
78
+ # @return [Array<String, Integer>, nil]
79
+ optional :upserted_ids, -> { Turbopuffer::Internal::Type::ArrayOf[union: Turbopuffer::ID] }
80
+
81
+ # @!method initialize(billing:, message:, rows_affected:, deleted_ids: nil, patched_ids: nil, performance: nil, rows_deleted: nil, rows_patched: nil, rows_remaining: nil, rows_upserted: nil, upserted_ids: nil, status: :OK)
82
+ # Some parameter documentations has been truncated, see
83
+ # {Turbopuffer::Models::WriteResult} for more details.
84
+ #
85
+ # The response to a successful write request.
86
+ #
87
+ # @param billing [Turbopuffer::Models::WriteBilling] The billing information for a write request.
88
+ #
89
+ # @param message [String] A message describing the result of the write request.
90
+ #
91
+ # @param rows_affected [Integer] The number of rows affected by the write request.
92
+ #
93
+ # @param deleted_ids [Array<String, Integer>] The IDs of documents that were deleted. Only included when `return_affected_ids`
94
+ #
95
+ # @param patched_ids [Array<String, Integer>] The IDs of documents that were patched. Only included when `return_affected_ids`
96
+ #
97
+ # @param performance [Turbopuffer::Models::WritePerformance] The performance information for a write request.
98
+ #
99
+ # @param rows_deleted [Integer] The number of rows deleted by the write request.
100
+ #
101
+ # @param rows_patched [Integer] The number of rows patched by the write request.
102
+ #
103
+ # @param rows_remaining [Boolean] Whether more documents match the filter for partial operations.
104
+ #
105
+ # @param rows_upserted [Integer] The number of rows upserted by the write request.
106
+ #
107
+ # @param upserted_ids [Array<String, Integer>] The IDs of documents that were upserted. Only included when `return_affected_ids
108
+ #
109
+ # @param status [Symbol, :OK] The status of the request.
110
+ end
111
+ end
112
+ end
@@ -50,6 +50,8 @@ module Turbopuffer
50
50
 
51
51
  AttributeSchemaConfig = Turbopuffer::Models::AttributeSchemaConfig
52
52
 
53
+ AttributeSchemaDrop = Turbopuffer::Models::AttributeSchemaDrop
54
+
53
55
  AttributeType = Turbopuffer::Models::AttributeType
54
56
 
55
57
  Bm25ClauseParams = Turbopuffer::Models::Bm25ClauseParams
@@ -64,6 +66,10 @@ module Turbopuffer
64
66
 
65
67
  ContainsAnyTokenFilterParams = Turbopuffer::Models::ContainsAnyTokenFilterParams
66
68
 
69
+ CopyFromNamespaceOperation = Turbopuffer::Models::CopyFromNamespaceOperation
70
+
71
+ CopyFromNamespaceOperationResult = Turbopuffer::Models::CopyFromNamespaceOperationResult
72
+
67
73
  CopyFromNamespaceParams = Turbopuffer::Models::CopyFromNamespaceParams
68
74
 
69
75
  DecayParams = Turbopuffer::Models::DecayParams
@@ -114,12 +120,16 @@ module Turbopuffer
114
120
 
115
121
  NamespaceMultiQueryParams = Turbopuffer::Models::NamespaceMultiQueryParams
116
122
 
123
+ NamespacePollCopyFromParams = Turbopuffer::Models::NamespacePollCopyFromParams
124
+
117
125
  NamespaceQueryParams = Turbopuffer::Models::NamespaceQueryParams
118
126
 
119
127
  NamespaceRecallParams = Turbopuffer::Models::NamespaceRecallParams
120
128
 
121
129
  NamespaceSchemaParams = Turbopuffer::Models::NamespaceSchemaParams
122
130
 
131
+ NamespaceStartCopyFromParams = Turbopuffer::Models::NamespaceStartCopyFromParams
132
+
123
133
  NamespaceSummary = Turbopuffer::Models::NamespaceSummary
124
134
 
125
135
  NamespaceUpdateMetadataParams = Turbopuffer::Models::NamespaceUpdateMetadataParams
@@ -128,12 +138,16 @@ module Turbopuffer
128
138
 
129
139
  NamespaceWriteParams = Turbopuffer::Models::NamespaceWriteParams
130
140
 
141
+ OperationError = Turbopuffer::Models::OperationError
142
+
131
143
  PinningConfig = Turbopuffer::Models::PinningConfig
132
144
 
133
145
  QueryBilling = Turbopuffer::Models::QueryBilling
134
146
 
135
147
  QueryPerformance = Turbopuffer::Models::QueryPerformance
136
148
 
149
+ RerankLimit = Turbopuffer::Models::RerankLimit
150
+
137
151
  Row = Turbopuffer::Models::Row
138
152
 
139
153
  RrfParams = Turbopuffer::Models::RrfParams
@@ -153,4 +167,6 @@ module Turbopuffer
153
167
  WriteBilling = Turbopuffer::Models::WriteBilling
154
168
 
155
169
  WritePerformance = Turbopuffer::Models::WritePerformance
170
+
171
+ WriteResult = Turbopuffer::Models::WriteResult
156
172
  end
@@ -98,7 +98,7 @@ module Turbopuffer
98
98
  #
99
99
  # Explain a query plan.
100
100
  #
101
- # @overload explain_query(namespace: nil, aggregate_by: nil, compute_attributes: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, limit: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
101
+ # @overload explain_query(namespace: nil, aggregate_by: nil, compute_attributes: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, limit: nil, offset: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
102
102
  #
103
103
  # @param namespace [String] Path param: The name of the namespace.
104
104
  #
@@ -120,6 +120,8 @@ module Turbopuffer
120
120
  #
121
121
  # @param limit [Integer, Turbopuffer::Models::Limit] Body param: Limits the documents returned by a query.
122
122
  #
123
+ # @param offset [Integer] Body param: Number of documents to skip before returning results. Supported only
124
+ #
123
125
  # @param rank_by [Object] Body param: How to rank the documents in the namespace.
124
126
  #
125
127
  # @param top_k [Integer] Body param: The number of results to return.
@@ -201,7 +203,7 @@ module Turbopuffer
201
203
  #
202
204
  # Issue multiple concurrent queries filter or search documents.
203
205
  #
204
- # @overload multi_query(queries:, namespace: nil, consistency: nil, rerank_by: nil, vector_encoding: nil, request_options: {})
206
+ # @overload multi_query(queries:, namespace: nil, consistency: nil, limit: nil, offset: nil, rerank_by: nil, vector_encoding: nil, request_options: {})
205
207
  #
206
208
  # @param queries [Array<Turbopuffer::Models::NamespaceMultiQueryParams::Query>] Body param
207
209
  #
@@ -209,6 +211,10 @@ module Turbopuffer
209
211
  #
210
212
  # @param consistency [Turbopuffer::Models::NamespaceMultiQueryParams::Consistency] Body param: The consistency level for a query.
211
213
  #
214
+ # @param limit [Integer, Turbopuffer::Models::RerankLimit] Body param: Limits the total number of reranked documents returned.
215
+ #
216
+ # @param offset [Integer] Body param: Number of reranked documents to skip before returning results. Requi
217
+ #
212
218
  # @param rerank_by [Object] Body param: How to combine the rows returned by each sub-query into a single ran
213
219
  #
214
220
  # @param vector_encoding [Symbol, Turbopuffer::Models::VectorEncoding] Body param: The encoding to use for vectors in the response.
@@ -233,12 +239,39 @@ module Turbopuffer
233
239
  )
234
240
  end
235
241
 
242
+ # Retrieve the current status of a copy operation.
243
+ #
244
+ # @overload poll_copy_from(token, namespace: nil, request_options: {})
245
+ #
246
+ # @param token [String] The operation token obtained when starting the copy.
247
+ #
248
+ # @param namespace [String] The name of the namespace.
249
+ #
250
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}, nil]
251
+ #
252
+ # @return [Turbopuffer::Models::CopyFromNamespaceOperation::Running, Turbopuffer::Models::CopyFromNamespaceOperation::Finished]
253
+ #
254
+ # @see Turbopuffer::Models::NamespacePollCopyFromParams
255
+ def poll_copy_from(token, params = {})
256
+ parsed, options = Turbopuffer::NamespacePollCopyFromParams.dump_request(params)
257
+ namespace =
258
+ parsed.delete(:namespace) do
259
+ @client.default_namespace
260
+ end
261
+ @client.request(
262
+ method: :get,
263
+ path: ["v1/namespaces/%1$s/operations/%2$s?stainless_overload=pollCopyFrom", namespace, token],
264
+ model: Turbopuffer::CopyFromNamespaceOperation,
265
+ options: options
266
+ )
267
+ end
268
+
236
269
  # Some parameter documentations has been truncated, see
237
270
  # {Turbopuffer::Models::NamespaceQueryParams} for more details.
238
271
  #
239
272
  # Query, filter, full-text search and vector search documents.
240
273
  #
241
- # @overload query(namespace: nil, aggregate_by: nil, compute_attributes: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, limit: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
274
+ # @overload query(namespace: nil, aggregate_by: nil, compute_attributes: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, limit: nil, offset: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
242
275
  #
243
276
  # @param namespace [String] Path param: The name of the namespace.
244
277
  #
@@ -260,6 +293,8 @@ module Turbopuffer
260
293
  #
261
294
  # @param limit [Integer, Turbopuffer::Models::Limit] Body param: Limits the documents returned by a query.
262
295
  #
296
+ # @param offset [Integer] Body param: Number of documents to skip before returning results. Supported only
297
+ #
263
298
  # @param rank_by [Object] Body param: How to rank the documents in the namespace.
264
299
  #
265
300
  # @param top_k [Integer] Body param: The number of results to return.
@@ -350,17 +385,58 @@ module Turbopuffer
350
385
  )
351
386
  end
352
387
 
388
+ # Some parameter documentations has been truncated, see
389
+ # {Turbopuffer::Models::NamespaceStartCopyFromParams} for more details.
390
+ #
391
+ # Start copying all documents from another namespace into this one. Returns an
392
+ # operation token without waiting for the copy to finish. Use the token to poll
393
+ # for progress and the result.
394
+ #
395
+ # @overload start_copy_from(source_namespace:, namespace: nil, dest_encryption: nil, source_api_key: nil, source_region: nil, request_options: {})
396
+ #
397
+ # @param source_namespace [String] Body param: The namespace to copy documents from.
398
+ #
399
+ # @param namespace [String] Path param: The name of the namespace.
400
+ #
401
+ # @param dest_encryption [Turbopuffer::Models::Encryption::CustomerManaged, Turbopuffer::Models::Encryption::Default] Body param: (Optional) The encryption configuration for the destination namespac
402
+ #
403
+ # @param source_api_key [String] Body param: (Optional) An API key for the organization containing the source nam
404
+ #
405
+ # @param source_region [String] Body param: (Optional) The region of the source namespace.
406
+ #
407
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}, nil]
408
+ #
409
+ # @return [Turbopuffer::Models::NamespaceStartCopyFromResponse]
410
+ #
411
+ # @see Turbopuffer::Models::NamespaceStartCopyFromParams
412
+ def start_copy_from(params)
413
+ parsed, options = Turbopuffer::NamespaceStartCopyFromParams.dump_request(params)
414
+ namespace =
415
+ parsed.delete(:namespace) do
416
+ @client.default_namespace
417
+ end
418
+ @client.request(
419
+ method: :post,
420
+ path: ["v2/namespaces/%1$s/async?stainless_overload=startCopyFrom", namespace],
421
+ body: {copy_from_namespace: parsed},
422
+ model: Turbopuffer::Models::NamespaceStartCopyFromResponse,
423
+ options: options
424
+ )
425
+ end
426
+
353
427
  # Some parameter documentations has been truncated, see
354
428
  # {Turbopuffer::Models::NamespaceUpdateMetadataParams} for more details.
355
429
  #
356
430
  # Update metadata configuration for a namespace.
357
431
  #
358
- # @overload update_metadata(namespace: nil, pinning: nil, request_options: {})
432
+ # @overload update_metadata(namespace: nil, pinning: nil, read_only: nil, request_options: {})
359
433
  #
360
434
  # @param namespace [String] Path param: The name of the namespace.
361
435
  #
362
436
  # @param pinning [Boolean, Turbopuffer::Models::PinningConfig, nil] Body param: Configuration for namespace pinning.
363
437
  #
438
+ # @param read_only [Boolean] Body param: Set to `true` to reject document and schema writes, or `false` to al
439
+ #
364
440
  # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}, nil]
365
441
  #
366
442
  # @return [Turbopuffer::Models::NamespaceMetadata]
@@ -387,7 +463,7 @@ module Turbopuffer
387
463
  #
388
464
  # @param namespace [String] Path param: The name of the namespace.
389
465
  #
390
- # @param schema [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig}] Body param: The desired schema for the namespace.
466
+ # @param schema [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig, Turbopuffer::Models::AttributeSchemaDrop}] Body param: The desired schema for the namespace.
391
467
  #
392
468
  # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}, nil]
393
469
  #
@@ -414,7 +490,7 @@ module Turbopuffer
414
490
  #
415
491
  # Create, update, or delete documents.
416
492
  #
417
- # @overload write(namespace: nil, branch_from_namespace: nil, copy_from_namespace: nil, delete_by_filter: nil, delete_by_filter_allow_partial: nil, delete_condition: nil, deletes: nil, disable_backpressure: nil, distance_metric: nil, encryption: nil, patch_by_filter: nil, patch_by_filter_allow_partial: nil, patch_columns: nil, patch_condition: nil, patch_rows: nil, return_affected_ids: nil, schema: nil, sharding: nil, upsert_columns: nil, upsert_condition: nil, upsert_rows: nil, request_options: {})
493
+ # @overload write(namespace: nil, branch_from_namespace: nil, copy_from_namespace: nil, create_namespace: nil, delete_by_filter: nil, delete_by_filter_allow_partial: nil, delete_condition: nil, deletes: nil, disable_backpressure: nil, distance_metric: nil, encryption: nil, patch_by_filter: nil, patch_by_filter_allow_partial: nil, patch_columns: nil, patch_condition: nil, patch_rows: nil, return_affected_ids: nil, schema: nil, sharding: nil, upsert_columns: nil, upsert_condition: nil, upsert_rows: nil, request_options: {})
418
494
  #
419
495
  # @param namespace [String] Path param: The name of the namespace.
420
496
  #
@@ -422,6 +498,8 @@ module Turbopuffer
422
498
  #
423
499
  # @param copy_from_namespace [String, Turbopuffer::Models::CopyFromNamespaceParams::CopyFromNamespaceConfig] Body param: The namespace to copy documents from.
424
500
  #
501
+ # @param create_namespace [Boolean] Body param: If `true`, ensures the namespace is created, even if the request wri
502
+ #
425
503
  # @param delete_by_filter [Object] Body param: The filter specifying which documents to delete.
426
504
  #
427
505
  # @param delete_by_filter_allow_partial [Boolean] Body param: Allow partial completion when filter matches too many documents.
@@ -448,7 +526,7 @@ module Turbopuffer
448
526
  #
449
527
  # @param return_affected_ids [Boolean] Body param: If true, return the IDs of affected rows (deleted, patched, upserted
450
528
  #
451
- # @param schema [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig}] Body param: The schema of the attributes attached to the documents.
529
+ # @param schema [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig, Turbopuffer::Models::AttributeSchemaDrop}] Body param: The schema of the attributes attached to the documents.
452
530
  #
453
531
  # @param sharding [Turbopuffer::Models::ShardingConfig] Body param: Configuration for namespace sharding, which partitions a namespace's
454
532
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Turbopuffer
4
- VERSION = "2.4.0"
4
+ VERSION = "2.6.0"
5
5
  end
data/lib/turbopuffer.rb CHANGED
@@ -61,6 +61,7 @@ require_relative "turbopuffer/models/attribute_embed"
61
61
  require_relative "turbopuffer/models/attribute_embed_config"
62
62
  require_relative "turbopuffer/models/attribute_schema"
63
63
  require_relative "turbopuffer/models/attribute_schema_config"
64
+ require_relative "turbopuffer/models/attribute_schema_drop"
64
65
  require_relative "turbopuffer/models/attribute_type"
65
66
  require_relative "turbopuffer/models/bm25_clause_params"
66
67
  require_relative "turbopuffer/models/branch_from_namespace_params"
@@ -68,6 +69,8 @@ require_relative "turbopuffer/models/client_namespaces_params"
68
69
  require_relative "turbopuffer/models/columns"
69
70
  require_relative "turbopuffer/models/contains_all_tokens_filter_params"
70
71
  require_relative "turbopuffer/models/contains_any_token_filter_params"
72
+ require_relative "turbopuffer/models/copy_from_namespace_operation"
73
+ require_relative "turbopuffer/models/copy_from_namespace_operation_result"
71
74
  require_relative "turbopuffer/models/copy_from_namespace_params"
72
75
  require_relative "turbopuffer/models/decay_params"
73
76
  require_relative "turbopuffer/models/distance_metric"
@@ -98,20 +101,25 @@ require_relative "turbopuffer/models/namespace_metadata"
98
101
  require_relative "turbopuffer/models/namespace_metadata_params"
99
102
  require_relative "turbopuffer/models/namespace_multi_query_params"
100
103
  require_relative "turbopuffer/models/namespace_multi_query_response"
104
+ require_relative "turbopuffer/models/namespace_poll_copy_from_params"
101
105
  require_relative "turbopuffer/models/namespace_query_params"
102
106
  require_relative "turbopuffer/models/namespace_query_response"
103
107
  require_relative "turbopuffer/models/namespace_recall_params"
104
108
  require_relative "turbopuffer/models/namespace_recall_response"
105
109
  require_relative "turbopuffer/models/namespace_schema_params"
106
110
  require_relative "turbopuffer/models/namespace_schema_response"
111
+ require_relative "turbopuffer/models/namespace_start_copy_from_params"
112
+ require_relative "turbopuffer/models/namespace_start_copy_from_response"
107
113
  require_relative "turbopuffer/models/namespace_summary"
108
114
  require_relative "turbopuffer/models/namespace_update_metadata_params"
109
115
  require_relative "turbopuffer/models/namespace_update_schema_params"
110
116
  require_relative "turbopuffer/models/namespace_update_schema_response"
111
117
  require_relative "turbopuffer/models/namespace_write_params"
112
118
  require_relative "turbopuffer/models/namespace_write_response"
119
+ require_relative "turbopuffer/models/operation_error"
113
120
  require_relative "turbopuffer/models/query_billing"
114
121
  require_relative "turbopuffer/models/query_performance"
122
+ require_relative "turbopuffer/models/rerank_limit"
115
123
  require_relative "turbopuffer/models/row"
116
124
  require_relative "turbopuffer/models/rrf_params"
117
125
  require_relative "turbopuffer/models/saturate_params"
@@ -122,6 +130,7 @@ require_relative "turbopuffer/models/vector"
122
130
  require_relative "turbopuffer/models/vector_encoding"
123
131
  require_relative "turbopuffer/models/write_billing"
124
132
  require_relative "turbopuffer/models/write_performance"
133
+ require_relative "turbopuffer/models/write_result"
125
134
  require_relative "turbopuffer/models"
126
135
  require_relative "turbopuffer/resources/namespaces"
127
136
  require_relative "turbopuffer/namespace"
@@ -10,7 +10,7 @@ module Turbopuffer
10
10
 
11
11
  DEFAULT_MAX_RETRY_DELAY = T.let(8.0, Float)
12
12
 
13
- # API key used for authentication
13
+ # API key used for authentication.
14
14
  sig { returns(String) }
15
15
  attr_reader :api_key
16
16
 
@@ -73,7 +73,7 @@ module Turbopuffer
73
73
  ).returns(T.attached_class)
74
74
  end
75
75
  def self.new(
76
- # API key used for authentication Defaults to `ENV["TURBOPUFFER_API_KEY"]`
76
+ # API key used for authentication. Defaults to `ENV["TURBOPUFFER_API_KEY"]`
77
77
  api_key: ENV["TURBOPUFFER_API_KEY"],
78
78
  # The turbopuffer region to use. Defaults to `ENV["TURBOPUFFER_REGION"]`
79
79
  region: ENV["TURBOPUFFER_REGION"],
@@ -7,7 +7,13 @@ module Turbopuffer
7
7
  extend Turbopuffer::Internal::Type::Union
8
8
 
9
9
  Variants =
10
- T.type_alias { T.any(String, Turbopuffer::AttributeSchemaConfig) }
10
+ T.type_alias do
11
+ T.any(
12
+ String,
13
+ Turbopuffer::AttributeSchemaConfig,
14
+ Turbopuffer::AttributeSchemaDrop
15
+ )
16
+ end
11
17
 
12
18
  sig { override.returns(T::Array[Turbopuffer::AttributeSchema::Variants]) }
13
19
  def self.variants
@@ -0,0 +1,32 @@
1
+ # typed: strong
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class AttributeSchemaDrop < Turbopuffer::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Turbopuffer::AttributeSchemaDrop,
10
+ Turbopuffer::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # Must be `true`.
15
+ sig { returns(T::Boolean) }
16
+ attr_accessor :drop
17
+
18
+ # Drops the attribute from the namespace. Cannot be combined with other schema
19
+ # settings.
20
+ sig { params(drop: T::Boolean).returns(T.attached_class) }
21
+ def self.new(
22
+ # Must be `true`.
23
+ drop:
24
+ )
25
+ end
26
+
27
+ sig { override.returns({ drop: T::Boolean }) }
28
+ def to_hash
29
+ end
30
+ end
31
+ end
32
+ end