turbopuffer 2.3.0 → 2.4.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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +2 -2
  4. data/lib/turbopuffer/models/attribute_schema_config.rb +14 -1
  5. data/lib/turbopuffer/models/highlight_config_params.rb +46 -0
  6. data/lib/turbopuffer/models/highlight_fragment_by.rb +25 -0
  7. data/lib/turbopuffer/models/highlight_offset_units.rb +17 -0
  8. data/lib/turbopuffer/models/namespace_explain_query_params.rb +11 -1
  9. data/lib/turbopuffer/models/namespace_metadata.rb +12 -1
  10. data/lib/turbopuffer/models/namespace_multi_query_params.rb +11 -1
  11. data/lib/turbopuffer/models/namespace_query_params.rb +11 -1
  12. data/lib/turbopuffer/models/namespace_write_params.rb +12 -1
  13. data/lib/turbopuffer/models/rrf_params.rb +14 -1
  14. data/lib/turbopuffer/models/sharding_config.rb +21 -0
  15. data/lib/turbopuffer/models.rb +8 -0
  16. data/lib/turbopuffer/resources/namespaces.rb +9 -3
  17. data/lib/turbopuffer/version.rb +1 -1
  18. data/lib/turbopuffer.rb +4 -0
  19. data/rbi/turbopuffer/models/attribute_schema_config.rbi +20 -3
  20. data/rbi/turbopuffer/models/highlight_config_params.rbi +85 -0
  21. data/rbi/turbopuffer/models/highlight_fragment_by.rbi +36 -0
  22. data/rbi/turbopuffer/models/highlight_offset_units.rbi +27 -0
  23. data/rbi/turbopuffer/models/namespace_explain_query_params.rbi +15 -0
  24. data/rbi/turbopuffer/models/namespace_metadata.rbi +20 -3
  25. data/rbi/turbopuffer/models/namespace_multi_query_params.rbi +15 -0
  26. data/rbi/turbopuffer/models/namespace_query_params.rbi +15 -0
  27. data/rbi/turbopuffer/models/namespace_write_params.rbi +17 -0
  28. data/rbi/turbopuffer/models/rrf_params.rbi +22 -3
  29. data/rbi/turbopuffer/models/sharding_config.rbi +31 -0
  30. data/rbi/turbopuffer/models.rbi +8 -0
  31. data/rbi/turbopuffer/resources/namespaces.rbi +16 -0
  32. data/sig/turbopuffer/models/attribute_schema_config.rbs +12 -3
  33. data/sig/turbopuffer/models/highlight_config_params.rbs +47 -0
  34. data/sig/turbopuffer/models/highlight_fragment_by.rbs +23 -0
  35. data/sig/turbopuffer/models/highlight_offset_units.rbs +15 -0
  36. data/sig/turbopuffer/models/namespace_explain_query_params.rbs +7 -0
  37. data/sig/turbopuffer/models/namespace_metadata.rbs +12 -3
  38. data/sig/turbopuffer/models/namespace_multi_query_params.rbs +7 -0
  39. data/sig/turbopuffer/models/namespace_query_params.rbs +7 -0
  40. data/sig/turbopuffer/models/namespace_write_params.rbs +9 -0
  41. data/sig/turbopuffer/models/rrf_params.rbs +10 -3
  42. data/sig/turbopuffer/models/sharding_config.rbs +13 -0
  43. data/sig/turbopuffer/models.rbs +8 -0
  44. data/sig/turbopuffer/resources/namespaces.rbs +3 -0
  45. metadata +14 -2
