turbopuffer 1.18.0 → 1.19.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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +1 -1
  4. data/lib/turbopuffer/internal/util.rb +19 -6
  5. data/lib/turbopuffer/models/attribute_schema_config.rb +9 -1
  6. data/lib/turbopuffer/models/namespace_metadata.rb +58 -1
  7. data/lib/turbopuffer/models/namespace_metadata_patch.rb +46 -0
  8. data/lib/turbopuffer/models/namespace_recall_params.rb +10 -1
  9. data/lib/turbopuffer/models/namespace_update_metadata_params.rb +20 -0
  10. data/lib/turbopuffer/models/pinning_config.rb +18 -0
  11. data/lib/turbopuffer/models.rb +6 -0
  12. data/lib/turbopuffer/resources/namespaces.rb +34 -1
  13. data/lib/turbopuffer/version.rb +1 -1
  14. data/lib/turbopuffer.rb +3 -0
  15. data/rbi/turbopuffer/internal/util.rbi +8 -0
  16. data/rbi/turbopuffer/models/attribute_schema_config.rbi +11 -0
  17. data/rbi/turbopuffer/models/namespace_metadata.rbi +112 -3
  18. data/rbi/turbopuffer/models/namespace_metadata_patch.rbi +71 -0
  19. data/rbi/turbopuffer/models/namespace_recall_params.rbi +13 -0
  20. data/rbi/turbopuffer/models/namespace_update_metadata_params.rbi +41 -0
  21. data/rbi/turbopuffer/models/pinning_config.rbi +31 -0
  22. data/rbi/turbopuffer/models.rbi +7 -0
  23. data/rbi/turbopuffer/resources/namespaces.rbi +27 -0
  24. data/sig/turbopuffer/internal/util.rbs +4 -0
  25. data/sig/turbopuffer/models/attribute_schema_config.rbs +7 -0
  26. data/sig/turbopuffer/models/namespace_metadata.rbs +53 -3
  27. data/sig/turbopuffer/models/namespace_metadata_patch.rbs +26 -0
  28. data/sig/turbopuffer/models/namespace_recall_params.rbs +7 -0
  29. data/sig/turbopuffer/models/namespace_update_metadata_params.rbs +25 -0
  30. data/sig/turbopuffer/models/pinning_config.rbs +15 -0
  31. data/sig/turbopuffer/models.rbs +6 -0
  32. data/sig/turbopuffer/resources/namespaces.rbs +7 -0
  33. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 392026af67d721a1c1e41655fa994e4b091513a09098debb10dfe3d7f5b28b10
4
- data.tar.gz: b2594569c7c125a0ac5adf38e0a2837143672f8c5e2fac0d2c6e44c1a9e74f27
3
+ metadata.gz: 5b7d18934b6b6f5b4bca87b243216d1ba458598472cc5df4751bf1e23b8eb38c
4
+ data.tar.gz: 9ae7f3ad01c68fa4c76ad46419949bca2c957362e3e6bc96a2f9becf762632ea
5
5
  SHA512:
6
- metadata.gz: 5479a222309efe4bcf5c8405c3801e1b69701ae752e97629503da8fb575267f6a5ae1c9ad25761c76c4cc0e390e8ba5b236fdbd950fbcd4a6901ab7f9d4170e9
7
- data.tar.gz: c8ae2cdf9de61b0766fb85f8de6e647d8eeda1d5d59fa5de98dbe69d22d02ae7a7106e4ac9403cba15a5449f21bff58cea6b0cf015dbbd89072f94c5bae02a6b
6
+ metadata.gz: c22b27d365408dec9029a0dd8b876fc3701c05e6ac69b9caf7e4a31140ff7af3635d31499421667b1ba026f15ef8f934bbe4a47378a4225720e0624626ec1f8a
7
+ data.tar.gz: 6b5ddcafe494903ed7bda7b113906feba7a150d7a51663b297c7134160fc2146fc35f7bb3e62b724a950d13e6a8e5cc42b6f420fce244a9a08d80203858507cc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.19.0 (2026-04-06)
4
+
5
+ Full Changelog: [v1.18.0...v1.19.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v1.18.0...v1.19.0)
6
+
7
+ ### Features
8
+
9
+ * add update_metadata method to configure pinning ([f59a80b](https://github.com/turbopuffer/turbopuffer-ruby/commit/f59a80b8ff95b181a07d7bf2feb9715bf6ed2080))
10
+ * docs for glob/regex acceleration ([bafcf09](https://github.com/turbopuffer/turbopuffer-ruby/commit/bafcf09b3b25db23394a76cf6acb688f471a35ea))
11
+ * Multiple Vector Columns Docs ([76392ee](https://github.com/turbopuffer/turbopuffer-ruby/commit/76392ee17ea6ea2d177b7002ca791c27bff394d6))
12
+ * spec: include pinning status in /metadata response ([0ff4fa4](https://github.com/turbopuffer/turbopuffer-ruby/commit/0ff4fa4877dea26f3c5786891632b060e97ad7a2))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * align path encoding with RFC 3986 section 3.3 ([77633f8](https://github.com/turbopuffer/turbopuffer-ruby/commit/77633f885d255631ce1d4b48075c87f5120973ab))
18
+ * **internal:** correct multipart form field name encoding ([7f54d40](https://github.com/turbopuffer/turbopuffer-ruby/commit/7f54d4035b422d568d640ad74d0a311135743927))
19
+ * variable name typo ([7b17a7a](https://github.com/turbopuffer/turbopuffer-ruby/commit/7b17a7a9830198e0ffa46c406bdf87ea865f5863))
20
+
21
+
22
+ ### Chores
23
+
24
+ * **ci:** skip lint on metadata-only changes ([016dab3](https://github.com/turbopuffer/turbopuffer-ruby/commit/016dab37b9e2e92fb14dfea9e814590f329a7cc5))
25
+ * **ci:** support opting out of skipping builds on metadata-only commits ([afc1d7d](https://github.com/turbopuffer/turbopuffer-ruby/commit/afc1d7d3f532ac4d79b73a171308d627e14afd68))
26
+ * **internal:** update gitignore ([cb07b77](https://github.com/turbopuffer/turbopuffer-ruby/commit/cb07b772afcb6337e032217f724cc9d121004adc))
27
+
3
28
  ## 1.18.0 (2026-03-20)
4
29
 
5
30
  Full Changelog: [v1.17.0...v1.18.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v1.17.0...v1.18.0)
data/README.md CHANGED
@@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application
26
26
  <!-- x-release-please-start-version -->
27
27
 
28
28
  ```ruby
29
- gem "turbopuffer", "~> 1.18.0"
29
+ gem "turbopuffer", "~> 1.19.0"
30
30
  ```
31
31
 
32
32
  <!-- x-release-please-end -->
@@ -157,7 +157,7 @@ module Turbopuffer
157
157
  in Hash | nil => coerced
158
158
  coerced
159
159
  else
160
- message = "Expected a #{Hash} or #{Turbopuffer::Internal::Type::BaseModel}, got #{data.inspect}"
160
+ message = "Expected a #{Hash} or #{Turbopuffer::Internal::Type::BaseModel}, got #{input.inspect}"
161
161
  raise ArgumentError.new(message)
162
162
  end
163
163
  end
@@ -237,6 +237,11 @@ module Turbopuffer
237
237
  end
238
238
  end
239
239
 
240
+ # @type [Regexp]
241
+ #
242
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
243
+ RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/
244
+
240
245
  class << self
241
246
  # @api private
242
247
  #
@@ -247,6 +252,15 @@ module Turbopuffer
247
252
  "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
248
253
  end
249
254
 
255
+ # @api private
256
+ #
257
+ # @param path [String, Integer]
258
+ #
259
+ # @return [String]
260
+ def encode_path(path)
261
+ path.to_s.gsub(Turbopuffer::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) }
262
+ end
263
+
250
264
  # @api private
251
265
  #
252
266
  # @param path [String, Array<String>]
@@ -259,7 +273,7 @@ module Turbopuffer
259
273
  in []
260
274
  ""
261
275
  in [String => p, *interpolations]
262
- encoded = interpolations.map { ERB::Util.url_encode(_1) }
276
+ encoded = interpolations.map { encode_path(_1) }
263
277
  format(p, *encoded)
264
278
  end
265
279
  end
@@ -571,16 +585,15 @@ module Turbopuffer
571
585
  y << "Content-Disposition: form-data"
572
586
 
573
587
  unless key.nil?
574
- name = ERB::Util.url_encode(key.to_s)
575
- y << "; name=\"#{name}\""
588
+ y << "; name=\"#{key}\""
576
589
  end
577
590
 
578
591
  case val
579
592
  in Turbopuffer::FilePart unless val.filename.nil?
580
- filename = ERB::Util.url_encode(val.filename)
593
+ filename = encode_path(val.filename)
581
594
  y << "; filename=\"#{filename}\""
582
595
  in Pathname | IO
583
- filename = ERB::Util.url_encode(::File.basename(val.to_path))
596
+ filename = encode_path(::File.basename(val.to_path))
584
597
  y << "; filename=\"#{filename}\""
585
598
  else
586
599
  end
@@ -32,13 +32,19 @@ module Turbopuffer
32
32
  # @return [Boolean, Turbopuffer::Models::FullTextSearchConfig, nil]
33
33
  optional :full_text_search, union: -> { Turbopuffer::FullTextSearch }
34
34
 
35
+ # @!attribute glob
36
+ # Whether to enable Glob filters on this attribute.
37
+ #
38
+ # @return [Boolean, nil]
39
+ optional :glob, Turbopuffer::Internal::Type::Boolean
40
+
35
41
  # @!attribute regex
36
42
  # Whether to enable Regex filters on this attribute.
37
43
  #
38
44
  # @return [Boolean, nil]
39
45
  optional :regex, Turbopuffer::Internal::Type::Boolean
40
46
 
41
- # @!method initialize(type:, ann: nil, filterable: nil, full_text_search: nil, regex: nil)
47
+ # @!method initialize(type:, ann: nil, filterable: nil, full_text_search: nil, glob: nil, regex: nil)
42
48
  # Some parameter documentations has been truncated, see
43
49
  # {Turbopuffer::Models::AttributeSchemaConfig} for more details.
44
50
  #
@@ -52,6 +58,8 @@ module Turbopuffer
52
58
  #
53
59
  # @param full_text_search [Boolean, Turbopuffer::Models::FullTextSearchConfig] Whether this attribute can be used as part of a BM25 full-text search. Requires
54
60
  #
61
+ # @param glob [Boolean] Whether to enable Glob filters on this attribute.
62
+ #
55
63
  # @param regex [Boolean] Whether to enable Regex filters on this attribute.
56
64
 
57
65
  # Whether to create an approximate nearest neighbor index for the attribute. Can
@@ -46,7 +46,14 @@ module Turbopuffer
46
46
  # @return [Time]
47
47
  required :updated_at, Time
48
48
 
49
- # @!method initialize(approx_logical_bytes:, approx_row_count:, created_at:, encryption:, index:, schema:, updated_at:)
49
+ # @!attribute pinning
50
+ # Configuration for namespace pinning, along with the current status of the pinned
51
+ # namespace.
52
+ #
53
+ # @return [Turbopuffer::Models::NamespaceMetadata::Pinning, nil]
54
+ optional :pinning, -> { Turbopuffer::NamespaceMetadata::Pinning }
55
+
56
+ # @!method initialize(approx_logical_bytes:, approx_row_count:, created_at:, encryption:, index:, schema:, updated_at:, pinning: nil)
50
57
  # Some parameter documentations has been truncated, see
51
58
  # {Turbopuffer::Models::NamespaceMetadata} for more details.
52
59
  #
@@ -65,6 +72,8 @@ module Turbopuffer
65
72
  # @param schema [Hash{Symbol=>Turbopuffer::Models::AttributeSchemaConfig}] The schema of the namespace.
66
73
  #
67
74
  # @param updated_at [Time] The timestamp when the namespace was last modified by a write operation.
75
+ #
76
+ # @param pinning [Turbopuffer::Models::NamespaceMetadata::Pinning] Configuration for namespace pinning, along with the current status of the pinned
68
77
 
69
78
  # Indicates that the namespace is encrypted with a customer-managed encryption key
70
79
  # (CMEK).
@@ -161,6 +170,54 @@ module Turbopuffer
161
170
  # @!method self.variants
162
171
  # @return [Array(Turbopuffer::Models::NamespaceMetadata::Index::IndexUpToDate, Turbopuffer::Models::NamespaceMetadata::Index::IndexUpdating)]
163
172
  end
173
+
174
+ # @see Turbopuffer::Models::NamespaceMetadata#pinning
175
+ class Pinning < Turbopuffer::Models::PinningConfig
176
+ # @!attribute status
177
+ # Operational status for a pinned namespace.
178
+ #
179
+ # @return [Turbopuffer::Models::NamespaceMetadata::Pinning::Status, nil]
180
+ optional :status, -> { Turbopuffer::NamespaceMetadata::Pinning::Status }
181
+
182
+ # @!method initialize(status: nil)
183
+ # Configuration for namespace pinning, along with the current status of the pinned
184
+ # namespace.
185
+ #
186
+ # @param status [Turbopuffer::Models::NamespaceMetadata::Pinning::Status] Operational status for a pinned namespace.
187
+
188
+ class Status < Turbopuffer::Internal::Type::BaseModel
189
+ # @!attribute ready_replicas
190
+ # The number of replicas that are warm and serving traffic.
191
+ #
192
+ # @return [Integer]
193
+ required :ready_replicas, Integer
194
+
195
+ # @!attribute updated_at
196
+ # The timestamp of the latest pinning status snapshot.
197
+ #
198
+ # @return [Time]
199
+ required :updated_at, Time
200
+
201
+ # @!attribute utilization
202
+ # Aggregate utilization for the pinned namespace, reported as a value between 0.0
203
+ # and 1.0.
204
+ #
205
+ # @return [Float]
206
+ required :utilization, Float
207
+
208
+ # @!method initialize(ready_replicas:, updated_at:, utilization:)
209
+ # Some parameter documentations has been truncated, see
210
+ # {Turbopuffer::Models::NamespaceMetadata::Pinning::Status} for more details.
211
+ #
212
+ # Operational status for a pinned namespace.
213
+ #
214
+ # @param ready_replicas [Integer] The number of replicas that are warm and serving traffic.
215
+ #
216
+ # @param updated_at [Time] The timestamp of the latest pinning status snapshot.
217
+ #
218
+ # @param utilization [Float] Aggregate utilization for the pinned namespace, reported as a value between 0.0
219
+ end
220
+ end
164
221
  end
165
222
  end
166
223
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class NamespaceMetadataPatch < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute pinning
7
+ # Configuration for namespace pinning.
8
+ #
9
+ # - Missing field: no change to pinning configuration
10
+ # - `null` or `false`: explicitly remove pinning
11
+ # - `true`: enable pinning with default configuration
12
+ # - Object: set pinning configuration
13
+ #
14
+ # @return [Boolean, Turbopuffer::Models::PinningConfig, nil]
15
+ optional :pinning, union: -> { Turbopuffer::NamespaceMetadataPatch::Pinning }, nil?: true
16
+
17
+ # @!method initialize(pinning: nil)
18
+ # Some parameter documentations has been truncated, see
19
+ # {Turbopuffer::Models::NamespaceMetadataPatch} for more details.
20
+ #
21
+ # Request to update namespace metadata configuration.
22
+ #
23
+ # @param pinning [Boolean, Turbopuffer::Models::PinningConfig, nil] Configuration for namespace pinning.
24
+
25
+ # Configuration for namespace pinning.
26
+ #
27
+ # - Missing field: no change to pinning configuration
28
+ # - `null` or `false`: explicitly remove pinning
29
+ # - `true`: enable pinning with default configuration
30
+ # - Object: set pinning configuration
31
+ #
32
+ # @see Turbopuffer::Models::NamespaceMetadataPatch#pinning
33
+ module Pinning
34
+ extend Turbopuffer::Internal::Type::Union
35
+
36
+ variant Turbopuffer::Internal::Type::Boolean
37
+
38
+ # Configuration for namespace pinning.
39
+ variant -> { Turbopuffer::PinningConfig }
40
+
41
+ # @!method self.variants
42
+ # @return [Array(Boolean, Turbopuffer::Models::PinningConfig)]
43
+ end
44
+ end
45
+ end
46
+ end
@@ -31,13 +31,20 @@ module Turbopuffer
31
31
  # @return [Integer, nil]
32
32
  optional :num, Integer
33
33
 
34
+ # @!attribute rank_by
35
+ # The ranking function to evaluate recall for. If provided, `num` must be either
36
+ # null or 1.
37
+ #
38
+ # @return [Object, nil]
39
+ optional :rank_by, Turbopuffer::Internal::Type::Unknown
40
+
34
41
  # @!attribute top_k
35
42
  # Search for `top_k` nearest neighbors.
36
43
  #
37
44
  # @return [Integer, nil]
38
45
  optional :top_k, Integer
39
46
 
40
- # @!method initialize(namespace: nil, filters: nil, include_ground_truth: nil, num: nil, top_k: nil, request_options: {})
47
+ # @!method initialize(namespace: nil, filters: nil, include_ground_truth: nil, num: nil, rank_by: nil, top_k: nil, request_options: {})
41
48
  # Some parameter documentations has been truncated, see
42
49
  # {Turbopuffer::Models::NamespaceRecallParams} for more details.
43
50
  #
@@ -49,6 +56,8 @@ module Turbopuffer
49
56
  #
50
57
  # @param num [Integer] The number of searches to run.
51
58
  #
59
+ # @param rank_by [Object] The ranking function to evaluate recall for. If provided, `num` must be either n
60
+ #
52
61
  # @param top_k [Integer] Search for `top_k` nearest neighbors.
53
62
  #
54
63
  # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#update_metadata
6
+ class NamespaceUpdateMetadataParams < Turbopuffer::Models::NamespaceMetadataPatch
7
+ extend Turbopuffer::Internal::Type::RequestParameters::Converter
8
+ include Turbopuffer::Internal::Type::RequestParameters
9
+
10
+ # @!attribute namespace
11
+ #
12
+ # @return [String, nil]
13
+ optional :namespace, String
14
+
15
+ # @!method initialize(namespace: nil, request_options: {})
16
+ # @param namespace [String]
17
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class PinningConfig < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute replicas
7
+ # The number of read replicas to provision. Defaults to 1 if not specified.
8
+ #
9
+ # @return [Integer, nil]
10
+ optional :replicas, Integer
11
+
12
+ # @!method initialize(replicas: nil)
13
+ # Configuration for namespace pinning.
14
+ #
15
+ # @param replicas [Integer] The number of read replicas to provision. Defaults to 1 if not specified.
16
+ end
17
+ end
18
+ end
@@ -88,6 +88,8 @@ module Turbopuffer
88
88
 
89
89
  NamespaceMetadataParams = Turbopuffer::Models::NamespaceMetadataParams
90
90
 
91
+ NamespaceMetadataPatch = Turbopuffer::Models::NamespaceMetadataPatch
92
+
91
93
  NamespaceMultiQueryParams = Turbopuffer::Models::NamespaceMultiQueryParams
92
94
 
93
95
  NamespaceQueryParams = Turbopuffer::Models::NamespaceQueryParams
@@ -98,10 +100,14 @@ module Turbopuffer
98
100
 
99
101
  NamespaceSummary = Turbopuffer::Models::NamespaceSummary
100
102
 
103
+ NamespaceUpdateMetadataParams = Turbopuffer::Models::NamespaceUpdateMetadataParams
104
+
101
105
  NamespaceUpdateSchemaParams = Turbopuffer::Models::NamespaceUpdateSchemaParams
102
106
 
103
107
  NamespaceWriteParams = Turbopuffer::Models::NamespaceWriteParams
104
108
 
109
+ PinningConfig = Turbopuffer::Models::PinningConfig
110
+
105
111
  Query = Turbopuffer::Models::Query
106
112
 
107
113
  QueryBilling = Turbopuffer::Models::QueryBilling
@@ -217,7 +217,7 @@ module Turbopuffer
217
217
  #
218
218
  # Evaluate recall.
219
219
  #
220
- # @overload recall(namespace: nil, filters: nil, include_ground_truth: nil, num: nil, top_k: nil, request_options: {})
220
+ # @overload recall(namespace: nil, filters: nil, include_ground_truth: nil, num: nil, rank_by: nil, top_k: nil, request_options: {})
221
221
  #
222
222
  # @param namespace [String] Path param: The name of the namespace.
223
223
  #
@@ -227,6 +227,8 @@ module Turbopuffer
227
227
  #
228
228
  # @param num [Integer] Body param: The number of searches to run.
229
229
  #
230
+ # @param rank_by [Object] Body param: The ranking function to evaluate recall for. If provided, `num` must
231
+ #
230
232
  # @param top_k [Integer] Body param: Search for `top_k` nearest neighbors.
231
233
  #
232
234
  # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -274,6 +276,37 @@ module Turbopuffer
274
276
  )
275
277
  end
276
278
 
279
+ # Some parameter documentations has been truncated, see
280
+ # {Turbopuffer::Models::NamespaceUpdateMetadataParams} for more details.
281
+ #
282
+ # Update metadata configuration for a namespace.
283
+ #
284
+ # @overload update_metadata(namespace: nil, pinning: nil, request_options: {})
285
+ #
286
+ # @param namespace [String] Path param: The name of the namespace.
287
+ #
288
+ # @param pinning [Boolean, Turbopuffer::Models::PinningConfig, nil] Body param: Configuration for namespace pinning.
289
+ #
290
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}, nil]
291
+ #
292
+ # @return [Turbopuffer::Models::NamespaceMetadata]
293
+ #
294
+ # @see Turbopuffer::Models::NamespaceUpdateMetadataParams
295
+ def update_metadata(params = {})
296
+ parsed, options = Turbopuffer::NamespaceUpdateMetadataParams.dump_request(params)
297
+ namespace =
298
+ parsed.delete(:namespace) do
299
+ @client.default_namespace
300
+ end
301
+ @client.request(
302
+ method: :patch,
303
+ path: ["v1/namespaces/%1$s/metadata", namespace],
304
+ body: parsed,
305
+ model: Turbopuffer::NamespaceMetadata,
306
+ options: options
307
+ )
308
+ end
309
+
277
310
  # Update namespace schema.
278
311
  #
279
312
  # @overload update_schema(namespace: nil, schema: nil, request_options: {})
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Turbopuffer
4
- VERSION = "1.18.0"
4
+ VERSION = "1.19.0"
5
5
  end
data/lib/turbopuffer.rb CHANGED
@@ -53,6 +53,8 @@ require_relative "turbopuffer/internal/transport/base_client"
53
53
  require_relative "turbopuffer/internal/transport/pooled_net_requester"
54
54
  require_relative "turbopuffer/client"
55
55
  require_relative "turbopuffer/internal/namespace_page"
56
+ require_relative "turbopuffer/models/pinning_config"
57
+ require_relative "turbopuffer/models/namespace_metadata_patch"
56
58
  require_relative "turbopuffer/models/aggregation_group"
57
59
  require_relative "turbopuffer/models/attribute_schema"
58
60
  require_relative "turbopuffer/models/attribute_schema_config"
@@ -89,6 +91,7 @@ require_relative "turbopuffer/models/namespace_recall_response"
89
91
  require_relative "turbopuffer/models/namespace_schema_params"
90
92
  require_relative "turbopuffer/models/namespace_schema_response"
91
93
  require_relative "turbopuffer/models/namespace_summary"
94
+ require_relative "turbopuffer/models/namespace_update_metadata_params"
92
95
  require_relative "turbopuffer/models/namespace_update_schema_params"
93
96
  require_relative "turbopuffer/models/namespace_update_schema_response"
94
97
  require_relative "turbopuffer/models/namespace_write_params"
@@ -148,12 +148,20 @@ module Turbopuffer
148
148
  end
149
149
  end
150
150
 
151
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
152
+ RFC_3986_NOT_PCHARS = T.let(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/, Regexp)
153
+
151
154
  class << self
152
155
  # @api private
153
156
  sig { params(uri: URI::Generic).returns(String) }
154
157
  def uri_origin(uri)
155
158
  end
156
159
 
160
+ # @api private
161
+ sig { params(path: T.any(String, Integer)).returns(String) }
162
+ def encode_path(path)
163
+ end
164
+
157
165
  # @api private
158
166
  sig { params(path: T.any(String, T::Array[String])).returns(String) }
159
167
  def interpolate_path(path)
@@ -65,6 +65,13 @@ module Turbopuffer
65
65
  end
66
66
  attr_writer :full_text_search
67
67
 
68
+ # Whether to enable Glob filters on this attribute.
69
+ sig { returns(T.nilable(T::Boolean)) }
70
+ attr_reader :glob
71
+
72
+ sig { params(glob: T::Boolean).void }
73
+ attr_writer :glob
74
+
68
75
  # Whether to enable Regex filters on this attribute.
69
76
  sig { returns(T.nilable(T::Boolean)) }
70
77
  attr_reader :regex
@@ -84,6 +91,7 @@ module Turbopuffer
84
91
  filterable: T::Boolean,
85
92
  full_text_search:
86
93
  T.any(T::Boolean, Turbopuffer::FullTextSearchConfig::OrHash),
94
+ glob: T::Boolean,
87
95
  regex: T::Boolean
88
96
  ).returns(T.attached_class)
89
97
  end
@@ -101,6 +109,8 @@ module Turbopuffer
101
109
  # the `string` or `[]string` type, and by default, BM25-enabled attributes are not
102
110
  # filterable. You can override this by setting `filterable: true`.
103
111
  full_text_search: nil,
112
+ # Whether to enable Glob filters on this attribute.
113
+ glob: nil,
104
114
  # Whether to enable Regex filters on this attribute.
105
115
  regex: nil
106
116
  )
@@ -118,6 +128,7 @@ module Turbopuffer
118
128
  filterable: T::Boolean,
119
129
  full_text_search:
120
130
  T.any(T::Boolean, Turbopuffer::FullTextSearchConfig),
131
+ glob: T::Boolean,
121
132
  regex: T::Boolean
122
133
  }
123
134
  )
@@ -36,6 +36,16 @@ module Turbopuffer
36
36
  sig { returns(Time) }
37
37
  attr_accessor :updated_at
38
38
 
39
+ # Configuration for namespace pinning, along with the current status of the pinned
40
+ # namespace.
41
+ sig { returns(T.nilable(Turbopuffer::NamespaceMetadata::Pinning)) }
42
+ attr_reader :pinning
43
+
44
+ sig do
45
+ params(pinning: Turbopuffer::NamespaceMetadata::Pinning::OrHash).void
46
+ end
47
+ attr_writer :pinning
48
+
39
49
  # Metadata about a namespace.
40
50
  sig do
41
51
  params(
@@ -53,7 +63,8 @@ module Turbopuffer
53
63
  Turbopuffer::NamespaceMetadata::Index::IndexUpdating::OrHash
54
64
  ),
55
65
  schema: T::Hash[Symbol, Turbopuffer::AttributeSchemaConfig::OrHash],
56
- updated_at: Time
66
+ updated_at: Time,
67
+ pinning: Turbopuffer::NamespaceMetadata::Pinning::OrHash
57
68
  ).returns(T.attached_class)
58
69
  end
59
70
  def self.new(
@@ -70,7 +81,10 @@ module Turbopuffer
70
81
  # The schema of the namespace.
71
82
  schema:,
72
83
  # The timestamp when the namespace was last modified by a write operation.
73
- updated_at:
84
+ updated_at:,
85
+ # Configuration for namespace pinning, along with the current status of the pinned
86
+ # namespace.
87
+ pinning: nil
74
88
  )
75
89
  end
76
90
 
@@ -83,7 +97,8 @@ module Turbopuffer
83
97
  encryption: Turbopuffer::NamespaceMetadata::Encryption::Variants,
84
98
  index: Turbopuffer::NamespaceMetadata::Index::Variants,
85
99
  schema: T::Hash[Symbol, Turbopuffer::AttributeSchemaConfig],
86
- updated_at: Time
100
+ updated_at: Time,
101
+ pinning: Turbopuffer::NamespaceMetadata::Pinning
87
102
  }
88
103
  )
89
104
  end
@@ -279,6 +294,100 @@ module Turbopuffer
279
294
  def self.variants
280
295
  end
281
296
  end
297
+
298
+ class Pinning < Turbopuffer::Models::PinningConfig
299
+ OrHash =
300
+ T.type_alias do
301
+ T.any(
302
+ Turbopuffer::NamespaceMetadata::Pinning,
303
+ Turbopuffer::Internal::AnyHash
304
+ )
305
+ end
306
+
307
+ # Operational status for a pinned namespace.
308
+ sig do
309
+ returns(T.nilable(Turbopuffer::NamespaceMetadata::Pinning::Status))
310
+ end
311
+ attr_reader :status
312
+
313
+ sig do
314
+ params(
315
+ status: Turbopuffer::NamespaceMetadata::Pinning::Status::OrHash
316
+ ).void
317
+ end
318
+ attr_writer :status
319
+
320
+ # Configuration for namespace pinning, along with the current status of the pinned
321
+ # namespace.
322
+ sig do
323
+ params(
324
+ status: Turbopuffer::NamespaceMetadata::Pinning::Status::OrHash
325
+ ).returns(T.attached_class)
326
+ end
327
+ def self.new(
328
+ # Operational status for a pinned namespace.
329
+ status: nil
330
+ )
331
+ end
332
+
333
+ sig do
334
+ override.returns(
335
+ { status: Turbopuffer::NamespaceMetadata::Pinning::Status }
336
+ )
337
+ end
338
+ def to_hash
339
+ end
340
+
341
+ class Status < Turbopuffer::Internal::Type::BaseModel
342
+ OrHash =
343
+ T.type_alias do
344
+ T.any(
345
+ Turbopuffer::NamespaceMetadata::Pinning::Status,
346
+ Turbopuffer::Internal::AnyHash
347
+ )
348
+ end
349
+
350
+ # The number of replicas that are warm and serving traffic.
351
+ sig { returns(Integer) }
352
+ attr_accessor :ready_replicas
353
+
354
+ # The timestamp of the latest pinning status snapshot.
355
+ sig { returns(Time) }
356
+ attr_accessor :updated_at
357
+
358
+ # Aggregate utilization for the pinned namespace, reported as a value between 0.0
359
+ # and 1.0.
360
+ sig { returns(Float) }
361
+ attr_accessor :utilization
362
+
363
+ # Operational status for a pinned namespace.
364
+ sig do
365
+ params(
366
+ ready_replicas: Integer,
367
+ updated_at: Time,
368
+ utilization: Float
369
+ ).returns(T.attached_class)
370
+ end
371
+ def self.new(
372
+ # The number of replicas that are warm and serving traffic.
373
+ ready_replicas:,
374
+ # The timestamp of the latest pinning status snapshot.
375
+ updated_at:,
376
+ # Aggregate utilization for the pinned namespace, reported as a value between 0.0
377
+ # and 1.0.
378
+ utilization:
379
+ )
380
+ end
381
+
382
+ sig do
383
+ override.returns(
384
+ { ready_replicas: Integer, updated_at: Time, utilization: Float }
385
+ )
386
+ end
387
+ def to_hash
388
+ end
389
+ end
390
+ end
282
391
  end
283
392
  end
284
393
  end
@@ -0,0 +1,71 @@
1
+ # typed: strong
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class NamespaceMetadataPatch < Turbopuffer::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Turbopuffer::NamespaceMetadataPatch,
10
+ Turbopuffer::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # Configuration for namespace pinning.
15
+ #
16
+ # - Missing field: no change to pinning configuration
17
+ # - `null` or `false`: explicitly remove pinning
18
+ # - `true`: enable pinning with default configuration
19
+ # - Object: set pinning configuration
20
+ sig { returns(T.nilable(T.any(T::Boolean, Turbopuffer::PinningConfig))) }
21
+ attr_accessor :pinning
22
+
23
+ # Request to update namespace metadata configuration.
24
+ sig do
25
+ params(
26
+ pinning:
27
+ T.nilable(T.any(T::Boolean, Turbopuffer::PinningConfig::OrHash))
28
+ ).returns(T.attached_class)
29
+ end
30
+ def self.new(
31
+ # Configuration for namespace pinning.
32
+ #
33
+ # - Missing field: no change to pinning configuration
34
+ # - `null` or `false`: explicitly remove pinning
35
+ # - `true`: enable pinning with default configuration
36
+ # - Object: set pinning configuration
37
+ pinning: nil
38
+ )
39
+ end
40
+
41
+ sig do
42
+ override.returns(
43
+ { pinning: T.nilable(T.any(T::Boolean, Turbopuffer::PinningConfig)) }
44
+ )
45
+ end
46
+ def to_hash
47
+ end
48
+
49
+ # Configuration for namespace pinning.
50
+ #
51
+ # - Missing field: no change to pinning configuration
52
+ # - `null` or `false`: explicitly remove pinning
53
+ # - `true`: enable pinning with default configuration
54
+ # - Object: set pinning configuration
55
+ module Pinning
56
+ extend Turbopuffer::Internal::Type::Union
57
+
58
+ Variants =
59
+ T.type_alias { T.any(T::Boolean, Turbopuffer::PinningConfig) }
60
+
61
+ sig do
62
+ override.returns(
63
+ T::Array[Turbopuffer::NamespaceMetadataPatch::Pinning::Variants]
64
+ )
65
+ end
66
+ def self.variants
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -42,6 +42,14 @@ module Turbopuffer
42
42
  sig { params(num: Integer).void }
43
43
  attr_writer :num
44
44
 
45
+ # The ranking function to evaluate recall for. If provided, `num` must be either
46
+ # null or 1.
47
+ sig { returns(T.nilable(T.anything)) }
48
+ attr_reader :rank_by
49
+
50
+ sig { params(rank_by: T.anything).void }
51
+ attr_writer :rank_by
52
+
45
53
  # Search for `top_k` nearest neighbors.
46
54
  sig { returns(T.nilable(Integer)) }
47
55
  attr_reader :top_k
@@ -55,6 +63,7 @@ module Turbopuffer
55
63
  filters: T.anything,
56
64
  include_ground_truth: T::Boolean,
57
65
  num: Integer,
66
+ rank_by: T.anything,
58
67
  top_k: Integer,
59
68
  request_options: Turbopuffer::RequestOptions::OrHash
60
69
  ).returns(T.attached_class)
@@ -68,6 +77,9 @@ module Turbopuffer
68
77
  include_ground_truth: nil,
69
78
  # The number of searches to run.
70
79
  num: nil,
80
+ # The ranking function to evaluate recall for. If provided, `num` must be either
81
+ # null or 1.
82
+ rank_by: nil,
71
83
  # Search for `top_k` nearest neighbors.
72
84
  top_k: nil,
73
85
  request_options: {}
@@ -81,6 +93,7 @@ module Turbopuffer
81
93
  filters: T.anything,
82
94
  include_ground_truth: T::Boolean,
83
95
  num: Integer,
96
+ rank_by: T.anything,
84
97
  top_k: Integer,
85
98
  request_options: Turbopuffer::RequestOptions
86
99
  }
@@ -0,0 +1,41 @@
1
+ # typed: strong
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class NamespaceUpdateMetadataParams < Turbopuffer::Models::NamespaceMetadataPatch
6
+ extend Turbopuffer::Internal::Type::RequestParameters::Converter
7
+ include Turbopuffer::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Turbopuffer::NamespaceUpdateMetadataParams,
13
+ Turbopuffer::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(T.nilable(String)) }
18
+ attr_reader :namespace
19
+
20
+ sig { params(namespace: String).void }
21
+ attr_writer :namespace
22
+
23
+ sig do
24
+ params(
25
+ namespace: String,
26
+ request_options: Turbopuffer::RequestOptions::OrHash
27
+ ).returns(T.attached_class)
28
+ end
29
+ def self.new(namespace: nil, request_options: {})
30
+ end
31
+
32
+ sig do
33
+ override.returns(
34
+ { namespace: String, request_options: Turbopuffer::RequestOptions }
35
+ )
36
+ end
37
+ def to_hash
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,31 @@
1
+ # typed: strong
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class PinningConfig < Turbopuffer::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Turbopuffer::PinningConfig, Turbopuffer::Internal::AnyHash)
9
+ end
10
+
11
+ # The number of read replicas to provision. Defaults to 1 if not specified.
12
+ sig { returns(T.nilable(Integer)) }
13
+ attr_reader :replicas
14
+
15
+ sig { params(replicas: Integer).void }
16
+ attr_writer :replicas
17
+
18
+ # Configuration for namespace pinning.
19
+ sig { params(replicas: Integer).returns(T.attached_class) }
20
+ def self.new(
21
+ # The number of read replicas to provision. Defaults to 1 if not specified.
22
+ replicas: nil
23
+ )
24
+ end
25
+
26
+ sig { override.returns({ replicas: Integer }) }
27
+ def to_hash
28
+ end
29
+ end
30
+ end
31
+ end
@@ -56,6 +56,8 @@ module Turbopuffer
56
56
 
57
57
  NamespaceMetadataParams = Turbopuffer::Models::NamespaceMetadataParams
58
58
 
59
+ NamespaceMetadataPatch = Turbopuffer::Models::NamespaceMetadataPatch
60
+
59
61
  NamespaceMultiQueryParams = Turbopuffer::Models::NamespaceMultiQueryParams
60
62
 
61
63
  NamespaceQueryParams = Turbopuffer::Models::NamespaceQueryParams
@@ -66,10 +68,15 @@ module Turbopuffer
66
68
 
67
69
  NamespaceSummary = Turbopuffer::Models::NamespaceSummary
68
70
 
71
+ NamespaceUpdateMetadataParams =
72
+ Turbopuffer::Models::NamespaceUpdateMetadataParams
73
+
69
74
  NamespaceUpdateSchemaParams = Turbopuffer::Models::NamespaceUpdateSchemaParams
70
75
 
71
76
  NamespaceWriteParams = Turbopuffer::Models::NamespaceWriteParams
72
77
 
78
+ PinningConfig = Turbopuffer::Models::PinningConfig
79
+
73
80
  Query = Turbopuffer::Models::Query
74
81
 
75
82
  QueryBilling = Turbopuffer::Models::QueryBilling
@@ -179,6 +179,7 @@ module Turbopuffer
179
179
  filters: T.anything,
180
180
  include_ground_truth: T::Boolean,
181
181
  num: Integer,
182
+ rank_by: T.anything,
182
183
  top_k: Integer,
183
184
  request_options: Turbopuffer::RequestOptions::OrHash
184
185
  ).returns(Turbopuffer::Models::NamespaceRecallResponse)
@@ -193,6 +194,9 @@ module Turbopuffer
193
194
  include_ground_truth: nil,
194
195
  # Body param: The number of searches to run.
195
196
  num: nil,
197
+ # Body param: The ranking function to evaluate recall for. If provided, `num` must
198
+ # be either null or 1.
199
+ rank_by: nil,
196
200
  # Body param: Search for `top_k` nearest neighbors.
197
201
  top_k: nil,
198
202
  request_options: {}
@@ -213,6 +217,29 @@ module Turbopuffer
213
217
  )
214
218
  end
215
219
 
220
+ # Update metadata configuration for a namespace.
221
+ sig do
222
+ params(
223
+ namespace: String,
224
+ pinning:
225
+ T.nilable(T.any(T::Boolean, Turbopuffer::PinningConfig::OrHash)),
226
+ request_options: Turbopuffer::RequestOptions::OrHash
227
+ ).returns(Turbopuffer::NamespaceMetadata)
228
+ end
229
+ def update_metadata(
230
+ # Path param: The name of the namespace.
231
+ namespace: nil,
232
+ # Body param: Configuration for namespace pinning.
233
+ #
234
+ # - Missing field: no change to pinning configuration
235
+ # - `null` or `false`: explicitly remove pinning
236
+ # - `true`: enable pinning with default configuration
237
+ # - Object: set pinning configuration
238
+ pinning: nil,
239
+ request_options: {}
240
+ )
241
+ end
242
+
216
243
  # Update namespace schema.
217
244
  sig do
218
245
  params(
@@ -45,8 +45,12 @@ module Turbopuffer
45
45
  -> top?
46
46
  } -> top?
47
47
 
48
+ RFC_3986_NOT_PCHARS: Regexp
49
+
48
50
  def self?.uri_origin: (URI::Generic uri) -> String
49
51
 
52
+ def self?.encode_path: (String | Integer path) -> String
53
+
50
54
  def self?.interpolate_path: (String | ::Array[String] path) -> String
51
55
 
52
56
  def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
@@ -6,6 +6,7 @@ module Turbopuffer
6
6
  ann: Turbopuffer::Models::AttributeSchemaConfig::ann,
7
7
  filterable: bool,
8
8
  full_text_search: Turbopuffer::Models::full_text_search,
9
+ glob: bool,
9
10
  regex: bool
10
11
  }
