turbopuffer-ruby 1.0.0 → 1.1.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: f091337e35dc13f829362b2d79249003d373c724182a54308c55de04426a6a2d
4
- data.tar.gz: 4a33c71ad3fdd780338375025da14a883cacd8e1ea7fda64f690ec048afb4f34
3
+ metadata.gz: bf1a733400e137460404c91f94f07f33c3c1689e55314cf47b50a49f77833162
4
+ data.tar.gz: c40716bf64042af849af0a447978ee30dbff168889a20fbcae73a02848d14b8b
5
5
  SHA512:
6
- metadata.gz: fa9bb25c3a0b1f3b4ed39575e580a47211f7c90705af28d8984144ece785bac8d5150aa791a3510cc0adf5446dcec304d8d006142260bec315f4c4ac6e4ecd00
7
- data.tar.gz: 2f84f94bc744e59b5240e927df17ae45395747b4867e6564cf4dd8ec520079b07b4db36555889a1a619dfc962231e265c5aff6f6065346d4a7bf29d6830422b7
6
+ metadata.gz: a346946a966199348fd7db43d4524180db76654ae9f034f711b4585dde67f2da7182d25ae5006f963df0e52cf4b4bf157b43044dd2e35e0e598c04e4bb665e19
7
+ data.tar.gz: 6cd084d22d120d8ee095441d1fe8ec21bf0bed3d4c52131b7d1ef4be000f0cc6b10e4584bc93753872b41fbccef18136cd9412641c8f54b38a3ef1abc37e57fa
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0 (2025-09-11)
4
+
5
+ Full Changelog: [v1.0.0...v1.1.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v1.0.0...v1.1.0)
6
+
7
+ ### Features
8
+
9
+ * spec: add dedicated type for AggregationGroup response ([e30bb79](https://github.com/turbopuffer/turbopuffer-ruby/commit/e30bb796ff91b36d3f9424674470eb84feeaad63))
10
+ * tpuf: add include_ground_truth option to recall endpoint ([9d535c4](https://github.com/turbopuffer/turbopuffer-ruby/commit/9d535c44ce64f47a312a693d009506d635230322))
11
+
3
12
  ## 1.0.0 (2025-08-28)
4
13
 
5
14
  Full Changelog: [v0.2.6...v1.0.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.2.6...v1.0.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "turbopuffer-ruby", "~> 1.0.0"
20
+ gem "turbopuffer-ruby", "~> 1.1.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @type [Turbopuffer::Internal::Type::Converter]
6
+ AggregationGroup = Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
7
+ end
8
+ end
@@ -34,8 +34,9 @@ module Turbopuffer
34
34
  class Result < Turbopuffer::Internal::Type::BaseModel
35
35
  # @!attribute aggregation_groups
36
36
  #
37
- # @return [Array<Turbopuffer::Models::Row>, nil]
38
- optional :aggregation_groups, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
37
+ # @return [Array<Hash{Symbol=>Object}>, nil]
38
+ optional :aggregation_groups,
39
+ Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]]
39
40
 
40
41
  # @!attribute aggregations
41
42
  #
@@ -48,7 +49,7 @@ module Turbopuffer
48
49
  optional :rows, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
49
50
 
50
51
  # @!method initialize(aggregation_groups: nil, aggregations: nil, rows: nil)
51
- # @param aggregation_groups [Array<Turbopuffer::Models::Row>]
52
+ # @param aggregation_groups [Array<Hash{Symbol=>Object}>]
52
53
  # @param aggregations [Hash{Symbol=>Object}]
53
54
  # @param rows [Array<Turbopuffer::Models::Row>]
54
55
  end
@@ -18,8 +18,9 @@ module Turbopuffer
18
18
 
19
19
  # @!attribute aggregation_groups
20
20
  #
21
- # @return [Array<Turbopuffer::Models::Row>, nil]
22
- optional :aggregation_groups, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
21
+ # @return [Array<Hash{Symbol=>Object}>, nil]
22
+ optional :aggregation_groups,
23
+ Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]]
23
24
 
24
25
  # @!attribute aggregations
25
26
  #
@@ -38,7 +39,7 @@ module Turbopuffer
38
39
  #
39
40
  # @param performance [Turbopuffer::Models::QueryPerformance] The performance information for a query.
40
41
  #
41
- # @param aggregation_groups [Array<Turbopuffer::Models::Row>]
42
+ # @param aggregation_groups [Array<Hash{Symbol=>Object}>]
42
43
  #
43
44
  # @param aggregations [Hash{Symbol=>Object}]
44
45
  #
@@ -18,6 +18,13 @@ module Turbopuffer
18
18
  # @return [Object, nil]
19
19
  optional :filters, Turbopuffer::Internal::Type::Unknown
20
20
 
21
+ # @!attribute include_ground_truth
22
+ # Include ground truth data (query vectors and true nearest neighbors) in the
23
+ # response.
24
+ #
25
+ # @return [Boolean, nil]
26
+ optional :include_ground_truth, Turbopuffer::Internal::Type::Boolean
27
+
21
28
  # @!attribute num
22
29
  # The number of searches to run.
23
30
  #
@@ -37,7 +44,7 @@ module Turbopuffer
37
44
  # @return [Integer, nil]
38
45
  optional :top_k, Integer
39
46
 
40
- # @!method initialize(namespace: nil, filters: nil, num: nil, queries: nil, top_k: nil, request_options: {})
47
+ # @!method initialize(namespace: nil, filters: nil, include_ground_truth: nil, num: nil, queries: nil, top_k: nil, request_options: {})
41
48
  # Some parameter documentations has been truncated, see
42
49
  # {Turbopuffer::Models::NamespaceRecallParams} for more details.
43
50
  #
@@ -45,6 +52,8 @@ module Turbopuffer
45
52
  #
46
53
  # @param filters [Object] Filter by attributes. Same syntax as the query endpoint.
47
54
  #
55
+ # @param include_ground_truth [Boolean] Include ground truth data (query vectors and true nearest neighbors) in the resp
56
+ #
48
57
  # @param num [Integer] The number of searches to run.
49
58
  #
50
59
  # @param queries [Array<Float>] Use specific query vectors for the measurement. If omitted, sampled from the ind
@@ -23,7 +23,15 @@ module Turbopuffer
23
23
  # @return [Float]
24
24
  required :avg_recall, Float
25
25
 
26
- # @!method initialize(avg_ann_count:, avg_exhaustive_count:, avg_recall:)
26
+ # @!attribute ground_truth
27
+ # Ground truth data including query vectors and true nearest neighbors. Only
28
+ # included when include_ground_truth is true.
29
+ #
30
+ # @return [Array<Turbopuffer::Models::NamespaceRecallResponse::GroundTruth>, nil]
31
+ optional :ground_truth,
32
+ -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Models::NamespaceRecallResponse::GroundTruth] }
33
+
34
+ # @!method initialize(avg_ann_count:, avg_exhaustive_count:, avg_recall:, ground_truth: nil)
27
35
  # Some parameter documentations has been truncated, see
