turbopuffer 1.12.2 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76ba369ee8a3bf99895b83a7d72cc02257a835139651940f02a86cb4adc1247c
4
- data.tar.gz: b71e9e3031e6d0dbe82baf9fe9e13d056a4977789bfb4d6a444675285376e9d3
3
+ metadata.gz: bf103528d41a884cdd21e0f270de4c81ff9a0dace54a41bcf8be8c267e6a6130
4
+ data.tar.gz: cdfd28b66449cc1265566e23dbf48f58841eb7f075b8b060ce71762f6e9b5fbe
5
5
  SHA512:
6
- metadata.gz: 667eeea38f344a0fd154b352664bac0b615f692f275ffba655798ec78526ebf0d7681067a9168bba76d0c3e696c96a52deaf9073d4043ed3554e37d523d4ff22
7
- data.tar.gz: de73e44ca72966a51da5031e6b1fd6f82a6ba96cbd1698e1f4e073b7adddc9a33060baccfd18e40416912cda5f64c8d723c53dae6dba6d0ee61fc7839979076f
6
+ metadata.gz: 871db166c6bd140b8356c388f952c161a37dd26b68c64bafea41b90e3bb95d0124789efacf20b6eeff13de1e72b7181c1be0b71722a819c0302788cfed80100f
7
+ data.tar.gz: 888efaea3f982b55e38f0dc647913d5d400a1191261bc317ba8a51ec1f2a16bb136b31bb5cc9f8cb3b5612fdac60973855a65ed1e16688f2e5016e403ecc91ac
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.13.0 (2026-02-08)
4
+
5
+ Full Changelog: [v1.12.2...v1.13.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v1.12.2...v1.13.0)
6
+
7
+ ### Features
8
+
9
+ * add support for `limit` query parameter ([e7de801](https://github.com/turbopuffer/turbopuffer-ruby/commit/e7de80171a0d67759c0f04d15bf1f47f4bde6a6f))
10
+ * spec: clean up limit codegen ([383ab43](https://github.com/turbopuffer/turbopuffer-ruby/commit/383ab4339dd079c33d01c1ef53c470be58994544))
11
+
3
12
  ## 1.12.2 (2026-02-06)
4
13
 
5
14
  Full Changelog: [v1.12.1...v1.12.2](https://github.com/turbopuffer/turbopuffer-ruby/compare/v1.12.1...v1.12.2)
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.12.2"
29
+ gem "turbopuffer", "~> 1.13.0"
30
30
  ```
31
31
 
32
32
  <!-- x-release-please-end -->
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class Limit < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute total
7
+ # Limits the total number of documents returned.
8
+ #
9
+ # @return [Integer]
10
+ required :total, Integer
11
+
12
+ # @!attribute per
13
+ # Limits the number of documents with the same value for a set of attributes (the
14
+ # "limit key") that can appear in the results.
15
+ #
16
+ # @return [Turbopuffer::Models::Limit::Per, nil]
17
+ optional :per, -> { Turbopuffer::Limit::Per }
18
+
19
+ # @!method initialize(total:, per: nil)
20
+ # Some parameter documentations has been truncated, see
21
+ # {Turbopuffer::Models::Limit} for more details.
22
+ #
23
+ # Limits the documents returned by a query.
24
+ #
25
+ # @param total [Integer] Limits the total number of documents returned.
26
+ #
27
+ # @param per [Turbopuffer::Models::Limit::Per] Limits the number of documents with the same value for a set of attributes (the
28
+
29
+ # @see Turbopuffer::Models::Limit#per
30
+ class Per < Turbopuffer::Internal::Type::BaseModel
31
+ # @!attribute attributes
32
+ # The attributes to include in the limit key.
33
+ #
34
+ # @return [Array<String>]
35
+ required :attributes, Turbopuffer::Internal::Type::ArrayOf[String]
36
+
37
+ # @!attribute limit
38
+ # The maximum number of documents to return for each value of the limit key.
39
+ #
40
+ # @return [Integer]
41
+ required :limit, Integer
42
+
43
+ # @!method initialize(attributes:, limit:)
44
+ # Some parameter documentations has been truncated, see
45
+ # {Turbopuffer::Models::Limit::Per} for more details.
46
+ #
47
+ # Limits the number of documents with the same value for a set of attributes (the
48
+ # "limit key") that can appear in the results.
49
+ #
50
+ # @param attributes [Array<String>] The attributes to include in the limit key.
51
+ #
52
+ # @param limit [Integer] The maximum number of documents to return for each value of the limit key.
53
+ end
54
+ end
55
+ end
56
+ end
@@ -58,6 +58,12 @@ module Turbopuffer
58
58
  # @return [Boolean, Array<String>, nil]
59
59
  optional :include_attributes, union: -> { Turbopuffer::IncludeAttributes }
60
60
 
61
+ # @!attribute limit
62
+ # Limits the documents returned by a query.
63
+ #
64
+ # @return [Integer, Turbopuffer::Models::Limit, nil]
65
+ optional :limit, union: -> { Turbopuffer::NamespaceExplainQueryParams::Limit }
66
+
61
67
  # @!attribute rank_by
62
68
  # How to rank the documents in the namespace.
63
69
  #
@@ -76,7 +82,7 @@ module Turbopuffer
76
82
  # @return [Symbol, Turbopuffer::Models::VectorEncoding, nil]
77
83
  optional :vector_encoding, enum: -> { Turbopuffer::VectorEncoding }
78
84
 
79
- # @!method initialize(namespace: nil, aggregate_by: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
85
+ # @!method initialize(namespace: nil, aggregate_by: 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: {})
80
86
  # Some parameter documentations has been truncated, see
81
87
  # {Turbopuffer::Models::NamespaceExplainQueryParams} for more details.
82
88
  #
@@ -96,6 +102,8 @@ module Turbopuffer
96
102
  #
97
103
  # @param include_attributes [Boolean, Array<String>] Whether to include attributes in the response.
98
104
  #
105
+ # @param limit [Integer, Turbopuffer::Models::Limit] Limits the documents returned by a query.
106
+ #
99
107
  # @param rank_by [Object] How to rank the documents in the namespace.
100
108
  #
101
109
  # @param top_k [Integer] The number of results to return.
@@ -132,6 +140,19 @@ module Turbopuffer
132
140
  # @return [Array<Symbol>]
133
141
  end
134
142
  end
143
+
144
+ # Limits the documents returned by a query.
145
+ module Limit
146
+ extend Turbopuffer::Internal::Type::Union
147
+
148
+ variant Integer
149
+
150
+ # Limits the documents returned by a query.
151
+ variant -> { Turbopuffer::Limit }
152
+
153
+ # @!method self.variants
154
+ # @return [Array(Integer, Turbopuffer::Models::Limit)]
155
+ end
135
156
  end
136
157
  end
137
158
  end
@@ -58,6 +58,12 @@ module Turbopuffer
58
58
  # @return [Boolean, Array<String>, nil]
59
59
  optional :include_attributes, union: -> { Turbopuffer::IncludeAttributes }
60
60
 
61
+ # @!attribute limit
62
+ # Limits the documents returned by a query.
63
+ #
64
+ # @return [Integer, Turbopuffer::Models::Limit, nil]
65
+ optional :limit, union: -> { Turbopuffer::NamespaceQueryParams::Limit }
66
+
61
67
  # @!attribute rank_by
62
68
  # How to rank the documents in the namespace.
63
69
  #
@@ -76,7 +82,7 @@ module Turbopuffer
76
82
  # @return [Symbol, Turbopuffer::Models::VectorEncoding, nil]
77
83
  optional :vector_encoding, enum: -> { Turbopuffer::VectorEncoding }
78
84
 
79
- # @!method initialize(namespace: nil, aggregate_by: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
85
+ # @!method initialize(namespace: nil, aggregate_by: 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: {})
80
86
  # Some parameter documentations has been truncated, see
81
87
  # {Turbopuffer::Models::NamespaceQueryParams} for more details.
82
88
  #
@@ -96,6 +102,8 @@ module Turbopuffer
96
102
  #
97
103
  # @param include_attributes [Boolean, Array<String>] Whether to include attributes in the response.
98
104
  #
105
+ # @param limit [Integer, Turbopuffer::Models::Limit] Limits the documents returned by a query.
106
+ #
99
107
  # @param rank_by [Object] How to rank the documents in the namespace.
100
108
  #
101
109
  # @param top_k [Integer] The number of results to return.
@@ -132,6 +140,19 @@ module Turbopuffer
132
140
  # @return [Array<Symbol>]
133
141
  end
134
142
  end
143
+
144
+ # Limits the documents returned by a query.
145
+ module Limit
146
+ extend Turbopuffer::Internal::Type::Union
147
+
148
+ variant Integer
149
+
150
+ # Limits the documents returned by a query.
151
+ variant -> { Turbopuffer::Limit }
152
+
153
+ # @!method self.variants
154
+ # @return [Array(Integer, Turbopuffer::Models::Limit)]
155
+ end
135
156
  end
136
157
  end
137
158
  end
@@ -43,6 +43,12 @@ module Turbopuffer
43
43
  # @return [Boolean, Array<String>, nil]
44
44
  optional :include_attributes, union: -> { Turbopuffer::IncludeAttributes }
45
45
 
46
+ # @!attribute limit
47
+ # Limits the documents returned by a query.
48
+ #
49
+ # @return [Integer, Turbopuffer::Models::Limit, nil]
50
+ optional :limit, union: -> { Turbopuffer::Query::Limit }
51
+
46
52
  # @!attribute rank_by
47
53
  # How to rank the documents in the namespace.
48
54
  #
@@ -55,7 +61,7 @@ module Turbopuffer
55
61
  # @return [Integer, nil]
56
62
  optional :top_k, Integer
57
63
 
58
- # @!method initialize(aggregate_by: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, rank_by: nil, top_k: nil)
64
+ # @!method initialize(aggregate_by: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, limit: nil, rank_by: nil, top_k: nil)
59
65
  # Some parameter documentations has been truncated, see
60
66
  # {Turbopuffer::Models::Query} for more details.
61
67
  #
@@ -73,9 +79,26 @@ module Turbopuffer
73
79
  #
74
80
  # @param include_attributes [Boolean, Array<String>] Whether to include attributes in the response.
75
81
  #
82
+ # @param limit [Integer, Turbopuffer::Models::Limit] Limits the documents returned by a query.
83
+ #
76
84
  # @param rank_by [Object] How to rank the documents in the namespace.
77
85
  #
78
86
  # @param top_k [Integer] The number of results to return.
87
+
88
+ # Limits the documents returned by a query.
89
+ #
90
+ # @see Turbopuffer::Models::Query#limit
91
+ module Limit
92
+ extend Turbopuffer::Internal::Type::Union
93
+
94
+ variant Integer
95
+
96
+ # Limits the documents returned by a query.
97
+ variant -> { Turbopuffer::Limit }
98
+
99
+ # @!method self.variants
100
+ # @return [Array(Integer, Turbopuffer::Models::Limit)]
101
+ end
79
102
  end
80
103
  end
81
104
  end
@@ -70,6 +70,8 @@ module Turbopuffer
70
70
 
71
71
  Language = Turbopuffer::Models::Language
72
72
 
73
+ Limit = Turbopuffer::Models::Limit
74
+
73
75
  NamespaceDeleteAllParams = Turbopuffer::Models::NamespaceDeleteAllParams
74
76
 
75
77
  NamespaceExplainQueryParams = Turbopuffer::Models::NamespaceExplainQueryParams
@@ -33,7 +33,7 @@ module Turbopuffer
33
33
  #
34
34
  # Explain a query plan.
35
35
  #
36
- # @overload explain_query(namespace: nil, aggregate_by: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
36
+ # @overload explain_query(namespace: nil, aggregate_by: 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: {})
37
37
  #
38
38
  # @param namespace [String] Path param: The name of the namespace.
39
39
  #
@@ -51,6 +51,8 @@ module Turbopuffer
51
51
  #
52
52
  # @param include_attributes [Boolean, Array<String>] Body param: Whether to include attributes in the response.
53
53
  #
54
+ # @param limit [Integer, Turbopuffer::Models::Limit] Body param: Limits the documents returned by a query.
55
+ #
54
56
  # @param rank_by [Object] Body param: How to rank the documents in the namespace.
55
57
  #
56
58
  # @param top_k [Integer] Body param: The number of results to return.
@@ -164,7 +166,7 @@ module Turbopuffer
164
166
  #
165
167
  # Query, filter, full-text search and vector search documents.
166
168
  #
167
- # @overload query(namespace: nil, aggregate_by: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
169
+ # @overload query(namespace: nil, aggregate_by: 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: {})
168
170
  #
169
171
  # @param namespace [String] Path param: The name of the namespace.
170
172
  #
@@ -182,6 +184,8 @@ module Turbopuffer
182
184
  #
183
185
  # @param include_attributes [Boolean, Array<String>] Body param: Whether to include attributes in the response.
184
186
  #
187
+ # @param limit [Integer, Turbopuffer::Models::Limit] Body param: Limits the documents returned by a query.
188
+ #
185
189
  # @param rank_by [Object] Body param: How to rank the documents in the namespace.
186
190
  #
187
191
  # @param top_k [Integer] Body param: The number of results to return.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Turbopuffer
4
- VERSION = "1.12.2"
4
+ VERSION = "1.13.0"
5
5
  end
data/lib/turbopuffer.rb CHANGED
@@ -68,6 +68,7 @@ require_relative "turbopuffer/models/full_text_search_config"
68
68
  require_relative "turbopuffer/models/id"
69
69
  require_relative "turbopuffer/models/include_attributes"
70
70
  require_relative "turbopuffer/models/language"
71
+ require_relative "turbopuffer/models/limit"
71
72
  require_relative "turbopuffer/models/namespace_delete_all_params"
72
73
  require_relative "turbopuffer/models/namespace_delete_all_response"
73
74
  require_relative "turbopuffer/models/namespace_explain_query_params"
@@ -0,0 +1,79 @@
1
+ # typed: strong
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class Limit < Turbopuffer::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Turbopuffer::Limit, Turbopuffer::Internal::AnyHash)
9
+ end
10
+
11
+ # Limits the total number of documents returned.
12
+ sig { returns(Integer) }
13
+ attr_accessor :total
14
+
15
+ # Limits the number of documents with the same value for a set of attributes (the
16
+ # "limit key") that can appear in the results.
17
+ sig { returns(T.nilable(Turbopuffer::Limit::Per)) }
18
+ attr_reader :per
19
+
20
+ sig { params(per: Turbopuffer::Limit::Per::OrHash).void }
21
+ attr_writer :per
22
+
23
+ # Limits the documents returned by a query.
24
+ sig do
25
+ params(total: Integer, per: Turbopuffer::Limit::Per::OrHash).returns(
26
+ T.attached_class
27
+ )
28
+ end
29
+ def self.new(
30
+ # Limits the total number of documents returned.
31
+ total:,
32
+ # Limits the number of documents with the same value for a set of attributes (the
33
+ # "limit key") that can appear in the results.
34
+ per: nil
35
+ )
36
+ end
37
+
38
+ sig { override.returns({ total: Integer, per: Turbopuffer::Limit::Per }) }
39
+ def to_hash
40
+ end
41
+
42
+ class Per < Turbopuffer::Internal::Type::BaseModel
43
+ OrHash =
44
+ T.type_alias do
45
+ T.any(Turbopuffer::Limit::Per, Turbopuffer::Internal::AnyHash)
46
+ end
47
+
48
+ # The attributes to include in the limit key.
49
+ sig { returns(T::Array[String]) }
50
+ attr_accessor :attributes
51
+
52
+ # The maximum number of documents to return for each value of the limit key.
53
+ sig { returns(Integer) }
54
+ attr_accessor :limit
55
+
56
+ # Limits the number of documents with the same value for a set of attributes (the
57
+ # "limit key") that can appear in the results.
58
+ sig do
59
+ params(attributes: T::Array[String], limit: Integer).returns(
60
+ T.attached_class
61
+ )
62
+ end
63
+ def self.new(
64
+ # The attributes to include in the limit key.
65
+ attributes:,
66
+ # The maximum number of documents to return for each value of the limit key.
67
+ limit:
68
+ )
69
+ end
70
+
71
+ sig do
72
+ override.returns({ attributes: T::Array[String], limit: Integer })
73
+ end
74
+ def to_hash
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -88,6 +88,13 @@ module Turbopuffer
88
88
  end
89
89
  attr_writer :include_attributes
90
90
 
91
+ # Limits the documents returned by a query.
92
+ sig { returns(T.nilable(T.any(Integer, Turbopuffer::Limit))) }
93
+ attr_reader :limit
94
+
95
+ sig { params(limit: T.any(Integer, Turbopuffer::Limit::OrHash)).void }
96
+ attr_writer :limit
97
+
91
98
  # How to rank the documents in the namespace.
92
99
  sig { returns(T.nilable(T.anything)) }
93
100
  attr_reader :rank_by
@@ -122,6 +129,7 @@ module Turbopuffer
122
129
  filters: T.anything,
123
130
  group_by: T::Array[String],
124
131
  include_attributes: Turbopuffer::IncludeAttributes::Variants,
132
+ limit: T.any(Integer, Turbopuffer::Limit::OrHash),
125
133
  rank_by: T.anything,
126
134
  top_k: Integer,
127
135
  vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
@@ -148,6 +156,8 @@ module Turbopuffer
148
156
  group_by: nil,
149
157
  # Whether to include attributes in the response.
150
158
  include_attributes: nil,
159
+ # Limits the documents returned by a query.
160
+ limit: nil,
151
161
  # How to rank the documents in the namespace.
152
162
  rank_by: nil,
153
163
  # The number of results to return.
@@ -169,6 +179,7 @@ module Turbopuffer
169
179
  filters: T.anything,
170
180
  group_by: T::Array[String],
171
181
  include_attributes: Turbopuffer::IncludeAttributes::Variants,
182
+ limit: T.any(Integer, Turbopuffer::Limit),
172
183
  rank_by: T.anything,
173
184
  top_k: Integer,
174
185
  vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
@@ -268,6 +279,21 @@ module Turbopuffer
268
279
  end
269
280
  end
270
281
  end
282
+
283
+ # Limits the documents returned by a query.
284
+ module Limit
285
+ extend Turbopuffer::Internal::Type::Union
286
+
287
+ Variants = T.type_alias { T.any(Integer, Turbopuffer::Limit) }
288
+
289
+ sig do
290
+ override.returns(
291
+ T::Array[Turbopuffer::NamespaceExplainQueryParams::Limit::Variants]
292
+ )
293
+ end
294
+ def self.variants
295
+ end
296
+ end
271
297
  end
272
298
  end
273
299
  end
@@ -83,6 +83,13 @@ module Turbopuffer
83
83
  end
84
84
  attr_writer :include_attributes
85
85
 
86
+ # Limits the documents returned by a query.
87
+ sig { returns(T.nilable(T.any(Integer, Turbopuffer::Limit))) }
88
+ attr_reader :limit
89
+
90
+ sig { params(limit: T.any(Integer, Turbopuffer::Limit::OrHash)).void }
91
+ attr_writer :limit
92
+
86
93
  # How to rank the documents in the namespace.
87
94
  sig { returns(T.nilable(T.anything)) }
88
95
  attr_reader :rank_by
@@ -116,6 +123,7 @@ module Turbopuffer
116
123
  filters: T.anything,
117
124
  group_by: T::Array[String],
118
125
  include_attributes: Turbopuffer::IncludeAttributes::Variants,
126
+ limit: T.any(Integer, Turbopuffer::Limit::OrHash),
119
127
  rank_by: T.anything,
120
128
  top_k: Integer,
121
129
  vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
@@ -142,6 +150,8 @@ module Turbopuffer
142
150
  group_by: nil,
143
151
  # Whether to include attributes in the response.
144
152
  include_attributes: nil,
153
+ # Limits the documents returned by a query.
154
+ limit: nil,
145
155
  # How to rank the documents in the namespace.
146
156
  rank_by: nil,
147
157
  # The number of results to return.
@@ -163,6 +173,7 @@ module Turbopuffer
163
173
  filters: T.anything,
164
174
  group_by: T::Array[String],
165
175
  include_attributes: Turbopuffer::IncludeAttributes::Variants,
176
+ limit: T.any(Integer, Turbopuffer::Limit),
166
177
  rank_by: T.anything,
167
178
  top_k: Integer,
168
179
  vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
@@ -262,6 +273,21 @@ module Turbopuffer
262
273
  end
263
274
  end
264
275
  end
276
+
277
+ # Limits the documents returned by a query.
278
+ module Limit
279
+ extend Turbopuffer::Internal::Type::Union
280
+
281
+ Variants = T.type_alias { T.any(Integer, Turbopuffer::Limit) }
282
+
283
+ sig do
284
+ override.returns(
285
+ T::Array[Turbopuffer::NamespaceQueryParams::Limit::Variants]
286
+ )
287
+ end
288
+ def self.variants
289
+ end
290
+ end
265
291
  end
266
292
  end
267
293
  end
@@ -60,6 +60,13 @@ module Turbopuffer
60
60
  end
61
61
  attr_writer :include_attributes
62
62
 
63
+ # Limits the documents returned by a query.
64
+ sig { returns(T.nilable(T.any(Integer, Turbopuffer::Limit))) }
65
+ attr_reader :limit
66
+
67
+ sig { params(limit: T.any(Integer, Turbopuffer::Limit::OrHash)).void }
68
+ attr_writer :limit
69
+
63
70
  # How to rank the documents in the namespace.
64
71
  sig { returns(T.nilable(T.anything)) }
65
72
  attr_reader :rank_by
@@ -83,6 +90,7 @@ module Turbopuffer
83
90
  filters: T.anything,
84
91
  group_by: T::Array[String],
85
92
  include_attributes: Turbopuffer::IncludeAttributes::Variants,
93
+ limit: T.any(Integer, Turbopuffer::Limit::OrHash),
86
94
  rank_by: T.anything,
87
95
  top_k: Integer
88
96
  ).returns(T.attached_class)
@@ -104,6 +112,8 @@ module Turbopuffer
104
112
  group_by: nil,
105
113
  # Whether to include attributes in the response.
106
114
  include_attributes: nil,
115
+ # Limits the documents returned by a query.
116
+ limit: nil,
107
117
  # How to rank the documents in the namespace.
108
118
  rank_by: nil,
109
119
  # The number of results to return.
@@ -120,6 +130,7 @@ module Turbopuffer
120
130
  filters: T.anything,
121
131
  group_by: T::Array[String],
122
132
  include_attributes: Turbopuffer::IncludeAttributes::Variants,
133
+ limit: T.any(Integer, Turbopuffer::Limit),
123
134
  rank_by: T.anything,
124
135
  top_k: Integer
125
136
  }
@@ -127,6 +138,17 @@ module Turbopuffer
127
138
  end
128
139
  def to_hash
129
140
  end
141
+
142
+ # Limits the documents returned by a query.
143
+ module Limit
144
+ extend Turbopuffer::Internal::Type::Union
145
+
146
+ Variants = T.type_alias { T.any(Integer, Turbopuffer::Limit) }
147
+
148
+ sig { override.returns(T::Array[Turbopuffer::Query::Limit::Variants]) }
149
+ def self.variants
150
+ end
151
+ end
130
152
  end
131
153
  end
132
154
  end
@@ -37,6 +37,8 @@ module Turbopuffer
37
37
 
38
38
  Language = Turbopuffer::Models::Language
39
39
 
40
+ Limit = Turbopuffer::Models::Limit
41
+
40
42
  NamespaceDeleteAllParams = Turbopuffer::Models::NamespaceDeleteAllParams
41
43
 
42
44
  NamespaceExplainQueryParams = Turbopuffer::Models::NamespaceExplainQueryParams
@@ -29,6 +29,7 @@ module Turbopuffer
29
29
  filters: T.anything,
30
30
  group_by: T::Array[String],
31
31
  include_attributes: Turbopuffer::IncludeAttributes::Variants,
32
+ limit: T.any(Integer, Turbopuffer::Limit::OrHash),
32
33
  rank_by: T.anything,
33
34
  top_k: Integer,
34
35
  vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
@@ -56,6 +57,8 @@ module Turbopuffer
56
57
  group_by: nil,
57
58
  # Body param: Whether to include attributes in the response.
58
59
  include_attributes: nil,
60
+ # Body param: Limits the documents returned by a query.
61
+ limit: nil,
59
62
  # Body param: How to rank the documents in the namespace.
60
63
  rank_by: nil,
61
64
  # Body param: The number of results to return.
@@ -129,6 +132,7 @@ module Turbopuffer
129
132
  filters: T.anything,
130
133
  group_by: T::Array[String],
131
134
  include_attributes: Turbopuffer::IncludeAttributes::Variants,
135
+ limit: T.any(Integer, Turbopuffer::Limit::OrHash),
132
136
  rank_by: T.anything,
133
137
  top_k: Integer,
134
138
  vector_encoding: Turbopuffer::VectorEncoding::OrSymbol,
@@ -156,6 +160,8 @@ module Turbopuffer
156
160
  group_by: nil,
157
161
  # Body param: Whether to include attributes in the response.
158
162
  include_attributes: nil,
163
+ # Body param: Limits the documents returned by a query.
164
+ limit: nil,
159
165
  # Body param: How to rank the documents in the namespace.
160
166
  rank_by: nil,
161
167
  # Body param: The number of results to return.
@@ -0,0 +1,29 @@
1
+ module Turbopuffer
2
+ module Models
3
+ type limit = { total: Integer, per: Turbopuffer::Limit::Per }
4
+
5
+ class Limit < Turbopuffer::Internal::Type::BaseModel
6
+ attr_accessor total: Integer
7
+
8
+ attr_reader per: Turbopuffer::Limit::Per?
9
+
10
+ def per=: (Turbopuffer::Limit::Per) -> Turbopuffer::Limit::Per
11
+
12
+ def initialize: (total: Integer, ?per: Turbopuffer::Limit::Per) -> void
13
+
14
+ def to_hash: -> { total: Integer, per: Turbopuffer::Limit::Per }
15
+
16
+ type per = { attributes: ::Array[String], limit: Integer }
17
+
18
+ class Per < Turbopuffer::Internal::Type::BaseModel
19
+ attr_accessor attributes: ::Array[String]
20
+
21
+ attr_accessor limit: Integer
22
+
23
+ def initialize: (attributes: ::Array[String], limit: Integer) -> void
24
+
25
+ def to_hash: -> { attributes: ::Array[String], limit: Integer }
26
+ end
27
+ end
28
+ end
29
+ end
@@ -10,6 +10,7 @@ module Turbopuffer
10
10
  filters: top,
11
11
  group_by: ::Array[String],
12
12
  include_attributes: Turbopuffer::Models::include_attributes,
13
+ limit: Turbopuffer::Models::NamespaceExplainQueryParams::limit,
13
14
  rank_by: top,
14
15
  top_k: Integer,
15
16
  vector_encoding: Turbopuffer::Models::vector_encoding
@@ -58,6 +59,12 @@ module Turbopuffer
58
59
  Turbopuffer::Models::include_attributes
59
60
  ) -> Turbopuffer::Models::include_attributes
60
61
 
62
+ attr_reader limit: Turbopuffer::Models::NamespaceExplainQueryParams::limit?
63
+
64
+ def limit=: (
65
+ Turbopuffer::Models::NamespaceExplainQueryParams::limit
66
+ ) -> Turbopuffer::Models::NamespaceExplainQueryParams::limit
67
+
61
68
  attr_reader rank_by: top?
62
69
 
63
70
  def rank_by=: (top) -> top
@@ -81,6 +88,7 @@ module Turbopuffer
81
88
  ?filters: top,
82
89
  ?group_by: ::Array[String],
83
90
  ?include_attributes: Turbopuffer::Models::include_attributes,
91
+ ?limit: Turbopuffer::Models::NamespaceExplainQueryParams::limit,
84
92
  ?rank_by: top,
85
93
  ?top_k: Integer,
86
94
  ?vector_encoding: Turbopuffer::Models::vector_encoding,
@@ -96,6 +104,7 @@ module Turbopuffer
96
104
  filters: top,
97
105
  group_by: ::Array[String],
98
106
  include_attributes: Turbopuffer::Models::include_attributes,
107
+ limit: Turbopuffer::Models::NamespaceExplainQueryParams::limit,
99
108
  rank_by: top,
100
109
  top_k: Integer,
101
110
  vector_encoding: Turbopuffer::Models::vector_encoding,
@@ -136,6 +145,14 @@ module Turbopuffer
136
145
  def self?.values: -> ::Array[Turbopuffer::Models::NamespaceExplainQueryParams::Consistency::level]
137
146
  end
138
147
  end
148
+
149
+ type limit = Integer | Turbopuffer::Limit
150
+
151
+ module Limit
152
+ extend Turbopuffer::Internal::Type::Union
153
+
154
+ def self?.variants: -> ::Array[Turbopuffer::Models::NamespaceExplainQueryParams::limit]
155
+ end
139
156
  end
140
157
  end
141
158
  end
@@ -10,6 +10,7 @@ module Turbopuffer
10
10
  filters: top,
11
11
  group_by: ::Array[String],
12
12
  include_attributes: Turbopuffer::Models::include_attributes,
13
+ limit: Turbopuffer::Models::NamespaceQueryParams::limit,
13
14
  rank_by: top,
14
15
  top_k: Integer,
15
16
  vector_encoding: Turbopuffer::Models::vector_encoding
@@ -58,6 +59,12 @@ module Turbopuffer
58
59
  Turbopuffer::Models::include_attributes
59
60
  ) -> Turbopuffer::Models::include_attributes
60
61
 
62
+ attr_reader limit: Turbopuffer::Models::NamespaceQueryParams::limit?
63
+
64
+ def limit=: (
65
+ Turbopuffer::Models::NamespaceQueryParams::limit
66
+ ) -> Turbopuffer::Models::NamespaceQueryParams::limit
67
+
61
68
  attr_reader rank_by: top?
62
69
 
63
70
  def rank_by=: (top) -> top
@@ -81,6 +88,7 @@ module Turbopuffer
81
88
  ?filters: top,
82
89
  ?group_by: ::Array[String],
83
90
  ?include_attributes: Turbopuffer::Models::include_attributes,
91
+ ?limit: Turbopuffer::Models::NamespaceQueryParams::limit,
84
92
  ?rank_by: top,
85
93
  ?top_k: Integer,
86
94
  ?vector_encoding: Turbopuffer::Models::vector_encoding,
@@ -96,6 +104,7 @@ module Turbopuffer
96
104
  filters: top,
97
105
  group_by: ::Array[String],
98
106
  include_attributes: Turbopuffer::Models::include_attributes,
107
+ limit: Turbopuffer::Models::NamespaceQueryParams::limit,
99
108
  rank_by: top,
100
109
  top_k: Integer,
101
110
  vector_encoding: Turbopuffer::Models::vector_encoding,
@@ -134,6 +143,14 @@ module Turbopuffer
134
143
  def self?.values: -> ::Array[Turbopuffer::Models::NamespaceQueryParams::Consistency::level]
135
144
  end
136
145
  end
146
+
147
+ type limit = Integer | Turbopuffer::Limit
148
+
149
+ module Limit
150
+ extend Turbopuffer::Internal::Type::Union
151
+
152
+ def self?.variants: -> ::Array[Turbopuffer::Models::NamespaceQueryParams::limit]
153
+ end
137
154
  end
138
155
  end
139
156
  end
@@ -8,6 +8,7 @@ module Turbopuffer
8
8
  filters: top,
9
9
  group_by: ::Array[String],
10
10
  include_attributes: Turbopuffer::Models::include_attributes,
11
+ limit: Turbopuffer::Models::Query::limit,
11
12
  rank_by: top,
12
13
  top_k: Integer
13
14
  }
@@ -41,6 +42,12 @@ module Turbopuffer
41
42
  Turbopuffer::Models::include_attributes
42
43
  ) -> Turbopuffer::Models::include_attributes
43
44
 
45
+ attr_reader limit: Turbopuffer::Models::Query::limit?
46
+
47
+ def limit=: (
48
+ Turbopuffer::Models::Query::limit
49
+ ) -> Turbopuffer::Models::Query::limit
50
+
44
51
  attr_reader rank_by: top?
45
52
 
46
53
  def rank_by=: (top) -> top
@@ -56,6 +63,7 @@ module Turbopuffer
56
63
  ?filters: top,
57
64
  ?group_by: ::Array[String],
58
65
  ?include_attributes: Turbopuffer::Models::include_attributes,
66
+ ?limit: Turbopuffer::Models::Query::limit,
59
67
  ?rank_by: top,
60
68
  ?top_k: Integer
61
69
  ) -> void
@@ -67,9 +75,18 @@ module Turbopuffer
67
75
  filters: top,
68
76
  group_by: ::Array[String],
69
77
  include_attributes: Turbopuffer::Models::include_attributes,
78
+ limit: Turbopuffer::Models::Query::limit,
70
79
  rank_by: top,
71
80
  top_k: Integer
72
81
  }
82
+
83
+ type limit = Integer | Turbopuffer::Limit
84
+
85
+ module Limit
86
+ extend Turbopuffer::Internal::Type::Union
87
+
88
+ def self?.variants: -> ::Array[Turbopuffer::Models::Query::limit]
89
+ end
73
90
  end
74
91
  end
75
92
  end
@@ -29,6 +29,8 @@ module Turbopuffer
29
29
 
30
30
  module Language = Turbopuffer::Models::Language
31
31
 
32
+ class Limit = Turbopuffer::Models::Limit
33
+
32
34
  class NamespaceDeleteAllParams = Turbopuffer::Models::NamespaceDeleteAllParams
33
35
 
34
36
  class NamespaceExplainQueryParams = Turbopuffer::Models::NamespaceExplainQueryParams
@@ -15,6 +15,7 @@ module Turbopuffer
15
15
  ?filters: top,
16
16
  ?group_by: ::Array[String],
17
17
  ?include_attributes: Turbopuffer::Models::include_attributes,
18
+ ?limit: Turbopuffer::Models::NamespaceExplainQueryParams::limit,
18
19
  ?rank_by: top,
19
20
  ?top_k: Integer,
20
21
  ?vector_encoding: Turbopuffer::Models::vector_encoding,
@@ -48,6 +49,7 @@ module Turbopuffer
48
49
  ?filters: top,
49
50
  ?group_by: ::Array[String],
50
51
  ?include_attributes: Turbopuffer::Models::include_attributes,
52
+ ?limit: Turbopuffer::Models::NamespaceQueryParams::limit,
51
53
  ?rank_by: top,
52
54
  ?top_k: Integer,
53
55
  ?vector_encoding: Turbopuffer::Models::vector_encoding,
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.12.2
4
+ version: 1.13.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-02-06 00:00:00.000000000 Z
11
+ date: 2026-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi
@@ -85,6 +85,7 @@ files:
85
85
  - lib/turbopuffer/models/id.rb
86
86
  - lib/turbopuffer/models/include_attributes.rb
87
87
  - lib/turbopuffer/models/language.rb
88
+ - lib/turbopuffer/models/limit.rb
88
89
  - lib/turbopuffer/models/namespace_delete_all_params.rb
89
90
  - lib/turbopuffer/models/namespace_delete_all_response.rb
90
91
  - lib/turbopuffer/models/namespace_explain_query_params.rb
@@ -154,6 +155,7 @@ files:
154
155
  - rbi/turbopuffer/models/id.rbi
155
156
  - rbi/turbopuffer/models/include_attributes.rbi
156
157
  - rbi/turbopuffer/models/language.rbi
158
+ - rbi/turbopuffer/models/limit.rbi
157
159
  - rbi/turbopuffer/models/namespace_delete_all_params.rbi
158
160
  - rbi/turbopuffer/models/namespace_delete_all_response.rbi
159
161
  - rbi/turbopuffer/models/namespace_explain_query_params.rbi
@@ -222,6 +224,7 @@ files:
222
224
  - sig/turbopuffer/models/id.rbs
223
225
  - sig/turbopuffer/models/include_attributes.rbs
224
226
  - sig/turbopuffer/models/language.rbs
227
+ - sig/turbopuffer/models/limit.rbs
225
228
  - sig/turbopuffer/models/namespace_delete_all_params.rbs
226
229
  - sig/turbopuffer/models/namespace_delete_all_response.rbs
227
230
  - sig/turbopuffer/models/namespace_explain_query_params.rbs