11
12
 
@@ -28,6 +29,10 @@ module Turbopuffer
28
29
  Turbopuffer::Models::full_text_search
29
30
  ) -> Turbopuffer::Models::full_text_search
30
31
 
32
+ attr_reader glob: bool?
33
+
34
+ def glob=: (bool) -> bool
35
+
31
36
  attr_reader regex: bool?
32
37
 
33
38
  def regex=: (bool) -> bool
@@ -37,6 +42,7 @@ module Turbopuffer
37
42
  ?ann: Turbopuffer::Models::AttributeSchemaConfig::ann,
38
43
  ?filterable: bool,
39
44
  ?full_text_search: Turbopuffer::Models::full_text_search,
45
+ ?glob: bool,
40
46
  ?regex: bool
41
47
  ) -> void
42
48
 
@@ -45,6 +51,7 @@ module Turbopuffer
45
51
  ann: Turbopuffer::Models::AttributeSchemaConfig::ann,
46
52
  filterable: bool,
47
53
  full_text_search: Turbopuffer::Models::full_text_search,
54
+ glob: bool,
48
55
  regex: bool
49
56
  }
50
57
 
@@ -8,7 +8,8 @@ module Turbopuffer
8
8
  encryption: Turbopuffer::Models::NamespaceMetadata::encryption,