28
36
  # {Turbopuffer::Models::NamespaceRecallResponse} for more details.
29
37
  #
@@ -34,6 +42,27 @@ module Turbopuffer
34
42
  # @param avg_exhaustive_count [Float] The average number of documents retrieved by the exhaustive searches.
35
43
  #
36
44
  # @param avg_recall [Float] The average recall of the queries.
45
+ #
46
+ # @param ground_truth [Array<Turbopuffer::Models::NamespaceRecallResponse::GroundTruth>] Ground truth data including query vectors and true nearest neighbors. Only inclu
47
+
48
+ class GroundTruth < Turbopuffer::Internal::Type::BaseModel
49
+ # @!attribute nearest_neighbors
50
+ # The true nearest neighbors with their distances and vectors.
51
+ #
52
+ # @return [Array<Turbopuffer::Models::Row>]
53
+ required :nearest_neighbors, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
54
+
55
+ # @!attribute query_vector
56
+ # The query vector used for this search.
57
+ #
58
+ # @return [Array<Float>]
59
+ required :query_vector, Turbopuffer::Internal::Type::ArrayOf[Float]
60
+
61
+ # @!method initialize(nearest_neighbors:, query_vector:)
62
+ # @param nearest_neighbors [Array<Turbopuffer::Models::Row>] The true nearest neighbors with their distances and vectors.
63
+ #
64
+ # @param query_vector [Array<Float>] The query vector used for this search.
65
+ end
37
66
  end
