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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3a51779391cbefbadc2c92d4da69e9f2b8a16db31b09626fc610d979f8317af
4
- data.tar.gz: f814addde33fea46dfea6c616ab8f71c34a4813a7f53283bdd3b04765ea9f91b
3
+ metadata.gz: 261de656879e46b1d9f2261ccd91ff7ea9e266d8a86607c5395ad55f38733dcf
4
+ data.tar.gz: f747583237835002c070734cd7a3955c9476df205d5815e3fcf04ee10e9a8a76
5
5
  SHA512:
6
- metadata.gz: 66b621f09d12e2ae0540a69f163c596063b59c3a4df34416cd9c48330f167065af3ee4e1292d1d954adcfc7796b1d1a46fd023b50681f286d81e1984535e5880
7
- data.tar.gz: 9b77397676c00954fd6ee3bad008eeedf6af798d41718d636841b9e12c35ab98caa434acaee6f157e006d9d08aa6491df57943ebfe8fa846fbcc131102a8d957
6
+ metadata.gz: 9bc98d5c9e8d49f32361220486d44837ae507de3693b375b40d8ba6a668c9897efdeb60372d93da15a10493ca7a3b999c0962e7809ccd42514ec4c52230e96c8
7
+ data.tar.gz: 022a2361e31a953a68d1867c5cc67ce571556e126ad873267ef2beb28ccf0e81438681570c86955134514a574c6812c374036b61fd5b0c88d8e642e62eb33c88
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.0 (2026-07-30)
4
+
5
+ Full Changelog: [v2.3.0...v2.4.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v2.3.0...v2.4.0)
6
+
7
+ ### Features
8
+
9
+ * openapi: add RRF `weights` parameter ([621628b](https://github.com/turbopuffer/turbopuffer-ruby/commit/621628bc8d9ed54a0ab5006c20ba5f4ae03e966e))
10
+ * spec: add sharding config to the openapi spec ([2228a03](https://github.com/turbopuffer/turbopuffer-ruby/commit/2228a031201ad1b3d20ae1c77d029d665c67e428))
11
+ * spec: expose computed attributes ([597fdde](https://github.com/turbopuffer/turbopuffer-ruby/commit/597fdde888efd50b9873b056ab0c12fab5a9e600))
12
+ * spec: hide HighlightConfig.rank_fragments_by's RankBy ref from Stainless ([59c2734](https://github.com/turbopuffer/turbopuffer-ruby/commit/59c273482fcfccce1fc8f4d8b8d3ae13c0fbbcdc))
13
+ * spec: make compute_attributes value x-stainless-any ([c170466](https://github.com/turbopuffer/turbopuffer-ruby/commit/c17046653f2533e00e9129d4e807a5ab2c3b1cd6))
14
+ * spec: rename HighlightConfig -> HighlightConfigParams ([36413c3](https://github.com/turbopuffer/turbopuffer-ruby/commit/36413c3bebab413e60ab51ba728437e66edaa7ab))
15
+ * **stlc:** configurable CI runner and private-production-repo support in workflow templates ([12b486b](https://github.com/turbopuffer/turbopuffer-ruby/commit/12b486b953bf4521f18eb1187ba20812d30b3cfd))
16
+ * support late_interaction parameter in sdks ([ac90617](https://github.com/turbopuffer/turbopuffer-ruby/commit/ac9061734ae8f47e823c20f381bf925c27634d8e))
17
+
18
+
19
+ ### Chores
20
+
21
+ * **internal:** bound formatter parallelism to CPU count ([a56e5af](https://github.com/turbopuffer/turbopuffer-ruby/commit/a56e5af20b69bd39b12fbf2e9db2cd6d9b1b1ee8))
22
+ * remove unused MCP package ([2b81b9a](https://github.com/turbopuffer/turbopuffer-ruby/commit/2b81b9ae116370e14cf1213e056b147277e6cca3))
23
+
3
24
  ## 2.3.0 (2026-06-16)
4
25
 
5
26
  Full Changelog: [v2.2.0...v2.3.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v2.2.0...v2.3.0)
data/README.md CHANGED
@@ -6,7 +6,7 @@ It is generated with [Stainless](https://www.stainless.com/).
6
6
 
7
7
  ## MCP Server
8
8
 
9
- Use the turbopuffer MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
9
+ Use the Turbopuffer MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
10
10
 
11
11
  [![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40turbopuffer%2Fturbopuffer-mcp&config=eyJuYW1lIjoiQHR1cmJvcHVmZmVyL3R1cmJvcHVmZmVyLW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL3R1cmJvcHVmZmVyLnN0bG1jcC5jb20iLCJoZWFkZXJzIjp7IngtdHVyYm9wdWZmZXItYXBpLWtleSI6InRwdWZfQTEuLi4ifX0)
12
12
  [![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40turbopuffer%2Fturbopuffer-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fturbopuffer.stlmcp.com%22%2C%22headers%22%3A%7B%22x-turbopuffer-api-key%22%3A%22tpuf_A1...%22%7D%7D)
@@ -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", "~> 2.3.0"
29
+ gem "turbopuffer", "~> 2.4.0"
30
30
  ```
31
31
 
32
32
  <!-- x-release-please-end -->
@@ -108,10 +108,23 @@ module Turbopuffer
108
108
  # @return [Symbol, Turbopuffer::Models::DistanceMetric, nil]
109
109
  optional :distance_metric, enum: -> { Turbopuffer::DistanceMetric }
110
110
 
111
- # @!method initialize(distance_metric: nil)
111
+ # @!attribute late_interaction
112
+ # Opt in to late-interaction (MUVERA) indexing. Only valid on fixed-dim `[][N]f32`
113
+ # vector array attributes, and is required to enable an ANN index on such
114
+ # attributes. Defaults to `false`.
115
+ #
116
+ # @return [Boolean, nil]
117
+ optional :late_interaction, Turbopuffer::Internal::Type::Boolean
118
+
119
+ # @!method initialize(distance_metric: nil, late_interaction: nil)
120
+ # Some parameter documentations has been truncated, see
121
+ # {Turbopuffer::Models::AttributeSchemaConfig::Ann::AnnConfig} for more details.
122
+ #
112
123
  # Configuration options for ANN (Approximate Nearest Neighbor) indexing.
113
124
  #
114
125
  # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
126
+ #
127
+ # @param late_interaction [Boolean] Opt in to late-interaction (MUVERA) indexing. Only valid on fixed-dim `[][N]f32`
115
128
  end
116
129
 
117
130
  # @!method self.variants
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class HighlightConfigParams < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute fragment_by
7
+ # How to split a text attribute into fragments for highlighting.
8
+ #
9
+ # @return [Symbol, Turbopuffer::Models::HighlightFragmentBy, nil]
10
+ optional :fragment_by, enum: -> { Turbopuffer::HighlightFragmentBy }
11
+
12
+ # @!attribute fragment_limit
13
+ # The maximum number of fragments to return. Defaults to `3`.
14
+ #
15
+ # @return [Integer, nil]
16
+ optional :fragment_limit, Integer
17
+
18
+ # @!attribute include_offsets
19
+ # The units to report highlighted fragment offsets in.
20
+ #
21
+ # @return [Symbol, Turbopuffer::Models::HighlightOffsetUnits, nil]
22
+ optional :include_offsets, enum: -> { Turbopuffer::HighlightOffsetUnits }
23
+
24
+ # @!attribute rank_fragments_by
25
+ # How to rank candidate fragments within the attribute before selecting the top
26
+ # `fragment_limit`. Defaults to the query's `rank_by`.
27
+ #
28
+ # @return [Object, nil]
29
+ optional :rank_fragments_by, Turbopuffer::Internal::Type::Unknown
30
+
31
+ # @!method initialize(fragment_by: nil, fragment_limit: nil, include_offsets: nil, rank_fragments_by: nil)
32
+ # Some parameter documentations has been truncated, see
33
+ # {Turbopuffer::Models::HighlightConfigParams} for more details.
34
+ #
35
+ # Additional (optional) parameters for the Highlight compute expression.
36
+ #
37
+ # @param fragment_by [Symbol, Turbopuffer::Models::HighlightFragmentBy] How to split a text attribute into fragments for highlighting.
38
+ #
39
+ # @param fragment_limit [Integer] The maximum number of fragments to return. Defaults to `3`.
40
+ #
41
+ # @param include_offsets [Symbol, Turbopuffer::Models::HighlightOffsetUnits] The units to report highlighted fragment offsets in.
42
+ #
43
+ # @param rank_fragments_by [Object] How to rank candidate fragments within the attribute before selecting the top `f
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
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
+ # Treat the whole attribute as a single fragment.
10
+ NONE = :none
11
+
12
+ # Split the attribute into sentences. This is the default.
13
+ SENTENCE = :sentence
14
+
15
+ # Split the attribute into paragraphs.
16
+ PARAGRAPH = :paragraph
17
+
18
+ # Split the attribute into individual words.
19
+ WORD = :word
20
+
21
+ # @!method self.values
22
+ # @return [Array<Symbol>]
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
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
+ UTF_8 = :"utf-8"
10
+ UTF_16 = :"utf-16"
11
+ CODEPOINTS = :codepoints
12
+
13
+ # @!method self.values
14
+ # @return [Array<Symbol>]
15
+ end
16
+ end
17
+ end
@@ -19,6 +19,14 @@ module Turbopuffer
19
19
  # @return [Hash{Symbol=>Object}, nil]
20
20
  optional :aggregate_by, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
21
21
 
22
+ # @!attribute compute_attributes
23
+ # Computes additional values on documents returned by a query. Each key is the
24
+ # name of the computed attribute; each value is an expression describing how to
25
+ # compute it.
26
+ #
27
+ # @return [Hash{Symbol=>Object}, nil]
28
+ optional :compute_attributes, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
29
+
22
30
  # @!attribute consistency
23
31
  # The consistency level for a query.
24
32
  #
@@ -82,7 +90,7 @@ module Turbopuffer
82
90
  # @return [Symbol, Turbopuffer::Models::VectorEncoding, nil]
83
91
  optional :vector_encoding, enum: -> { Turbopuffer::VectorEncoding }
84
92
 
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: {})
93
+ # @!method initialize(namespace: nil, aggregate_by: nil, compute_attributes: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, limit: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
86
94
  # Some parameter documentations has been truncated, see
87
95
  # {Turbopuffer::Models::NamespaceExplainQueryParams} for more details.
88
96
  #
@@ -90,6 +98,8 @@ module Turbopuffer
90
98
  #
91
99
  # @param aggregate_by [Hash{Symbol=>Object}] Aggregations to compute over all documents in the namespace that match the filte
92
100
  #
101
+ # @param compute_attributes [Hash{Symbol=>Object}] Computes additional values on documents returned by a query. Each key is the nam
102
+ #
93
103
  # @param consistency [Turbopuffer::Models::NamespaceExplainQueryParams::Consistency] The consistency level for a query.
94
104
  #
95
105
  # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
@@ -52,7 +52,16 @@ module Turbopuffer
52
52
  # @return [Turbopuffer::Models::NamespaceMetadata::Pinning, nil]
53
53
  optional :pinning, -> { Turbopuffer::NamespaceMetadata::Pinning }
54
54
 
55
- # @!method initialize(approx_logical_bytes:, approx_row_count:, created_at:, encryption:, index:, schema:, updated_at:, pinning: nil)
55
+ # @!attribute sharding
56
+ # Configuration for namespace sharding, which partitions a namespace's documents
57
+ # across multiple internal shards to scale indexing and query throughput beyond a
58
+ # single machine. Sharding can only be configured on a namespace's inaugural
59
+ # write, and cannot be added to or changed on an existing namespace.
60
+ #
61
+ # @return [Turbopuffer::Models::ShardingConfig, nil]
62
+ optional :sharding, -> { Turbopuffer::ShardingConfig }
63
+
64
+ # @!method initialize(approx_logical_bytes:, approx_row_count:, created_at:, encryption:, index:, schema:, updated_at:, pinning: nil, sharding: nil)
56
65
  # Some parameter documentations has been truncated, see
57
66
  # {Turbopuffer::Models::NamespaceMetadata} for more details.
58
67
  #
@@ -73,6 +82,8 @@ module Turbopuffer
73
82
  # @param updated_at [Time] The timestamp when the namespace was last modified by a write operation.
74
83
  #
75
84
  # @param pinning [Turbopuffer::Models::NamespaceMetadata::Pinning] Configuration for namespace pinning, along with the current status of the pinned
85
+ #
86
+ # @param sharding [Turbopuffer::Models::ShardingConfig] Configuration for namespace sharding, which partitions a namespace's documents a
76
87
 
77
88
  # @see Turbopuffer::Models::NamespaceMetadata#index
78
89
  module Index
@@ -57,6 +57,14 @@ module Turbopuffer
57
57
  # @return [Hash{Symbol=>Object}, nil]
58
58
  optional :aggregate_by, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
59
59
 
60
+ # @!attribute compute_attributes
61
+ # Computes additional values on documents returned by a query. Each key is the
62
+ # name of the computed attribute; each value is an expression describing how to
63
+ # compute it.
64
+ #
65
+ # @return [Hash{Symbol=>Object}, nil]
66
+ optional :compute_attributes, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
67
+
60
68
  # @!attribute distance_metric
61
69
  # A function used to calculate vector similarity.
62
70
  #
@@ -108,7 +116,7 @@ module Turbopuffer
108
116
  # @return [Integer, nil]
109
117
  optional :top_k, Integer
110
118
 
111
- # @!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)
119
+ # @!method initialize(aggregate_by: nil, compute_attributes: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, limit: nil, rank_by: nil, top_k: nil)
112
120
  # Some parameter documentations has been truncated, see
113
121
  # {Turbopuffer::Models::NamespaceMultiQueryParams::Query} for more details.
114
122
  #
@@ -116,6 +124,8 @@ module Turbopuffer
116
124
  #
117
125
  # @param aggregate_by [Hash{Symbol=>Object}] Aggregations to compute over all documents in the namespace that match the filte
118
126
  #
127
+ # @param compute_attributes [Hash{Symbol=>Object}] Computes additional values on documents returned by a query. Each key is the nam
128
+ #
119
129
  # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
120
130
  #
121
131
  # @param exclude_attributes [Array<String>] List of attribute names to exclude from the response. All other attributes will
@@ -19,6 +19,14 @@ module Turbopuffer
19
19
  # @return [Hash{Symbol=>Object}, nil]
20
20
  optional :aggregate_by, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
21
21
 
22
+ # @!attribute compute_attributes
23
+ # Computes additional values on documents returned by a query. Each key is the
24
+ # name of the computed attribute; each value is an expression describing how to
25
+ # compute it.
26
+ #
27
+ # @return [Hash{Symbol=>Object}, nil]
28
+ optional :compute_attributes, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
29
+
22
30
  # @!attribute consistency
23
31
  # The consistency level for a query.
24
32
  #
@@ -82,7 +90,7 @@ module Turbopuffer
82
90
  # @return [Symbol, Turbopuffer::Models::VectorEncoding, nil]
83
91
  optional :vector_encoding, enum: -> { Turbopuffer::VectorEncoding }
84
92
 
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: {})
93
+ # @!method initialize(namespace: nil, aggregate_by: nil, compute_attributes: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, limit: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
86
94
  # Some parameter documentations has been truncated, see
87
95
  # {Turbopuffer::Models::NamespaceQueryParams} for more details.
88
96
  #
@@ -90,6 +98,8 @@ module Turbopuffer
90
98
  #
91
99
  # @param aggregate_by [Hash{Symbol=>Object}] Aggregations to compute over all documents in the namespace that match the filte
92
100
  #
101
+ # @param compute_attributes [Hash{Symbol=>Object}] Computes additional values on documents returned by a query. Each key is the nam
102
+ #
93
103
  # @param consistency [Turbopuffer::Models::NamespaceQueryParams::Consistency] The consistency level for a query.
94
104
  #
95
105
  # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
@@ -111,6 +111,15 @@ module Turbopuffer
111
111
  # @return [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig}, nil]
112
112
  optional :schema, -> { Turbopuffer::Internal::Type::HashOf[union: Turbopuffer::AttributeSchema] }
113
113
 
114
+ # @!attribute sharding
115
+ # Configuration for namespace sharding, which partitions a namespace's documents
116
+ # across multiple internal shards to scale indexing and query throughput beyond a
117
+ # single machine. Sharding can only be configured on a namespace's inaugural
118
+ # write, and cannot be added to or changed on an existing namespace.
119
+ #
120
+ # @return [Turbopuffer::Models::ShardingConfig, nil]
121
+ optional :sharding, -> { Turbopuffer::ShardingConfig }
122
+
114
123
  # @!attribute upsert_columns
115
124
  # A list of documents in columnar format. Each key is a column name, mapped to an
116
125
  # array of values for that column.
@@ -130,7 +139,7 @@ module Turbopuffer
130
139
  # @return [Array<Turbopuffer::Models::Row>, nil]
131
140
  optional :upsert_rows, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
132
141
 
133
- # @!method initialize(namespace: nil, branch_from_namespace: nil, copy_from_namespace: nil, delete_by_filter: nil, delete_by_filter_allow_partial: nil, delete_condition: nil, deletes: nil, disable_backpressure: nil, distance_metric: nil, encryption: nil, patch_by_filter: nil, patch_by_filter_allow_partial: nil, patch_columns: nil, patch_condition: nil, patch_rows: nil, return_affected_ids: nil, schema: nil, upsert_columns: nil, upsert_condition: nil, upsert_rows: nil, request_options: {})
142
+ # @!method initialize(namespace: nil, branch_from_namespace: nil, copy_from_namespace: nil, delete_by_filter: nil, delete_by_filter_allow_partial: nil, delete_condition: nil, deletes: nil, disable_backpressure: nil, distance_metric: nil, encryption: nil, patch_by_filter: nil, patch_by_filter_allow_partial: nil, patch_columns: nil, patch_condition: nil, patch_rows: nil, return_affected_ids: nil, schema: nil, sharding: nil, upsert_columns: nil, upsert_condition: nil, upsert_rows: nil, request_options: {})
134
143
  # Some parameter documentations has been truncated, see
135
144
  # {Turbopuffer::Models::NamespaceWriteParams} for more details.
136
145
  #
@@ -168,6 +177,8 @@ module Turbopuffer
168
177
  #
169
178
  # @param schema [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig}] The schema of the attributes attached to the documents.
170
179
  #
180
+ # @param sharding [Turbopuffer::Models::ShardingConfig] Configuration for namespace sharding, which partitions a namespace's documents a
181
+ #
171
182
  # @param upsert_columns [Turbopuffer::Models::Columns] A list of documents in columnar format. Each key is a column name, mapped to an
172
183
  #
173
184
  # @param upsert_condition [Object] A condition evaluated against the current value of each document targeted by an
@@ -9,10 +9,23 @@ module Turbopuffer
9
9
  # @return [Integer, nil]
10
10
  optional :rank_constant, Integer
11
11
 
12
- # @!method initialize(rank_constant: nil)
12
+ # @!attribute weights
13
+ # A positive weight for each subquery, in the same order as `queries`. The number
14
+ # of weights must match the number of subqueries. When omitted, every subquery has
15
+ # a weight of `1`.
16
+ #
17
+ # @return [Array<Float>, nil]
18
+ optional :weights, Turbopuffer::Internal::Type::ArrayOf[Float]
19
+
20
+ # @!method initialize(rank_constant: nil, weights: nil)
21
+ # Some parameter documentations has been truncated, see
22
+ # {Turbopuffer::Models::RrfParams} for more details.
23
+ #
13
24
  # Configuration options for RRF.
14
25
  #
15
26
  # @param rank_constant [Integer] RRF rank constant (`k`). Must be greater than zero. Defaults to `60`.
27
+ #
28
+ # @param weights [Array<Float>] A positive weight for each subquery, in the same order as `queries`. The number
16
29
  end
17
30
  end
18
31
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class ShardingConfig < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute num_shards
7
+ # The number of shards to partition the namespace into.
8
+ #
9
+ # @return [Integer]
10
+ required :num_shards, Integer
11
+
12
+ # @!method initialize(num_shards:)
13
+ # Configuration for namespace sharding, which partitions a namespace's documents
14
+ # across multiple internal shards to scale indexing and query throughput beyond a
15
+ # single machine. Sharding can only be configured on a namespace's inaugural
16
+ # write, and cannot be added to or changed on an existing namespace.
17
+ #
18
+ # @param num_shards [Integer] The number of shards to partition the namespace into.
19
+ end
20
+ end
21
+ end
@@ -82,6 +82,12 @@ module Turbopuffer
82
82
 
83
83
  FuzzyParams = Turbopuffer::Models::FuzzyParams
84
84
 
85
+ HighlightConfigParams = Turbopuffer::Models::HighlightConfigParams
86
+
87
+ HighlightFragmentBy = Turbopuffer::Models::HighlightFragmentBy
88
+
89
+ HighlightOffsetUnits = Turbopuffer::Models::HighlightOffsetUnits
90
+
85
91
  ID = Turbopuffer::Models::ID
86
92
 
87
93
  IncludeAttributes = Turbopuffer::Models::IncludeAttributes
@@ -134,6 +140,8 @@ module Turbopuffer
134
140
 
135
141
  SaturateParams = Turbopuffer::Models::SaturateParams
136
142
 
143
+ ShardingConfig = Turbopuffer::Models::ShardingConfig
144
+
137
145
  SparseDistanceMetric = Turbopuffer::Models::SparseDistanceMetric
138
146
 
139
147
  Tokenizer = Turbopuffer::Models::Tokenizer
@@ -98,12 +98,14 @@ module Turbopuffer
98
98
  #
99
99
  # Explain a query plan.
100
100
  #
101
- # @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: {})
101
+ # @overload explain_query(namespace: nil, aggregate_by: nil, compute_attributes: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, limit: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
102
102
  #
103
103
  # @param namespace [String] Path param: The name of the namespace.
104
104
  #
105
105
  # @param aggregate_by [Hash{Symbol=>Object}] Body param: Aggregations to compute over all documents in the namespace that mat
106
106
  #
107
+ # @param compute_attributes [Hash{Symbol=>Object}] Body param: Computes additional values on documents returned by a query. Each ke
108
+ #
107
109
  # @param consistency [Turbopuffer::Models::NamespaceExplainQueryParams::Consistency] Body param: The consistency level for a query.
108
110
  #
109
111
  # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] Body param: A function used to calculate vector similarity.
@@ -236,12 +238,14 @@ module Turbopuffer
236
238
  #
237
239
  # Query, filter, full-text search and vector search documents.
238
240
  #
239
- # @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: {})
241
+ # @overload query(namespace: nil, aggregate_by: nil, compute_attributes: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, limit: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
240
242
  #
241
243
  # @param namespace [String] Path param: The name of the namespace.
242
244
  #
243
245
  # @param aggregate_by [Hash{Symbol=>Object}] Body param: Aggregations to compute over all documents in the namespace that mat
244
246
  #
247
+ # @param compute_attributes [Hash{Symbol=>Object}] Body param: Computes additional values on documents returned by a query. Each ke
248
+ #
245
249
  # @param consistency [Turbopuffer::Models::NamespaceQueryParams::Consistency] Body param: The consistency level for a query.
246
250
  #
247
251
  # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] Body param: A function used to calculate vector similarity.
@@ -410,7 +414,7 @@ module Turbopuffer
410
414
  #
411
415
  # Create, update, or delete documents.
412
416
  #
413
- # @overload write(namespace: nil, branch_from_namespace: nil, copy_from_namespace: nil, delete_by_filter: nil, delete_by_filter_allow_partial: nil, delete_condition: nil, deletes: nil, disable_backpressure: nil, distance_metric: nil, encryption: nil, patch_by_filter: nil, patch_by_filter_allow_partial: nil, patch_columns: nil, patch_condition: nil, patch_rows: nil, return_affected_ids: nil, schema: nil, upsert_columns: nil, upsert_condition: nil, upsert_rows: nil, request_options: {})
417
+ # @overload write(namespace: nil, branch_from_namespace: nil, copy_from_namespace: nil, delete_by_filter: nil, delete_by_filter_allow_partial: nil, delete_condition: nil, deletes: nil, disable_backpressure: nil, distance_metric: nil, encryption: nil, patch_by_filter: nil, patch_by_filter_allow_partial: nil, patch_columns: nil, patch_condition: nil, patch_rows: nil, return_affected_ids: nil, schema: nil, sharding: nil, upsert_columns: nil, upsert_condition: nil, upsert_rows: nil, request_options: {})
414
418
  #
415
419
  # @param namespace [String] Path param: The name of the namespace.
416
420
  #
@@ -446,6 +450,8 @@ module Turbopuffer
446
450
  #
447
451
  # @param schema [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig}] Body param: The schema of the attributes attached to the documents.
448
452
  #
453
+ # @param sharding [Turbopuffer::Models::ShardingConfig] Body param: Configuration for namespace sharding, which partitions a namespace's
454
+ #
449
455
  # @param upsert_columns [Turbopuffer::Models::Columns] Body param: A list of documents in columnar format. Each key is a column name, m
450
456
  #
451
457
  # @param upsert_condition [Object] Body param: A condition evaluated against the current value of each document tar
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Turbopuffer
4
- VERSION = "2.3.0"
4
+ VERSION = "2.4.0"
5
5
  end
data/lib/turbopuffer.rb CHANGED
@@ -77,6 +77,9 @@ require_relative "turbopuffer/models/full_text_search"
77
77
  require_relative "turbopuffer/models/full_text_search_config"
78
78
  require_relative "turbopuffer/models/fuzzy_max_edit_distance"
79
79
  require_relative "turbopuffer/models/fuzzy_params"
80
+ require_relative "turbopuffer/models/highlight_config_params"
81
+ require_relative "turbopuffer/models/highlight_fragment_by"
82
+ require_relative "turbopuffer/models/highlight_offset_units"
80
83
  require_relative "turbopuffer/models/id"
81
84
  require_relative "turbopuffer/models/include_attributes"
82
85
  require_relative "turbopuffer/models/language"
@@ -112,6 +115,7 @@ require_relative "turbopuffer/models/query_performance"
112
115
  require_relative "turbopuffer/models/row"
113
116
  require_relative "turbopuffer/models/rrf_params"
114
117
  require_relative "turbopuffer/models/saturate_params"
118
+ require_relative "turbopuffer/models/sharding_config"
115
119
  require_relative "turbopuffer/models/sparse_distance_metric"
116
120
  require_relative "turbopuffer/models/tokenizer"
117
121
  require_relative "turbopuffer/models/vector"
@@ -210,21 +210,38 @@ module Turbopuffer
210
210
  end
211
211
  attr_writer :distance_metric
212
212
 
213
+ # Opt in to late-interaction (MUVERA) indexing. Only valid on fixed-dim `[][N]f32`
214
+ # vector array attributes, and is required to enable an ANN index on such
215
+ # attributes. Defaults to `false`.
216
+ sig { returns(T.nilable(T::Boolean)) }
217
+ attr_reader :late_interaction
218
+
219
+ sig { params(late_interaction: T::Boolean).void }
220
+ attr_writer :late_interaction
221
+
213
222
  # Configuration options for ANN (Approximate Nearest Neighbor) indexing.
214
223
  sig do
215
224
  params(
216
- distance_metric: Turbopuffer::DistanceMetric::OrSymbol
225
+ distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
226
+ late_interaction: T::Boolean
217
227
  ).returns(T.attached_class)
218
228
  end
219
229
  def self.new(
220
230
  # A function used to calculate vector similarity.
221
- distance_metric: nil
231
+ distance_metric: nil,
232
+ # Opt in to late-interaction (MUVERA) indexing. Only valid on fixed-dim `[][N]f32`
233
+ # vector array attributes, and is required to enable an ANN index on such
234
+ # attributes. Defaults to `false`.
235
+ late_interaction: nil
222
236
  )
223
237
  end
224
238
 
225
239
  sig do
226
240
  override.returns(
227
- { distance_metric: Turbopuffer::DistanceMetric::OrSymbol }
241
+ {
242
+ distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
243
+ late_interaction: T::Boolean
244
+ }
228
245
  )
229
246
  end
230
247
  def to_hash
@@ -0,0 +1,85 @@
1
+ # typed: strong
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class HighlightConfigParams < Turbopuffer::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Turbopuffer::HighlightConfigParams,
10
+ Turbopuffer::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # How to split a text attribute into fragments for highlighting.
15
+ sig { returns(T.nilable(Turbopuffer::HighlightFragmentBy::OrSymbol)) }
16
+ attr_reader :fragment_by
17
+
18
+ sig do
19
+ params(fragment_by: Turbopuffer::HighlightFragmentBy::OrSymbol).void
20
+ end
21
+ attr_writer :fragment_by
22
+
23
+ # The maximum number of fragments to return. Defaults to `3`.
24
+ sig { returns(T.nilable(Integer)) }
25
+ attr_reader :fragment_limit
26
+
27
+ sig { params(fragment_limit: Integer).void }
28
+ attr_writer :fragment_limit
29
+
30
+ # The units to report highlighted fragment offsets in.
31
+ sig { returns(T.nilable(Turbopuffer::HighlightOffsetUnits::OrSymbol)) }
32
+ attr_reader :include_offsets
33
+
34
+ sig do
35
+ params(
36
+ include_offsets: Turbopuffer::HighlightOffsetUnits::OrSymbol
37
+ ).void
38
+ end
39
+ attr_writer :include_offsets
40
+
41
+ # How to rank candidate fragments within the attribute before selecting the top
42
+ # `fragment_limit`. Defaults to the query's `rank_by`.
43
+ sig { returns(T.nilable(T.anything)) }
44
+ attr_reader :rank_fragments_by
45
+
46
+ sig { params(rank_fragments_by: T.anything).void }
47
+ attr_writer :rank_fragments_by
48
+
49
+ # Additional (optional) parameters for the Highlight compute expression.
50
+ sig do
51
+ params(
52
+ fragment_by: Turbopuffer::HighlightFragmentBy::OrSymbol,
53
+ fragment_limit: Integer,
54
+ include_offsets: Turbopuffer::HighlightOffsetUnits::OrSymbol,
55
+ rank_fragments_by: T.anything
56
+ ).returns(T.attached_class)
57
+ end
58
+ def self.new(
59
+ # How to split a text attribute into fragments for highlighting.
60
+ fragment_by: nil,
61
+ # The maximum number of fragments to return. Defaults to `3`.
62
+ fragment_limit: nil,
63
+ # The units to report highlighted fragment offsets in.
64
+ include_offsets: nil,
65
+ # How to rank candidate fragments within the attribute before selecting the top
66
+ # `fragment_limit`. Defaults to the query's `rank_by`.
67
+ rank_fragments_by: nil
68
+ )
69
+ end
70
+
71
+ sig do
72
+ override.returns(
73
+ {
74
+ fragment_by: Turbopuffer::HighlightFragmentBy::OrSymbol,
75
+ fragment_limit: Integer,
76
+ include_offsets: Turbopuffer::HighlightOffsetUnits::OrSymbol,
77
+ rank_fragments_by: T.anything
78
+ }
79
+ )
80
+ end
81
+ def to_hash
82
+ end
83
+ end
84
+ end
85
+ end