9
9
  index: Turbopuffer::Models::NamespaceMetadata::index,
10
10
  schema: ::Hash[Symbol, Turbopuffer::AttributeSchemaConfig],
11
- updated_at: Time
11
+ updated_at: Time,
12
+ pinning: Turbopuffer::NamespaceMetadata::Pinning
12
13
  }
13
14
 
14
15
  class NamespaceMetadata < Turbopuffer::Internal::Type::BaseModel
@@ -26,6 +27,12 @@ module Turbopuffer
26
27
 
27
28
  attr_accessor updated_at: Time
28
29
 
30
+ attr_reader pinning: Turbopuffer::NamespaceMetadata::Pinning?
31
+
32
+ def pinning=: (
33
+ Turbopuffer::NamespaceMetadata::Pinning
34
+ ) -> Turbopuffer::NamespaceMetadata::Pinning
35
+
29
36
  def initialize: (
30
37
  approx_logical_bytes: Integer,
31
38
  approx_row_count: Integer,
@@ -33,7 +40,8 @@ module Turbopuffer
33
40
  encryption: Turbopuffer::Models::NamespaceMetadata::encryption,
34
41
  index: Turbopuffer::Models::NamespaceMetadata::index,
35
42
  schema: ::Hash[Symbol, Turbopuffer::AttributeSchemaConfig],
36
- updated_at: Time
43
+ updated_at: Time,
44
+ ?pinning: Turbopuffer::NamespaceMetadata::Pinning
37
45
  ) -> void