38
67
  end
39
68
  end
@@ -39,6 +39,9 @@ module Turbopuffer
39
39
  mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
40
40
  end
41
41
 
42
+ # @type [Turbopuffer::Internal::Type::Converter]
43
+ AggregationGroup = Turbopuffer::Models::AggregationGroup
44
+
42
45
  AttributeSchema = Turbopuffer::Models::AttributeSchema
43
46
 
44
47
  AttributeSchemaConfig = Turbopuffer::Models::AttributeSchemaConfig
@@ -213,12 +213,14 @@ module Turbopuffer
213
213
  #
214
214
  # Evaluate recall.
215
215
  #
216
- # @overload recall(namespace: nil, filters: nil, num: nil, queries: nil, top_k: nil, request_options: {})
216
+ # @overload recall(namespace: nil, filters: nil, include_ground_truth: nil, num: nil, queries: nil, top_k: nil, request_options: {})
217
217
  #
218
218
  # @param namespace [String] Path param: The name of the namespace.
219
219
  #
220
220
  # @param filters [Object] Body param: Filter by attributes. Same syntax as the query endpoint.
221
221
  #
222
+ # @param include_ground_truth [Boolean] Body param: Include ground truth data (query vectors and true nearest neighbors)
223
+ #
222
224
  # @param num [Integer] Body param: The number of searches to run.
223
225
  #
224
226
  # @param queries [Array<Float>] Body param: Use specific query vectors for the measurement. If omitted, sampled
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Turbopuffer
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
data/lib/turbopuffer.rb CHANGED
@@ -51,6 +51,7 @@ require_relative "turbopuffer/internal/transport/base_client"
51
51
  require_relative "turbopuffer/internal/transport/pooled_net_requester"
52
52
  require_relative "turbopuffer/client"
53
53
  require_relative "turbopuffer/internal/namespace_page"
54
+ require_relative "turbopuffer/models/aggregation_group"
54
55
  require_relative "turbopuffer/models/attribute_schema"
55
56
  require_relative "turbopuffer/models/attribute_schema_config"
56
57
  require_relative "turbopuffer/models/attribute_type"
@@ -0,0 +1,13 @@
1
+ # typed: strong
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ AggregationGroup =
6
+ T.let(
7
+ Turbopuffer::Internal::Type::HashOf[
8
+ Turbopuffer::Internal::Type::Unknown
9
+ ],
10
+ Turbopuffer::Internal::Type::Converter
11
+ )
12
+ end
13
+ end
@@ -74,11 +74,11 @@ module Turbopuffer
74
74
  )
75
75
  end
76
76
 
77
- sig { returns(T.nilable(T::Array[Turbopuffer::Row])) }
77
+ sig { returns(T.nilable(T::Array[T::Hash[Symbol, T.anything]])) }
78
78
  attr_reader :aggregation_groups
79
79
 
80
80
  sig do
81
- params(aggregation_groups: T::Array[Turbopuffer::Row::OrHash]).void
81
+ params(aggregation_groups: T::Array[T::Hash[Symbol, T.anything]]).void
82
82
  end
83
83
  attr_writer :aggregation_groups
84
84
 
@@ -96,7 +96,7 @@ module Turbopuffer
96
96
 
97
97
  sig do
98
98
  params(
99
- aggregation_groups: T::Array[Turbopuffer::Row::OrHash],
99
+ aggregation_groups: T::Array[T::Hash[Symbol, T.anything]],
100
100
  aggregations: T::Hash[Symbol, T.anything],
101
101
  rows: T::Array[Turbopuffer::Row::OrHash]
102
102
  ).returns(T.attached_class)