@@ -0,0 +1,36 @@
1
+ # typed: strong
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # How to split a text attribute into fragments for highlighting.
6
+ module HighlightFragmentBy
7
+ extend Turbopuffer::Internal::Type::Enum
8
+
9
+ TaggedSymbol =
10
+ T.type_alias { T.all(Symbol, Turbopuffer::HighlightFragmentBy) }
11
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
12
+
13
+ # Treat the whole attribute as a single fragment.
14
+ NONE = T.let(:none, Turbopuffer::HighlightFragmentBy::TaggedSymbol)
15
+
16
+ # Split the attribute into sentences. This is the default.
17
+ SENTENCE =
18
+ T.let(:sentence, Turbopuffer::HighlightFragmentBy::TaggedSymbol)
19
+
20
+ # Split the attribute into paragraphs.
21
+ PARAGRAPH =
22
+ T.let(:paragraph, Turbopuffer::HighlightFragmentBy::TaggedSymbol)
23
+
24
+ # Split the attribute into individual words.
25
+ WORD = T.let(:word, Turbopuffer::HighlightFragmentBy::TaggedSymbol)
26
+
27
+ sig do
28
+ override.returns(
29
+ T::Array[Turbopuffer::HighlightFragmentBy::TaggedSymbol]
30
+ )
31
+ end
32
+ def self.values
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # The units to report highlighted fragment offsets in.
6
+ module HighlightOffsetUnits
7
+ extend Turbopuffer::Internal::Type::Enum
8
+
9
+ TaggedSymbol =
10
+ T.type_alias { T.all(Symbol, Turbopuffer::HighlightOffsetUnits) }
11
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
12
+
13
+ UTF_8 = T.let(:"utf-8", Turbopuffer::HighlightOffsetUnits::TaggedSymbol)
14
+ UTF_16 = T.let(:"utf-16", Turbopuffer::HighlightOffsetUnits::TaggedSymbol)
15
+ CODEPOINTS =
16
+ T.let(:codepoints, Turbopuffer::HighlightOffsetUnits::TaggedSymbol)
17
+
18
+ sig do
19
+ override.returns(
20
+ T::Array[Turbopuffer::HighlightOffsetUnits::TaggedSymbol]
21
+ )
22
+ end
23
+ def self.values
24
+ end
25
+ end
26
+ end
27
+ end
@@ -28,6 +28,15 @@ module Turbopuffer
28
28
  sig { params(aggregate_by: T::Hash[Symbol, T.anything]).void }
29
29
  attr_writer :aggregate_by
30
30
 
31
+ # Computes additional values on documents returned by a query. Each key is the
32
+ # name of the computed attribute; each value is an expression describing how to
33
+ # compute it.
34
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
35
+ attr_reader :compute_attributes
36
+
37
+ sig { params(compute_attributes: T::Hash[Symbol, T.anything]).void }
38
+ attr_writer :compute_attributes
39
+
31
40
  # The consistency level for a query.
32
41
  sig do
33
42
  returns(
@@ -122,6 +131,7 @@ module Turbopuffer
122
131
  params(
123
132
  namespace: String,
124
133
  aggregate_by: T::Hash[Symbol, T.anything],
134
+ compute_attributes: T::Hash[Symbol, T.anything],
125
135
  consistency:
126
136
  Turbopuffer::NamespaceExplainQueryParams::Consistency::OrHash,
127
137
  distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
@@ -141,6 +151,10 @@ module Turbopuffer
141
151
  # Aggregations to compute over all documents in the namespace that match the
142
152
  # filters.
143
153
  aggregate_by: nil,
154
+ # Computes additional values on documents returned by a query. Each key is the
155
+ # name of the computed attribute; each value is an expression describing how to
156
+ # compute it.
157
+ compute_attributes: nil,
144
158
  # The consistency level for a query.
145
159
  consistency: nil,
146
160
  # A function used to calculate vector similarity.
@@ -173,6 +187,7 @@ module Turbopuffer
173
187
  {
174
188
  namespace: String,
175
189
  aggregate_by: T::Hash[Symbol, T.anything],
190
+ compute_attributes: T::Hash[Symbol, T.anything],
176
191
  consistency: Turbopuffer::NamespaceExplainQueryParams::Consistency,
177
192
  distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
178
193
  exclude_attributes: T::Array[String],
@@ -45,6 +45,16 @@ module Turbopuffer
45
45
  end
46
46
  attr_writer :pinning
47
47
 
48
+ # Configuration for namespace sharding, which partitions a namespace's documents
49
+ # across multiple internal shards to scale indexing and query throughput beyond a
50
+ # single machine. Sharding can only be configured on a namespace's inaugural
51
+ # write, and cannot be added to or changed on an existing namespace.
52
+ sig { returns(T.nilable(Turbopuffer::ShardingConfig)) }
53
+ attr_reader :sharding
54
+
55
+ sig { params(sharding: Turbopuffer::ShardingConfig::OrHash).void }
56
+ attr_writer :sharding
57
+
48
58
  # Metadata about a namespace.
49
59
  sig do
50
60
  params(
@@ -63,7 +73,8 @@ module Turbopuffer
63
73
  ),
64
74
  schema: T::Hash[Symbol, Turbopuffer::AttributeSchemaConfig::OrHash],
65
75
  updated_at: Time,
66
- pinning: Turbopuffer::NamespaceMetadata::Pinning::OrHash
76
+ pinning: Turbopuffer::NamespaceMetadata::Pinning::OrHash,
77
+ sharding: Turbopuffer::ShardingConfig::OrHash
67
78
  ).returns(T.attached_class)
68
79
  end
69
80
  def self.new(
@@ -82,7 +93,12 @@ module Turbopuffer
82
93
  updated_at:,
83
94
  # Configuration for namespace pinning, along with the current status of the pinned
84
95
  # namespace.
85
- pinning: nil
96
+ pinning: nil,
97
+ # Configuration for namespace sharding, which partitions a namespace's documents
98
+ # across multiple internal shards to scale indexing and query throughput beyond a
99
+ # single machine. Sharding can only be configured on a namespace's inaugural
100
+ # write, and cannot be added to or changed on an existing namespace.
101
+ sharding: nil
86
102
  )
87
103
  end
88
104
 
@@ -96,7 +112,8 @@ module Turbopuffer
96
112
  index: Turbopuffer::NamespaceMetadata::Index::Variants,
97
113
  schema: T::Hash[Symbol, Turbopuffer::AttributeSchemaConfig],
98
114
  updated_at: Time,
99
- pinning: Turbopuffer::NamespaceMetadata::Pinning
115
+ pinning: Turbopuffer::NamespaceMetadata::Pinning,
116
+ sharding: Turbopuffer::ShardingConfig
100
117
  }
101
118
  )