38
46
 
39
47
  def to_hash: -> {
@@ -43,7 +51,8 @@ module Turbopuffer
43
51
  encryption: Turbopuffer::Models::NamespaceMetadata::encryption,
44
52
  index: Turbopuffer::Models::NamespaceMetadata::index,
45
53
  schema: ::Hash[Symbol, Turbopuffer::AttributeSchemaConfig],
46
- updated_at: Time
54
+ updated_at: Time,
55
+ pinning: Turbopuffer::NamespaceMetadata::Pinning
47
56
  }
48
57
 
49
58
  type encryption =
@@ -122,6 +131,47 @@ module Turbopuffer
122
131
 
123
132
  def self?.variants: -> ::Array[Turbopuffer::Models::NamespaceMetadata::index]
124
133
  end
134
+
135
+ type pinning = { status: Turbopuffer::NamespaceMetadata::Pinning::Status }
136
+
137
+ class Pinning < Turbopuffer::Models::PinningConfig
138
+ def status: -> Turbopuffer::NamespaceMetadata::Pinning::Status?
139
+
140
+ def status=: (
141
+ Turbopuffer::NamespaceMetadata::Pinning::Status _
142
+ ) -> Turbopuffer::NamespaceMetadata::Pinning::Status
143
+
144
+ def initialize: (
145
+ ?status: Turbopuffer::NamespaceMetadata::Pinning::Status
146
+ ) -> void
147
+
148
+ def to_hash: -> {
149
+ status: Turbopuffer::NamespaceMetadata::Pinning::Status
150
+ }
151
+
152
+ type status =
153
+ { ready_replicas: Integer, updated_at: Time, utilization: Float }
154
+
155
+ class Status < Turbopuffer::Internal::Type::BaseModel
156
+ attr_accessor ready_replicas: Integer
157
+
158
+ attr_accessor updated_at: Time
159
+
160
+ attr_accessor utilization: Float
161
+
162
+ def initialize: (
163
+ ready_replicas: Integer,
164
+ updated_at: Time,
165
+ utilization: Float
166
+ ) -> void
167
+
168
+ def to_hash: -> {
169
+ ready_replicas: Integer,
170
+ updated_at: Time,
171
+ utilization: Float
172
+ }
173
+ end
174
+ end
125
175
  end