@@ -107,7 +107,7 @@ module Turbopuffer
107
107
  sig do
108
108
  override.returns(
109
109
  {
110
- aggregation_groups: T::Array[Turbopuffer::Row],
110
+ aggregation_groups: T::Array[T::Hash[Symbol, T.anything]],
111
111
  aggregations: T::Hash[Symbol, T.anything],
112
112
  rows: T::Array[Turbopuffer::Row]
113
113
  }
@@ -25,11 +25,11 @@ module Turbopuffer
25
25
  sig { params(performance: Turbopuffer::QueryPerformance::OrHash).void }
26
26
  attr_writer :performance
27
27
 
28
- sig { returns(T.nilable(T::Array[Turbopuffer::Row])) }
28
+ sig { returns(T.nilable(T::Array[T::Hash[Symbol, T.anything]])) }
29
29
  attr_reader :aggregation_groups
30
30
 
31
31
  sig do
32
- params(aggregation_groups: T::Array[Turbopuffer::Row::OrHash]).void
32
+ params(aggregation_groups: T::Array[T::Hash[Symbol, T.anything]]).void
33
33
  end
34
34
  attr_writer :aggregation_groups
35
35
 
@@ -50,7 +50,7 @@ module Turbopuffer
50
50
  params(
51
51
  billing: Turbopuffer::QueryBilling::OrHash,
52
52
  performance: Turbopuffer::QueryPerformance::OrHash,
53
- aggregation_groups: T::Array[Turbopuffer::Row::OrHash],
53
+ aggregation_groups: T::Array[T::Hash[Symbol, T.anything]],
54
54
  aggregations: T::Hash[Symbol, T.anything],
55
55
  rows: T::Array[Turbopuffer::Row::OrHash]
56
56
  ).returns(T.attached_class)
@@ -71,7 +71,7 @@ module Turbopuffer
71
71
  {
72
72
  billing: Turbopuffer::QueryBilling,
73
73
  performance: Turbopuffer::QueryPerformance,
74
- aggregation_groups: T::Array[Turbopuffer::Row],
74
+ aggregation_groups: T::Array[T::Hash[Symbol, T.anything]],
75
75
  aggregations: T::Hash[Symbol, T.anything],
76
76
  rows: T::Array[Turbopuffer::Row]
77
77
  }
@@ -27,6 +27,14 @@ module Turbopuffer
27
27
  sig { params(filters: T.anything).void }
28
28
  attr_writer :filters
29
29
 
30
+ # Include ground truth data (query vectors and true nearest neighbors) in the
31
+ # response.
32
+ sig { returns(T.nilable(T::Boolean)) }
33
+ attr_reader :include_ground_truth
34
+
35
+ sig { params(include_ground_truth: T::Boolean).void }
36
+ attr_writer :include_ground_truth
37
+
30
38
  # The number of searches to run.
31
39
  sig { returns(T.nilable(Integer)) }
32
40
  attr_reader :num
@@ -53,6 +61,7 @@ module Turbopuffer
53
61
  params(
54
62
  namespace: String,
55
63
  filters: T.anything,
64
+ include_ground_truth: T::Boolean,
56
65
  num: Integer,
57
66
  queries: T::Array[Float],
58
67
  top_k: Integer,
@@ -63,6 +72,9 @@ module Turbopuffer
63
72
  namespace: nil,
64
73
  # Filter by attributes. Same syntax as the query endpoint.
65
74
  filters: nil,
75
+ # Include ground truth data (query vectors and true nearest neighbors) in the
76
+ # response.
77
+ include_ground_truth: nil,
66
78
  # The number of searches to run.
67
79
  num: nil,
68
80
  # Use specific query vectors for the measurement. If omitted, sampled from the
@@ -79,6 +91,7 @@ module Turbopuffer
79
91
  {
80
92
  namespace: String,
81
93
  filters: T.anything,
94
+ include_ground_truth: T::Boolean,
82
95
  num: Integer,
83
96
  queries: T::Array[Float],
84
97
  top_k: Integer,
@@ -24,12 +24,37 @@ module Turbopuffer
24
24
  sig { returns(Float) }
25
25
  attr_accessor :avg_recall
26
26
 
27
+ # Ground truth data including query vectors and true nearest neighbors. Only
28
+ # included when include_ground_truth is true.
29
+ sig do
30
+ returns(
31
+ T.nilable(
32
+ T::Array[Turbopuffer::Models::NamespaceRecallResponse::GroundTruth]
33
+ )
34
+ )
35
+ end
36
+ attr_reader :ground_truth
37
+
38
+ sig do
39
+ params(
40
+ ground_truth:
41
+ T::Array[
42
+ Turbopuffer::Models::NamespaceRecallResponse::GroundTruth::OrHash
43
+ ]
44
+ ).void
45
+ end
46
+ attr_writer :ground_truth
47
+
27
48
  # The response to a successful cache warm request.
28
49
  sig do
29
50
  params(
30
51
  avg_ann_count: Float,
31
52
  avg_exhaustive_count: Float,
32
- avg_recall: Float
53
+ avg_recall: Float,
54
+ ground_truth:
55
+ T::Array[
56
+ Turbopuffer::Models::NamespaceRecallResponse::GroundTruth::OrHash
57
+ ]
33
58
  ).returns(T.attached_class)
34
59
  end
35
60
  def self.new(
@@ -39,7 +64,10 @@ module Turbopuffer
39
64
  # The average number of documents retrieved by the exhaustive searches.
40
65
  avg_exhaustive_count:,
41
66
  # The average recall of the queries.
42
- avg_recall:
67
+ avg_recall:,
68
+ # Ground truth data including query vectors and true nearest neighbors. Only
69
+ # included when include_ground_truth is true.
70
+ ground_truth: nil
43
71
  )
44
72
  end
45
73
 
@@ -48,12 +76,59 @@ module Turbopuffer
48
76
  {
49
77
  avg_ann_count: Float,
50
78
  avg_exhaustive_count: Float,
51
- avg_recall: Float
79
+ avg_recall: Float,
80
+ ground_truth:
81
+ T::Array[
82
+ Turbopuffer::Models::NamespaceRecallResponse::GroundTruth
83
+ ]
52
84
  }
53
85
  )
54
86
  end
55
87
  def to_hash
56
88
  end
89
+
90
+ class GroundTruth < Turbopuffer::Internal::Type::BaseModel
91
+ OrHash =
92
+ T.type_alias do
93
+ T.any(
94
+ Turbopuffer::Models::NamespaceRecallResponse::GroundTruth,
95
+ Turbopuffer::Internal::AnyHash
96
+ )
97
+ end
98
+
99
+ # The true nearest neighbors with their distances and vectors.
100
+ sig { returns(T::Array[Turbopuffer::Row]) }
101
+ attr_accessor :nearest_neighbors
102
+
103
+ # The query vector used for this search.
104
+ sig { returns(T::Array[Float]) }
105
+ attr_accessor :query_vector
106
+
107
+ sig do
108
+ params(
109
+ nearest_neighbors: T::Array[Turbopuffer::Row::OrHash],
110
+ query_vector: T::Array[Float]
111
+ ).returns(T.attached_class)
112
+ end
113
+ def self.new(
114
+ # The true nearest neighbors with their distances and vectors.
115
+ nearest_neighbors:,
116
+ # The query vector used for this search.
117
+ query_vector:
118
+ )
119
+ end
120
+
121
+ sig do
122
+ override.returns(
123
+ {
124
+ nearest_neighbors: T::Array[Turbopuffer::Row],
125
+ query_vector: T::Array[Float]
126
+ }
127
+ )
128
+ end
129
+ def to_hash
130
+ end
131
+ end
57
132
  end
58
133
  end
59
134
  end
@@ -1,6 +1,12 @@
1
1
  # typed: strong
2
2
 
3
3
  module Turbopuffer
4
+ AggregationGroup =
5
+ T.let(
6
+ Turbopuffer::Models::AggregationGroup,
7
+ Turbopuffer::Internal::Type::Converter
8
+ )
9
+
4
10
  AttributeSchema = Turbopuffer::Models::AttributeSchema
5
11
 
6
12
  AttributeSchemaConfig = Turbopuffer::Models::AttributeSchemaConfig
@@ -171,6 +171,7 @@ module Turbopuffer
171
171
  params(
172
172
  namespace: T.nilable(String),
173
173
  filters: T.anything,
174
+ include_ground_truth: T::Boolean,
174
175
  num: Integer,
175
176
  queries: T::Array[Float],
176
177
  top_k: Integer,
@@ -182,6 +183,9 @@ module Turbopuffer
182
183
  namespace: nil,
183
184
  # Body param: Filter by attributes. Same syntax as the query endpoint.
184
185
  filters: nil,
186
+ # Body param: Include ground truth data (query vectors and true nearest neighbors)
187
+ # in the response.
188
+ include_ground_truth: nil,
185
189
  # Body param: The number of searches to run.
186
190
  num: nil,
187
191
  # Body param: Use specific query vectors for the measurement. If omitted, sampled
@@ -0,0 +1,7 @@
1
+ module Turbopuffer
2
+ module Models
3
+ type aggregation_group = ::Hash[Symbol, top]
4
+
5
+ AggregationGroup: Turbopuffer::Internal::Type::Converter
6
+ end
7
+ end
@@ -28,17 +28,17 @@ module Turbopuffer
28
28
 
29
29
  type result =
30
30
  {
31
- aggregation_groups: ::Array[Turbopuffer::Row],
31
+ aggregation_groups: ::Array[Turbopuffer::Models::aggregation_group],
32
32
  aggregations: ::Hash[Symbol, top],
33
33
  rows: ::Array[Turbopuffer::Row]
34
34
  }
35
35
 
36
36
  class Result < Turbopuffer::Internal::Type::BaseModel
37
- attr_reader aggregation_groups: ::Array[Turbopuffer::Row]?
37
+ attr_reader aggregation_groups: ::Array[Turbopuffer::Models::aggregation_group]?
38
38
 
39
39
  def aggregation_groups=: (
40
- ::Array[Turbopuffer::Row]
41
- ) -> ::Array[Turbopuffer::Row]
40
+ ::Array[Turbopuffer::Models::aggregation_group]
41
+ ) -> ::Array[Turbopuffer::Models::aggregation_group]
42
42
 
43
43
  attr_reader aggregations: ::Hash[Symbol, top]?
44
44
 
@@ -49,13 +49,13 @@ module Turbopuffer
49
49
  def rows=: (::Array[Turbopuffer::Row]) -> ::Array[Turbopuffer::Row]
50
50
 
51
51
  def initialize: (
52
- ?aggregation_groups: ::Array[Turbopuffer::Row],
52
+ ?aggregation_groups: ::Array[Turbopuffer::Models::aggregation_group],
53
53
  ?aggregations: ::Hash[Symbol, top],
54
54
  ?rows: ::Array[Turbopuffer::Row]
55
55
  ) -> void
56
56
 
57
57
  def to_hash: -> {
58
- aggregation_groups: ::Array[Turbopuffer::Row],
58
+ aggregation_groups: ::Array[Turbopuffer::Models::aggregation_group],
59
59
  aggregations: ::Hash[Symbol, top],
60
60
  rows: ::Array[Turbopuffer::Row]
61
61
  }
@@ -4,7 +4,7 @@ module Turbopuffer
4
4
  {
5
5
  billing: Turbopuffer::QueryBilling,
6
6
  performance: Turbopuffer::QueryPerformance,
7
- aggregation_groups: ::Array[Turbopuffer::Row],
7
+ aggregation_groups: ::Array[Turbopuffer::Models::aggregation_group],
8
8
  aggregations: ::Hash[Symbol, top],
9
9
  rows: ::Array[Turbopuffer::Row]
10
10
  }
@@ -14,11 +14,11 @@ module Turbopuffer
14
14
 
15
15
  attr_accessor performance: Turbopuffer::QueryPerformance
16
16
 
17
- attr_reader aggregation_groups: ::Array[Turbopuffer::Row]?
17
+ attr_reader aggregation_groups: ::Array[Turbopuffer::Models::aggregation_group]?
18
18
 
19
19
  def aggregation_groups=: (
20
- ::Array[Turbopuffer::Row]
21
- ) -> ::Array[Turbopuffer::Row]
20
+ ::Array[Turbopuffer::Models::aggregation_group]
21
+ ) -> ::Array[Turbopuffer::Models::aggregation_group]
22
22
 
23
23
  attr_reader aggregations: ::Hash[Symbol, top]?
24
24
 
@@ -31,7 +31,7 @@ module Turbopuffer
31
31
  def initialize: (
32
32
  billing: Turbopuffer::QueryBilling,
33
33
  performance: Turbopuffer::QueryPerformance,
34
- ?aggregation_groups: ::Array[Turbopuffer::Row],
34
+ ?aggregation_groups: ::Array[Turbopuffer::Models::aggregation_group],
35
35
  ?aggregations: ::Hash[Symbol, top],
36
36
  ?rows: ::Array[Turbopuffer::Row]
37
37
  ) -> void
@@ -39,7 +39,7 @@ module Turbopuffer
39
39
  def to_hash: -> {
40
40
  billing: Turbopuffer::QueryBilling,
41
41
  performance: Turbopuffer::QueryPerformance,
42
- aggregation_groups: ::Array[Turbopuffer::Row],
42
+ aggregation_groups: ::Array[Turbopuffer::Models::aggregation_group],
43
43
  aggregations: ::Hash[Symbol, top],
44
44
  rows: ::Array[Turbopuffer::Row]
45
45
  }
@@ -4,6 +4,7 @@ module Turbopuffer
4
4
  {
5
5
  namespace: String,
6
6
  filters: top,
7
+ include_ground_truth: bool,
7
8
  num: Integer,
8
9
  queries: ::Array[Float],
9
10
  top_k: Integer
@@ -22,6 +23,10 @@ module Turbopuffer
22
23
 
23
24
  def filters=: (top) -> top
24
25
 
26
+ attr_reader include_ground_truth: bool?
27
+
28
+ def include_ground_truth=: (bool) -> bool
29
+
25
30
  attr_reader num: Integer?
26
31
 
27
32
  def num=: (Integer) -> Integer
@@ -37,6 +42,7 @@ module Turbopuffer
37
42
  def initialize: (
38
43
  ?namespace: String,
39
44
  ?filters: top,
45
+ ?include_ground_truth: bool,
40
46
  ?num: Integer,
41
47
  ?queries: ::Array[Float],
42
48
  ?top_k: Integer,
@@ -46,6 +52,7 @@ module Turbopuffer
46
52
  def to_hash: -> {
47
53
  namespace: String,
48
54
  filters: top,
55
+ include_ground_truth: bool,
49
56
  num: Integer,
50
57
  queries: ::Array[Float],
51
58
  top_k: Integer,
@@ -1,7 +1,12 @@
1
1
  module Turbopuffer
2
2
  module Models
3
3
  type namespace_recall_response =
4
- { avg_ann_count: Float, avg_exhaustive_count: Float, avg_recall: Float }
4
+ {
5
+ avg_ann_count: Float,
6
+ avg_exhaustive_count: Float,
7
+ avg_recall: Float,
8
+ ground_truth: ::Array[Turbopuffer::Models::NamespaceRecallResponse::GroundTruth]
9
+ }
5
10
 
6
11
  class NamespaceRecallResponse < Turbopuffer::Internal::Type::BaseModel
7
12
  attr_accessor avg_ann_count: Float
@@ -10,17 +15,47 @@ module Turbopuffer
10
15
 
11
16
  attr_accessor avg_recall: Float
12
17
 
18
+ attr_reader ground_truth: ::Array[Turbopuffer::Models::NamespaceRecallResponse::GroundTruth]?
19
+
20
+ def ground_truth=: (
21
+ ::Array[Turbopuffer::Models::NamespaceRecallResponse::GroundTruth]
22
+ ) -> ::Array[Turbopuffer::Models::NamespaceRecallResponse::GroundTruth]
23
+
13
24
  def initialize: (
14
25
  avg_ann_count: Float,
15
26
  avg_exhaustive_count: Float,
16
- avg_recall: Float
27
+ avg_recall: Float,
28
+ ?ground_truth: ::Array[Turbopuffer::Models::NamespaceRecallResponse::GroundTruth]
17
29
  ) -> void
18
30
 
19
31
  def to_hash: -> {
20
32
  avg_ann_count: Float,
21
33
  avg_exhaustive_count: Float,
22
- avg_recall: Float
34
+ avg_recall: Float,
35
+ ground_truth: ::Array[Turbopuffer::Models::NamespaceRecallResponse::GroundTruth]
23
36
  }
37
+
38
+ type ground_truth =
39
+ {
40
+ nearest_neighbors: ::Array[Turbopuffer::Row],
41
+ query_vector: ::Array[Float]
42
+ }
43
+
44
+ class GroundTruth < Turbopuffer::Internal::Type::BaseModel
45
+ attr_accessor nearest_neighbors: ::Array[Turbopuffer::Row]
46
+
47
+ attr_accessor query_vector: ::Array[Float]
48
+
49
+ def initialize: (
50
+ nearest_neighbors: ::Array[Turbopuffer::Row],
51
+ query_vector: ::Array[Float]
52
+ ) -> void
53
+
54
+ def to_hash: -> {
55
+ nearest_neighbors: ::Array[Turbopuffer::Row],
56
+ query_vector: ::Array[Float]
57
+ }
58
+ end
24
59
  end
25
60
  end
26
61
  end
@@ -1,4 +1,6 @@
1
1
  module Turbopuffer
2
+ AggregationGroup: Turbopuffer::Internal::Type::Converter
3
+
2
4
  module AttributeSchema = Turbopuffer::Models::AttributeSchema
3
5
 
4
6
  class AttributeSchemaConfig = Turbopuffer::Models::AttributeSchemaConfig
@@ -57,6 +57,7 @@ module Turbopuffer
57
57
  def recall: (
58
58
  ?namespace: String,
59
59
  ?filters: top,
60
+ ?include_ground_truth: bool,
60
61
  ?num: Integer,
61
62
  ?queries: ::Array[Float],
62
63
  ?top_k: Integer,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbopuffer-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Turbopuffer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-28 00:00:00.000000000 Z
11
+ date: 2025-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -56,6 +56,7 @@ files:
56
56
  - lib/turbopuffer/internal/type/unknown.rb
57
57
  - lib/turbopuffer/internal/util.rb
58
58
  - lib/turbopuffer/models.rb
59
+ - lib/turbopuffer/models/aggregation_group.rb
59
60
  - lib/turbopuffer/models/attribute_schema.rb
60
61
  - lib/turbopuffer/models/attribute_schema_config.rb
61
62
  - lib/turbopuffer/models/attribute_type.rb
@@ -121,6 +122,7 @@ files:
121
122
  - rbi/turbopuffer/internal/type/unknown.rbi
122
123
  - rbi/turbopuffer/internal/util.rbi
123
124
  - rbi/turbopuffer/models.rbi
125
+ - rbi/turbopuffer/models/aggregation_group.rbi
124
126
  - rbi/turbopuffer/models/attribute_schema.rbi
125
127
  - rbi/turbopuffer/models/attribute_schema_config.rbi
126
128
  - rbi/turbopuffer/models/attribute_type.rbi
@@ -185,6 +187,7 @@ files:
185
187
  - sig/turbopuffer/internal/type/unknown.rbs
186
188
  - sig/turbopuffer/internal/util.rbs
187
189
  - sig/turbopuffer/models.rbs
190
+ - sig/turbopuffer/models/aggregation_group.rbs
188
191
  - sig/turbopuffer/models/attribute_schema.rbs
189
192
  - sig/turbopuffer/models/attribute_schema_config.rbs
190
193
  - sig/turbopuffer/models/attribute_type.rbs