102
119
  end
@@ -110,6 +110,15 @@ module Turbopuffer
110
110
  sig { params(aggregate_by: T::Hash[Symbol, T.anything]).void }
111
111
  attr_writer :aggregate_by
112
112
 
113
+ # Computes additional values on documents returned by a query. Each key is the
114
+ # name of the computed attribute; each value is an expression describing how to
115
+ # compute it.
116
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
117
+ attr_reader :compute_attributes
118
+
119
+ sig { params(compute_attributes: T::Hash[Symbol, T.anything]).void }
120
+ attr_writer :compute_attributes
121
+
113
122
  # A function used to calculate vector similarity.
114
123
  sig { returns(T.nilable(Turbopuffer::DistanceMetric::OrSymbol)) }
115
124
  attr_reader :distance_metric
@@ -179,6 +188,7 @@ module Turbopuffer
179
188
  sig do
180
189
  params(
181
190
  aggregate_by: T::Hash[Symbol, T.anything],
191
+ compute_attributes: T::Hash[Symbol, T.anything],
182
192
  distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
183
193
  exclude_attributes: T::Array[String],
184
194
  filters: T.anything,
@@ -193,6 +203,10 @@ module Turbopuffer
193
203
  # Aggregations to compute over all documents in the namespace that match the
194
204
  # filters.
195
205
  aggregate_by: nil,
206
+ # Computes additional values on documents returned by a query. Each key is the
207
+ # name of the computed attribute; each value is an expression describing how to
208
+ # compute it.
209
+ compute_attributes: nil,
196
210
  # A function used to calculate vector similarity.
197
211
  distance_metric: nil,
198
212
  # List of attribute names to exclude from the response. All other attributes will
@@ -219,6 +233,7 @@ module Turbopuffer
219
233
  override.returns(
220
234
  {
221
235
  aggregate_by: T::Hash[Symbol, T.anything],
236
+ compute_attributes: T::Hash[Symbol, T.anything],
222
237
  distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
223
238
  exclude_attributes: T::Array[String],
224
239
  filters: T.anything,
@@ -28,6 +28,15 @@ module Turbopuffer
28
28
  sig { params(aggregate_by: T::Hash[Symbol, T.anything]).void }
29
29
  attr_writer :aggregate_by
30
30
 
31
+ # Computes additional values on documents returned by a query. Each key is the
32
+ # name of the computed attribute; each value is an expression describing how to
33
+ # compute it.
34
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
35
+ attr_reader :compute_attributes
36
+
37
+ sig { params(compute_attributes: T::Hash[Symbol, T.anything]).void }
38
+ attr_writer :compute_attributes
39
+
31
40
  # The consistency level for a query.
32
41
  sig { returns(T.nilable(Turbopuffer::NamespaceQueryParams::Consistency)) }
33
42
  attr_reader :consistency
@@ -117,6 +126,7 @@ module Turbopuffer
117
126
  params(
118
127
  namespace: String,
119
128
  aggregate_by: T::Hash[Symbol, T.anything],
129
+ compute_attributes: T::Hash[Symbol, T.anything],
120
130
  consistency: Turbopuffer::NamespaceQueryParams::Consistency::OrHash,
121
131
  distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
122
132
  exclude_attributes: T::Array[String],
@@ -135,6 +145,10 @@ module Turbopuffer
135
145
  # Aggregations to compute over all documents in the namespace that match the
136
146
  # filters.
137
147
  aggregate_by: nil,
148
+ # Computes additional values on documents returned by a query. Each key is the
149
+ # name of the computed attribute; each value is an expression describing how to
150
+ # compute it.
151
+ compute_attributes: nil,
138
152
  # The consistency level for a query.
139
153
  consistency: nil,
140
154
  # A function used to calculate vector similarity.
@@ -167,6 +181,7 @@ module Turbopuffer
167
181
  {
168
182
  namespace: String,
169
183
  aggregate_by: T::Hash[Symbol, T.anything],
184
+ compute_attributes: T::Hash[Symbol, T.anything],
170
185
  consistency: Turbopuffer::NamespaceQueryParams::Consistency,
171
186
  distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
172
187
  exclude_attributes: T::Array[String],
@@ -209,6 +209,16 @@ module Turbopuffer
209
209
  end
210
210
  attr_writer :schema
211
211
 
212
+ # Configuration for namespace sharding, which partitions a namespace's documents
213
+ # across multiple internal shards to scale indexing and query throughput beyond a
214
+ # single machine. Sharding can only be configured on a namespace's inaugural
215
+ # write, and cannot be added to or changed on an existing namespace.
216
+ sig { returns(T.nilable(Turbopuffer::ShardingConfig)) }
217
+ attr_reader :sharding
218
+
219
+ sig { params(sharding: Turbopuffer::ShardingConfig::OrHash).void }
220
+ attr_writer :sharding
221
+
212
222
  # A list of documents in columnar format. Each key is a column name, mapped to an
213
223
  # array of values for that column.
214
224
  sig { returns(T.nilable(Turbopuffer::Columns)) }
@@ -267,6 +277,7 @@ module Turbopuffer
267
277
  Symbol,
268
278
  T.any(String, Turbopuffer::AttributeSchemaConfig::OrHash)
269
279
  ],
280
+ sharding: Turbopuffer::ShardingConfig::OrHash,
270
281
  upsert_columns: Turbopuffer::Columns::OrHash,
271
282
  upsert_condition: T.anything,
272
283
  upsert_rows: T::Array[Turbopuffer::Row::OrHash],
@@ -310,6 +321,11 @@ module Turbopuffer
310
321
  return_affected_ids: nil,
311
322
  # The schema of the attributes attached to the documents.
312
323
  schema: nil,
324
+ # Configuration for namespace sharding, which partitions a namespace's documents
325
+ # across multiple internal shards to scale indexing and query throughput beyond a
326
+ # single machine. Sharding can only be configured on a namespace's inaugural
327
+ # write, and cannot be added to or changed on an existing namespace.
328
+ sharding: nil,
313
329
  # A list of documents in columnar format. Each key is a column name, mapped to an
314
330
  # array of values for that column.
315
331
  upsert_columns: nil,
@@ -357,6 +373,7 @@ module Turbopuffer
357
373
  Symbol,
358
374
  T.any(String, Turbopuffer::AttributeSchemaConfig)
359
375
  ],
376
+ sharding: Turbopuffer::ShardingConfig,
360
377
  upsert_columns: Turbopuffer::Columns,
361
378
  upsert_condition: T.anything,
362
379
  upsert_rows: T::Array[Turbopuffer::Row],
@@ -15,15 +15,34 @@ module Turbopuffer
15
15
  sig { params(rank_constant: Integer).void }
16
16
  attr_writer :rank_constant
17
17
 
18
+ # A positive weight for each subquery, in the same order as `queries`. The number
19
+ # of weights must match the number of subqueries. When omitted, every subquery has
20
+ # a weight of `1`.
21
+ sig { returns(T.nilable(T::Array[Float])) }
22
+ attr_reader :weights
23
+
24
+ sig { params(weights: T::Array[Float]).void }
25
+ attr_writer :weights
26
+
18
27
  # Configuration options for RRF.
19
- sig { params(rank_constant: Integer).returns(T.attached_class) }
28
+ sig do
29
+ params(rank_constant: Integer, weights: T::Array[Float]).returns(
30
+ T.attached_class
31
+ )
32
+ end
20
33
  def self.new(
21
34
  # RRF rank constant (`k`). Must be greater than zero. Defaults to `60`.
22
- rank_constant: nil
35
+ rank_constant: nil,
36
+ # A positive weight for each subquery, in the same order as `queries`. The number
37
+ # of weights must match the number of subqueries. When omitted, every subquery has
38
+ # a weight of `1`.
39
+ weights: nil
23
40
  )
24
41
  end
25
42
 
26
- sig { override.returns({ rank_constant: Integer }) }
43
+ sig do
44
+ override.returns({ rank_constant: Integer, weights: T::Array[Float] })
45
+ end
27
46
  def to_hash
28
47
  end
29
48
  end
@@ -0,0 +1,31 @@
1
+ # typed: strong
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class ShardingConfig < Turbopuffer::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Turbopuffer::ShardingConfig, Turbopuffer::Internal::AnyHash)
9
+ end
10
+
11
+ # The number of shards to partition the namespace into.
12
+ sig { returns(Integer) }
13
+ attr_accessor :num_shards
14
+
15
+ # Configuration for namespace sharding, which partitions a namespace's documents
16
+ # across multiple internal shards to scale indexing and query throughput beyond a
17
+ # single machine. Sharding can only be configured on a namespace's inaugural
18
+ # write, and cannot be added to or changed on an existing namespace.
19
+ sig { params(num_shards: Integer).returns(T.attached_class) }
20
+ def self.new(
21
+ # The number of shards to partition the namespace into.
22
+ num_shards:
23
+ )
24
+ end
25
+
26
+ sig { override.returns({ num_shards: Integer }) }
27
+ def to_hash
28
+ end
29
+ end
30
+ end
31
+ end
@@ -49,6 +49,12 @@ module Turbopuffer
49
49
 
50
50
  FuzzyParams = Turbopuffer::Models::FuzzyParams
51
51
 
52
+ HighlightConfigParams = Turbopuffer::Models::HighlightConfigParams
53
+
54
+ HighlightFragmentBy = Turbopuffer::Models::HighlightFragmentBy
55
+
56
+ HighlightOffsetUnits = Turbopuffer::Models::HighlightOffsetUnits
57
+
52
58
  ID = Turbopuffer::Models::ID
53
59
 
54
60
  IncludeAttributes = Turbopuffer::Models::IncludeAttributes
@@ -103,6 +109,8 @@ module Turbopuffer
103
109
 
104
110
  SaturateParams = Turbopuffer::Models::SaturateParams
105
111
 
112
+ ShardingConfig = Turbopuffer::Models::ShardingConfig
113
+
106
114
  SparseDistanceMetric = Turbopuffer::Models::SparseDistanceMetric
107
115
 
108
116
  Tokenizer = Turbopuffer::Models::Tokenizer
@@ -71,6 +71,7 @@ module Turbopuffer
71
71
  params(
72
72
  namespace: String,
73
73
  aggregate_by: T::Hash[Symbol, T.anything],
74
+ compute_attributes: T::Hash[Symbol, T.anything],
74
75
  consistency:
75
76
  Turbopuffer::NamespaceExplainQueryParams::Consistency::OrHash,
76
77
  distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
@@ -91,6 +92,10 @@ module Turbopuffer
91
92
  # Body param: Aggregations to compute over all documents in the namespace that
92
93
  # match the filters.
93
94
  aggregate_by: nil,
95
+ # Body param: Computes additional values on documents returned by a query. Each
96
+ # key is the name of the computed attribute; each value is an expression
97
+ # describing how to compute it.
98
+ compute_attributes: nil,
94
99
  # Body param: The consistency level for a query.
95
100
  consistency: nil,
96
101
  # Body param: A function used to calculate vector similarity.
@@ -180,6 +185,7 @@ module Turbopuffer
180
185
  params(
181
186
  namespace: T.nilable(String),
182
187
  aggregate_by: T::Hash[Symbol, T.anything],
188
+ compute_attributes: T::Hash[Symbol, T.anything],
183
189
  consistency: Turbopuffer::NamespaceQueryParams::Consistency::OrHash,
184
190
  distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
185
191
  exclude_attributes: T::Array[String],
@@ -199,6 +205,10 @@ module Turbopuffer
199
205
  # Body param: Aggregations to compute over all documents in the namespace that
200
206
  # match the filters.
201
207
  aggregate_by: nil,
208
+ # Body param: Computes additional values on documents returned by a query. Each
209
+ # key is the name of the computed attribute; each value is an expression
210
+ # describing how to compute it.
211
+ compute_attributes: nil,
202
212
  # Body param: The consistency level for a query.
203
213
  consistency: nil,
204
214
  # Body param: A function used to calculate vector similarity.
@@ -352,6 +362,7 @@ module Turbopuffer
352
362
  Symbol,
353
363
  T.any(String, Turbopuffer::AttributeSchemaConfig::OrHash)
354
364
  ],
365
+ sharding: Turbopuffer::ShardingConfig::OrHash,
355
366
  upsert_columns: Turbopuffer::Columns::OrHash,
356
367
  upsert_condition: T.anything,
357
368
  upsert_rows: T::Array[Turbopuffer::Row::OrHash],
@@ -399,6 +410,11 @@ module Turbopuffer
399
410
  return_affected_ids: nil,
400
411
  # Body param: The schema of the attributes attached to the documents.
401
412
  schema: nil,
413
+ # Body param: Configuration for namespace sharding, which partitions a namespace's
414
+ # documents across multiple internal shards to scale indexing and query throughput
415
+ # beyond a single machine. Sharding can only be configured on a namespace's
416
+ # inaugural write, and cannot be added to or changed on an existing namespace.
417
+ sharding: nil,
402
418
  # Body param: A list of documents in columnar format. Each key is a column name,
403
419
  # mapped to an array of values for that column.
404
420
  upsert_columns: nil,
@@ -82,7 +82,10 @@ module Turbopuffer
82
82
  extend Turbopuffer::Internal::Type::Union
83
83
 
84
84
  type ann_config =
85
- { distance_metric: Turbopuffer::Models::distance_metric }
85
+ {
86
+ distance_metric: Turbopuffer::Models::distance_metric,
87
+ late_interaction: bool
88
+ }
86
89
 
87
90
  class AnnConfig < Turbopuffer::Internal::Type::BaseModel
88
91
  attr_reader distance_metric: Turbopuffer::Models::distance_metric?
@@ -91,12 +94,18 @@ module Turbopuffer
91
94
  Turbopuffer::Models::distance_metric
92
95
  ) -> Turbopuffer::Models::distance_metric
93
96
 
97
+ attr_reader late_interaction: bool?
98
+
99
+ def late_interaction=: (bool) -> bool
100
+
94
101
  def initialize: (
95
- ?distance_metric: Turbopuffer::Models::distance_metric
102
+ ?distance_metric: Turbopuffer::Models::distance_metric,
103
+ ?late_interaction: bool
96
104
  ) -> void
97
105
 
98
106
  def to_hash: -> {
99
- distance_metric: Turbopuffer::Models::distance_metric
107
+ distance_metric: Turbopuffer::Models::distance_metric,
108
+ late_interaction: bool
100
109
  }
101
110
  end
102
111
 
@@ -0,0 +1,47 @@
1
+ module Turbopuffer
2
+ module Models
3
+ type highlight_config_params =
4
+ {
5
+ fragment_by: Turbopuffer::Models::highlight_fragment_by,
6
+ fragment_limit: Integer,
7
+ include_offsets: Turbopuffer::Models::highlight_offset_units,
8
+ rank_fragments_by: top
9
+ }
10
+
11
+ class HighlightConfigParams < Turbopuffer::Internal::Type::BaseModel
12
+ attr_reader fragment_by: Turbopuffer::Models::highlight_fragment_by?
13
+
14
+ def fragment_by=: (
15
+ Turbopuffer::Models::highlight_fragment_by
16
+ ) -> Turbopuffer::Models::highlight_fragment_by
17
+
18
+ attr_reader fragment_limit: Integer?
19
+
20
+ def fragment_limit=: (Integer) -> Integer
21
+
22
+ attr_reader include_offsets: Turbopuffer::Models::highlight_offset_units?
23
+
24
+ def include_offsets=: (
25
+ Turbopuffer::Models::highlight_offset_units
26
+ ) -> Turbopuffer::Models::highlight_offset_units
27
+
28
+ attr_reader rank_fragments_by: top?
29
+
30
+ def rank_fragments_by=: (top) -> top
31
+
32
+ def initialize: (
33
+ ?fragment_by: Turbopuffer::Models::highlight_fragment_by,
34
+ ?fragment_limit: Integer,
35
+ ?include_offsets: Turbopuffer::Models::highlight_offset_units,
36
+ ?rank_fragments_by: top
37
+ ) -> void
38
+
39
+ def to_hash: -> {
40
+ fragment_by: Turbopuffer::Models::highlight_fragment_by,
41
+ fragment_limit: Integer,
42
+ include_offsets: Turbopuffer::Models::highlight_offset_units,
43
+ rank_fragments_by: top
44
+ }
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,23 @@
1
+ module Turbopuffer
2
+ module Models
3
+ type highlight_fragment_by = :none | :sentence | :paragraph | :word
4
+
5
+ module HighlightFragmentBy
6
+ extend Turbopuffer::Internal::Type::Enum
7
+
8
+ # Treat the whole attribute as a single fragment.
9
+ NONE: :none
10
+
11
+ # Split the attribute into sentences. This is the default.
12
+ SENTENCE: :sentence
13
+
14
+ # Split the attribute into paragraphs.
15
+ PARAGRAPH: :paragraph
16
+
17
+ # Split the attribute into individual words.
18
+ WORD: :word
19
+
20
+ def self?.values: -> ::Array[Turbopuffer::Models::highlight_fragment_by]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ module Turbopuffer
2
+ module Models
3
+ type highlight_offset_units = :"utf-8" | :"utf-16" | :codepoints
4
+
5
+ module HighlightOffsetUnits
6
+ extend Turbopuffer::Internal::Type::Enum
7
+
8
+ UTF_8: :"utf-8"
9
+ UTF_16: :"utf-16"
10
+ CODEPOINTS: :codepoints
11
+
12
+ def self?.values: -> ::Array[Turbopuffer::Models::highlight_offset_units]
13
+ end
14
+ end
15
+ end
@@ -4,6 +4,7 @@ module Turbopuffer
4
4
  {
5
5
  namespace: String,
6
6
  aggregate_by: ::Hash[Symbol, top],
7
+ compute_attributes: ::Hash[Symbol, top],
7
8
  consistency: Turbopuffer::NamespaceExplainQueryParams::Consistency,
8
9
  distance_metric: Turbopuffer::Models::distance_metric,
9
10
  exclude_attributes: ::Array[String],
@@ -29,6 +30,10 @@ module Turbopuffer
29
30
 
30
31
  def aggregate_by=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top]
31
32
 
33
+ attr_reader compute_attributes: ::Hash[Symbol, top]?
34
+
35
+ def compute_attributes=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top]
36
+
32
37
  attr_reader consistency: Turbopuffer::NamespaceExplainQueryParams::Consistency?
33
38
 
34
39
  def consistency=: (
@@ -82,6 +87,7 @@ module Turbopuffer
82
87
  def initialize: (
83
88
  ?namespace: String,
84
89
  ?aggregate_by: ::Hash[Symbol, top],
90
+ ?compute_attributes: ::Hash[Symbol, top],
85
91
  ?consistency: Turbopuffer::NamespaceExplainQueryParams::Consistency,
86
92
  ?distance_metric: Turbopuffer::Models::distance_metric,
87
93
  ?exclude_attributes: ::Array[String],
@@ -98,6 +104,7 @@ module Turbopuffer
98
104
  def to_hash: -> {
99
105
  namespace: String,
100
106
  aggregate_by: ::Hash[Symbol, top],
107
+ compute_attributes: ::Hash[Symbol, top],
101
108
  consistency: Turbopuffer::NamespaceExplainQueryParams::Consistency,
102
109
  distance_metric: Turbopuffer::Models::distance_metric,
103
110
  exclude_attributes: ::Array[String],
@@ -9,7 +9,8 @@ module Turbopuffer
9
9
  index: Turbopuffer::Models::NamespaceMetadata::index,
10
10
  schema: ::Hash[Symbol, Turbopuffer::AttributeSchemaConfig],
11
11
  updated_at: Time,
12
- pinning: Turbopuffer::NamespaceMetadata::Pinning
12
+ pinning: Turbopuffer::NamespaceMetadata::Pinning,
13
+ sharding: Turbopuffer::ShardingConfig
13
14
  }
14
15
 
15
16
  class NamespaceMetadata < Turbopuffer::Internal::Type::BaseModel
@@ -33,6 +34,12 @@ module Turbopuffer
33
34
  Turbopuffer::NamespaceMetadata::Pinning
34
35
  ) -> Turbopuffer::NamespaceMetadata::Pinning
35
36
 
37
+ attr_reader sharding: Turbopuffer::ShardingConfig?
38
+
39
+ def sharding=: (
40
+ Turbopuffer::ShardingConfig
41
+ ) -> Turbopuffer::ShardingConfig
42
+
36
43
  def initialize: (
37
44
  approx_logical_bytes: Integer,
38
45
  approx_row_count: Integer,
@@ -41,7 +48,8 @@ module Turbopuffer
41
48
  index: Turbopuffer::Models::NamespaceMetadata::index,
42
49
  schema: ::Hash[Symbol, Turbopuffer::AttributeSchemaConfig],
43
50
  updated_at: Time,
44
- ?pinning: Turbopuffer::NamespaceMetadata::Pinning
51
+ ?pinning: Turbopuffer::NamespaceMetadata::Pinning,
52
+ ?sharding: Turbopuffer::ShardingConfig
45
53
  ) -> void
46
54
 
47
55
  def to_hash: -> {
@@ -52,7 +60,8 @@ module Turbopuffer
52
60
  index: Turbopuffer::Models::NamespaceMetadata::index,
53
61
  schema: ::Hash[Symbol, Turbopuffer::AttributeSchemaConfig],
54
62
  updated_at: Time,
55
- pinning: Turbopuffer::NamespaceMetadata::Pinning
63
+ pinning: Turbopuffer::NamespaceMetadata::Pinning,
64
+ sharding: Turbopuffer::ShardingConfig
56
65
  }
57
66
 
58
67
  type index =
@@ -57,6 +57,7 @@ module Turbopuffer
57
57
  type query =
58
58
  {
59
59
  aggregate_by: ::Hash[Symbol, top],
60
+ compute_attributes: ::Hash[Symbol, top],
60
61
  distance_metric: Turbopuffer::Models::distance_metric,
61
62
  exclude_attributes: ::Array[String],
62
63
  filters: top,
@@ -72,6 +73,10 @@ module Turbopuffer
72
73
 
73
74
  def aggregate_by=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top]
74
75
 
76
+ attr_reader compute_attributes: ::Hash[Symbol, top]?
77
+
78
+ def compute_attributes=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top]
79
+
75
80
  attr_reader distance_metric: Turbopuffer::Models::distance_metric?
76
81
 
77
82
  def distance_metric=: (
@@ -112,6 +117,7 @@ module Turbopuffer
112
117
 
113
118
  def initialize: (
114
119
  ?aggregate_by: ::Hash[Symbol, top],
120
+ ?compute_attributes: ::Hash[Symbol, top],
115
121
  ?distance_metric: Turbopuffer::Models::distance_metric,
116
122
  ?exclude_attributes: ::Array[String],
117
123
  ?filters: top,
@@ -124,6 +130,7 @@ module Turbopuffer
124
130
 
125
131
  def to_hash: -> {
126
132
  aggregate_by: ::Hash[Symbol, top],
133
+ compute_attributes: ::Hash[Symbol, top],
127
134
  distance_metric: Turbopuffer::Models::distance_metric,
128
135
  exclude_attributes: ::Array[String],
129
136
  filters: top,