126
176
  end
127
177
  end
@@ -0,0 +1,26 @@
1
+ module Turbopuffer
2
+ module Models
3
+ type namespace_metadata_patch =
4
+ { pinning: Turbopuffer::Models::NamespaceMetadataPatch::pinning? }
5
+
6
+ class NamespaceMetadataPatch < Turbopuffer::Internal::Type::BaseModel
7
+ attr_accessor pinning: Turbopuffer::Models::NamespaceMetadataPatch::pinning?
8
+
9
+ def initialize: (
10
+ ?pinning: Turbopuffer::Models::NamespaceMetadataPatch::pinning?
11
+ ) -> void
12
+
13
+ def to_hash: -> {
14
+ pinning: Turbopuffer::Models::NamespaceMetadataPatch::pinning?
15
+ }
16
+
17
+ type pinning = bool | Turbopuffer::PinningConfig
18
+
19
+ module Pinning
20
+ extend Turbopuffer::Internal::Type::Union
21
+
22
+ def self?.variants: -> ::Array[Turbopuffer::Models::NamespaceMetadataPatch::pinning]
23
+ end
24
+ end
25
+ end
26
+ end
@@ -6,6 +6,7 @@ module Turbopuffer
6
6
  filters: top,
7
7
  include_ground_truth: bool,
8
8
  num: Integer,
9
+ rank_by: top,
9
10
  top_k: Integer
10
11
  }
11
12
  & Turbopuffer::Internal::Type::request_parameters
@@ -30,6 +31,10 @@ module Turbopuffer
30
31
 
31
32
  def num=: (Integer) -> Integer
32
33
 
34
+ attr_reader rank_by: top?
35
+
36
+ def rank_by=: (top) -> top
37
+
33
38
  attr_reader top_k: Integer?
34
39
 
35
40
  def top_k=: (Integer) -> Integer
@@ -39,6 +44,7 @@ module Turbopuffer
39
44
  ?filters: top,
40
45
  ?include_ground_truth: bool,
41
46
  ?num: Integer,
47
+ ?rank_by: top,
42
48
  ?top_k: Integer,
43
49
  ?request_options: Turbopuffer::request_opts
44
50
  ) -> void
@@ -48,6 +54,7 @@ module Turbopuffer
48
54
  filters: top,
49
55
  include_ground_truth: bool,
50
56
  num: Integer,
57
+ rank_by: top,
51
58
  top_k: Integer,
52
59
  request_options: Turbopuffer::RequestOptions
53
60
  }
@@ -0,0 +1,25 @@
1
+ module Turbopuffer
2
+ module Models
3
+ type namespace_update_metadata_params =
4
+ { namespace: String } & Turbopuffer::Internal::Type::request_parameters
5
+
6
+ class NamespaceUpdateMetadataParams < Turbopuffer::Models::NamespaceMetadataPatch
7
+ extend Turbopuffer::Internal::Type::RequestParameters::Converter
8
+ include Turbopuffer::Internal::Type::RequestParameters
9
+
10
+ def namespace: -> String?
11
+
12
+ def namespace=: (String _) -> String
13
+
14
+ def initialize: (
15
+ ?namespace: String,
16
+ ?request_options: Turbopuffer::request_opts
17
+ ) -> void
18
+
19
+ def to_hash: -> {
20
+ namespace: String,
21
+ request_options: Turbopuffer::RequestOptions
22
+ }
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,15 @@
1
+ module Turbopuffer
2
+ module Models
3
+ type pinning_config = { replicas: Integer }
4
+
5
+ class PinningConfig < Turbopuffer::Internal::Type::BaseModel
6
+ attr_reader replicas: Integer?
7
+
8
+ def replicas=: (Integer) -> Integer
9
+
10
+ def initialize: (?replicas: Integer) -> void
11
+
12
+ def to_hash: -> { replicas: Integer }
13
+ end
14
+ end
15
+ end
@@ -47,6 +47,8 @@ module Turbopuffer
47
47
 
48
48
  class NamespaceMetadataParams = Turbopuffer::Models::NamespaceMetadataParams
49
49
 
50
+ class NamespaceMetadataPatch = Turbopuffer::Models::NamespaceMetadataPatch
51
+
50
52
  class NamespaceMultiQueryParams = Turbopuffer::Models::NamespaceMultiQueryParams
51
53
 
52
54
  class NamespaceQueryParams = Turbopuffer::Models::NamespaceQueryParams
@@ -57,10 +59,14 @@ module Turbopuffer
57
59
 
58
60
  class NamespaceSummary = Turbopuffer::Models::NamespaceSummary
59
61
 
62
+ class NamespaceUpdateMetadataParams = Turbopuffer::Models::NamespaceUpdateMetadataParams
63
+
60
64
  class NamespaceUpdateSchemaParams = Turbopuffer::Models::NamespaceUpdateSchemaParams
61
65
 
62
66
  class NamespaceWriteParams = Turbopuffer::Models::NamespaceWriteParams
63
67
 
68
+ class PinningConfig = Turbopuffer::Models::PinningConfig
69
+
64
70
  class Query = Turbopuffer::Models::Query
65
71
 
66
72
  class QueryBilling = Turbopuffer::Models::QueryBilling
@@ -61,6 +61,7 @@ module Turbopuffer
61
61
  ?filters: top,
62
62
  ?include_ground_truth: bool,
63
63
  ?num: Integer,
64
+ ?rank_by: top,
64
65
  ?top_k: Integer,
65
66
  ?request_options: Turbopuffer::request_opts
66
67
  ) -> Turbopuffer::Models::NamespaceRecallResponse
@@ -70,6 +71,12 @@ module Turbopuffer
70
71
  ?request_options: Turbopuffer::request_opts
71
72
  ) -> Turbopuffer::Models::namespace_schema_response
72
73
 
74
+ def update_metadata: (
75
+ ?namespace: String,
76
+ ?pinning: Turbopuffer::Models::NamespaceMetadataPatch::pinning?,
77
+ ?request_options: Turbopuffer::request_opts
78
+ ) -> Turbopuffer::NamespaceMetadata
79
+
73
80
  def update_schema: (
74
81
  ?namespace: String,
75
82
  ?schema: ::Hash[Symbol, Turbopuffer::Models::attribute_schema],
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbopuffer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.0
4
+ version: 1.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Turbopuffer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-20 00:00:00.000000000 Z
11
+ date: 2026-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi
@@ -97,6 +97,7 @@ files:
97
97
  - lib/turbopuffer/models/namespace_hint_cache_warm_response.rb
98
98
  - lib/turbopuffer/models/namespace_metadata.rb
99
99
  - lib/turbopuffer/models/namespace_metadata_params.rb
100
+ - lib/turbopuffer/models/namespace_metadata_patch.rb
100
101
  - lib/turbopuffer/models/namespace_multi_query_params.rb
101
102
  - lib/turbopuffer/models/namespace_multi_query_response.rb
102
103
  - lib/turbopuffer/models/namespace_query_params.rb
@@ -106,10 +107,12 @@ files:
106
107
  - lib/turbopuffer/models/namespace_schema_params.rb
107
108
  - lib/turbopuffer/models/namespace_schema_response.rb
108
109
  - lib/turbopuffer/models/namespace_summary.rb
110
+ - lib/turbopuffer/models/namespace_update_metadata_params.rb
109
111
  - lib/turbopuffer/models/namespace_update_schema_params.rb
110
112
  - lib/turbopuffer/models/namespace_update_schema_response.rb
111
113
  - lib/turbopuffer/models/namespace_write_params.rb
112
114
  - lib/turbopuffer/models/namespace_write_response.rb
115
+ - lib/turbopuffer/models/pinning_config.rb
113
116
  - lib/turbopuffer/models/query.rb
114
117
  - lib/turbopuffer/models/query_billing.rb
115
118
  - lib/turbopuffer/models/query_performance.rb
@@ -172,6 +175,7 @@ files:
172
175
  - rbi/turbopuffer/models/namespace_hint_cache_warm_response.rbi
173
176
  - rbi/turbopuffer/models/namespace_metadata.rbi
174
177
  - rbi/turbopuffer/models/namespace_metadata_params.rbi
178
+ - rbi/turbopuffer/models/namespace_metadata_patch.rbi
175
179
  - rbi/turbopuffer/models/namespace_multi_query_params.rbi
176
180
  - rbi/turbopuffer/models/namespace_multi_query_response.rbi
177
181
  - rbi/turbopuffer/models/namespace_query_params.rbi
@@ -181,10 +185,12 @@ files:
181
185
  - rbi/turbopuffer/models/namespace_schema_params.rbi
182
186
  - rbi/turbopuffer/models/namespace_schema_response.rbi
183
187
  - rbi/turbopuffer/models/namespace_summary.rbi
188
+ - rbi/turbopuffer/models/namespace_update_metadata_params.rbi
184
189
  - rbi/turbopuffer/models/namespace_update_schema_params.rbi
185
190
  - rbi/turbopuffer/models/namespace_update_schema_response.rbi
186
191
  - rbi/turbopuffer/models/namespace_write_params.rbi
187
192
  - rbi/turbopuffer/models/namespace_write_response.rbi
193
+ - rbi/turbopuffer/models/pinning_config.rbi
188
194
  - rbi/turbopuffer/models/query.rbi
189
195
  - rbi/turbopuffer/models/query_billing.rbi
190
196
  - rbi/turbopuffer/models/query_performance.rbi
@@ -246,6 +252,7 @@ files:
246
252
  - sig/turbopuffer/models/namespace_hint_cache_warm_response.rbs
247
253
  - sig/turbopuffer/models/namespace_metadata.rbs
248
254
  - sig/turbopuffer/models/namespace_metadata_params.rbs
255
+ - sig/turbopuffer/models/namespace_metadata_patch.rbs
249
256
  - sig/turbopuffer/models/namespace_multi_query_params.rbs
250
257
  - sig/turbopuffer/models/namespace_multi_query_response.rbs
251
258
  - sig/turbopuffer/models/namespace_query_params.rbs
@@ -255,10 +262,12 @@ files:
255
262
  - sig/turbopuffer/models/namespace_schema_params.rbs
256
263
  - sig/turbopuffer/models/namespace_schema_response.rbs
257
264
  - sig/turbopuffer/models/namespace_summary.rbs
265
+ - sig/turbopuffer/models/namespace_update_metadata_params.rbs
258
266
  - sig/turbopuffer/models/namespace_update_schema_params.rbs
259
267
  - sig/turbopuffer/models/namespace_update_schema_response.rbs
260
268
  - sig/turbopuffer/models/namespace_write_params.rbs
261
269
  - sig/turbopuffer/models/namespace_write_response.rbs
270
+ - sig/turbopuffer/models/pinning_config.rbs
262
271
  - sig/turbopuffer/models/query.rbs
263
272
  - sig/turbopuffer/models/query_billing.rbs
264
273
  - sig/turbopuffer/models/query_performance.rbs