turbopuffer 2.7.0 → 2.9.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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/README.md +15 -1
  4. data/lib/turbopuffer/client.rb +7 -0
  5. data/lib/turbopuffer/internal/respond_async.rb +1 -1
  6. data/lib/turbopuffer/internal/telemetry.rb +462 -0
  7. data/lib/turbopuffer/internal/transport/base_client.rb +50 -21
  8. data/lib/turbopuffer/internal/transport/pooled_net_requester.rb +77 -2
  9. data/lib/turbopuffer/internal/transport/request_observer.rb +377 -0
  10. data/lib/turbopuffer/models/attribute_schema_config.rb +1 -0
  11. data/lib/turbopuffer/models/branch_from_namespace_params.rb +3 -0
  12. data/lib/turbopuffer/models/copy_from_namespace_operation.rb +8 -1
  13. data/lib/turbopuffer/models/copy_from_namespace_operation_result.rb +5 -3
  14. data/lib/turbopuffer/models/copy_from_namespace_params.rb +3 -0
  15. data/lib/turbopuffer/models/full_text_search.rb +1 -0
  16. data/lib/turbopuffer/models/id.rb +1 -1
  17. data/lib/turbopuffer/models/namespace_hint_cache_warm_response.rb +2 -1
  18. data/lib/turbopuffer/models/namespace_metadata.rb +10 -1
  19. data/lib/turbopuffer/models/namespace_metadata_patch.rb +1 -0
  20. data/lib/turbopuffer/models/namespace_multi_query_params.rb +1 -0
  21. data/lib/turbopuffer/models/namespace_multi_query_response.rb +19 -2
  22. data/lib/turbopuffer/models/namespace_query_params.rb +9 -1
  23. data/lib/turbopuffer/models/namespace_query_response.rb +10 -2
  24. data/lib/turbopuffer/models/namespace_recall_response.rb +5 -0
  25. data/lib/turbopuffer/models/namespace_start_copy_from_response.rb +2 -0
  26. data/lib/turbopuffer/models/namespace_write_params.rb +3 -3
  27. data/lib/turbopuffer/models/operation_error.rb +2 -0
  28. data/lib/turbopuffer/models/rerank_model_params.rb +38 -0
  29. data/lib/turbopuffer/models/write_result.rb +1 -1
  30. data/lib/turbopuffer/models.rb +2 -0
  31. data/lib/turbopuffer/resources/namespaces.rb +4 -2
  32. data/lib/turbopuffer/version.rb +1 -1
  33. data/lib/turbopuffer.rb +3 -0
  34. data/rbi/turbopuffer/client.rbi +5 -0
  35. data/rbi/turbopuffer/internal/telemetry.rbi +275 -0
  36. data/rbi/turbopuffer/internal/transport/base_client.rbi +13 -2
  37. data/rbi/turbopuffer/internal/transport/pooled_net_requester.rbi +47 -1
  38. data/rbi/turbopuffer/internal/transport/request_observer.rbi +340 -0
  39. data/rbi/turbopuffer/models/branch_from_namespace_params.rbi +1 -0
  40. data/rbi/turbopuffer/models/copy_from_namespace_operation.rbi +4 -0
  41. data/rbi/turbopuffer/models/copy_from_namespace_operation_result.rbi +8 -3
  42. data/rbi/turbopuffer/models/copy_from_namespace_params.rbi +1 -0
  43. data/rbi/turbopuffer/models/namespace_hint_cache_warm_response.rbi +2 -0
  44. data/rbi/turbopuffer/models/namespace_metadata.rbi +5 -0
  45. data/rbi/turbopuffer/models/namespace_multi_query_response.rbi +17 -1
  46. data/rbi/turbopuffer/models/namespace_query_params.rbi +11 -0
  47. data/rbi/turbopuffer/models/namespace_query_response.rbi +8 -1
  48. data/rbi/turbopuffer/models/namespace_recall_response.rbi +4 -0
  49. data/rbi/turbopuffer/models/namespace_start_copy_from_response.rbi +1 -0
  50. data/rbi/turbopuffer/models/namespace_write_params.rbi +3 -3
  51. data/rbi/turbopuffer/models/operation_error.rbi +1 -0
  52. data/rbi/turbopuffer/models/rerank_model_params.rbi +48 -0
  53. data/rbi/turbopuffer/models/write_result.rbi +1 -1
  54. data/rbi/turbopuffer/models.rbi +2 -0
  55. data/rbi/turbopuffer/resources/namespaces.rbi +5 -1
  56. data/sig/turbopuffer/client.rbs +1 -0
  57. data/sig/turbopuffer/internal/telemetry.rbs +129 -0
  58. data/sig/turbopuffer/internal/transport/base_client.rbs +5 -1
  59. data/sig/turbopuffer/internal/transport/pooled_net_requester.rbs +15 -1
  60. data/sig/turbopuffer/internal/transport/request_observer.rbs +153 -0
  61. data/sig/turbopuffer/models/namespace_query_params.rbs +9 -0
  62. data/sig/turbopuffer/models/rerank_model_params.rbs +18 -0
  63. data/sig/turbopuffer/models.rbs +2 -0
  64. data/sig/turbopuffer/resources/namespaces.rbs +1 -0
  65. metadata +11 -2
@@ -10,8 +10,10 @@ module Turbopuffer
10
10
 
11
11
  discriminator :status
12
12
 
13
+ # The copy is still in progress.
13
14
  variant :running, -> { Turbopuffer::CopyFromNamespaceOperation::Running }
14
15
 
16
+ # The copy has finished, successfully or not.
15
17
  variant :finished, -> { Turbopuffer::CopyFromNamespaceOperation::Finished }
16
18
 
17
19
  class Running < Turbopuffer::Internal::Type::BaseModel
@@ -37,6 +39,8 @@ module Turbopuffer
37
39
  # Some parameter documentations has been truncated, see
38
40
  # {Turbopuffer::Models::CopyFromNamespaceOperation::Running} for more details.
39
41
  #
42
+ # The copy is still in progress.
43
+ #
40
44
  # @param start_time [Time] The time at which the operation started.
41
45
  #
42
46
  # @param progress [String] A freeform description of the operation's progress. May be absent, and its forma
@@ -52,6 +56,7 @@ module Turbopuffer
52
56
  required :finish_time, Time
53
57
 
54
58
  # @!attribute result
59
+ # The result of the copy.
55
60
  #
56
61
  # @return [Turbopuffer::Models::CopyFromNamespaceOperationResult::Success, Turbopuffer::Models::CopyFromNamespaceOperationResult::Error]
57
62
  required :result, union: -> { Turbopuffer::CopyFromNamespaceOperationResult }
@@ -68,9 +73,11 @@ module Turbopuffer
68
73
  required :status, const: :finished
69
74
 
70
75
  # @!method initialize(finish_time:, result:, start_time:, status: :finished)
76
+ # The copy has finished, successfully or not.
77
+ #
71
78
  # @param finish_time [Time] The time at which the operation finished.
72
79
  #
73
- # @param result [Turbopuffer::Models::CopyFromNamespaceOperationResult::Success, Turbopuffer::Models::CopyFromNamespaceOperationResult::Error]
80
+ # @param result [Turbopuffer::Models::CopyFromNamespaceOperationResult::Success, Turbopuffer::Models::CopyFromNamespaceOperationResult::Error] The result of the copy.
74
81
  #
75
82
  # @param start_time [Time] The time at which the operation started.
76
83
  #
@@ -2,6 +2,7 @@
2
2
 
3
3
  module Turbopuffer
4
4
  module Models
5
+ # The result of a finished copy operation.
5
6
  module CopyFromNamespaceOperationResult
6
7
  extend Turbopuffer::Internal::Type::Union
7
8
 
@@ -11,23 +12,24 @@ module Turbopuffer
11
12
 
12
13
  class Success < Turbopuffer::Internal::Type::BaseModel
13
14
  # @!attribute success
14
- # The response to a successful write request.
15
+ # The copy succeeded, with the result of its write.
15
16
  #
16
17
  # @return [Turbopuffer::Models::WriteResult]
17
18
  required :success, -> { Turbopuffer::WriteResult }
18
19
 
19
20
  # @!method initialize(success:)
20
- # @param success [Turbopuffer::Models::WriteResult] The response to a successful write request.
21
+ # @param success [Turbopuffer::Models::WriteResult] The copy succeeded, with the result of its write.
21
22
  end
22
23
 
23
24
  class Error < Turbopuffer::Internal::Type::BaseModel
24
25
  # @!attribute error
26
+ # The copy failed, with its error.
25
27
  #
26
28
  # @return [Turbopuffer::Models::OperationError]
27
29
  required :error, -> { Turbopuffer::OperationError }
28
30
 
29
31
  # @!method initialize(error:)
30
- # @param error [Turbopuffer::Models::OperationError]
32
+ # @param error [Turbopuffer::Models::OperationError] The copy failed, with its error.
31
33
  end
32
34
 
33
35
  # @!method self.variants
@@ -9,6 +9,7 @@ module Turbopuffer
9
9
  # The namespace to copy documents from.
10
10
  variant String
11
11
 
12
+ # Configuration for copying documents from another namespace.
12
13
  variant -> { Turbopuffer::CopyFromNamespaceParams::CopyFromNamespaceConfig }
13
14
 
14
15
  class CopyFromNamespaceConfig < Turbopuffer::Internal::Type::BaseModel
@@ -31,6 +32,8 @@ module Turbopuffer
31
32
  optional :source_region, String
32
33
 
33
34
  # @!method initialize(source_namespace:, source_api_key: nil, source_region: nil)
35
+ # Configuration for copying documents from another namespace.
36
+ #
34
37
  # @param source_namespace [String] The namespace to copy documents from.
35
38
  #
36
39
  # @param source_api_key [String] (Optional) An API key for the organization containing the source namespace
@@ -8,6 +8,7 @@ module Turbopuffer
8
8
  module FullTextSearch
9
9
  extend Turbopuffer::Internal::Type::Union
10
10
 
11
+ # Whether to enable full-text search with the default configuration.
11
12
  variant Turbopuffer::Internal::Type::Boolean
12
13
 
13
14
  # Configuration options for full-text search.
@@ -9,7 +9,7 @@ module Turbopuffer
9
9
  # A string ID.
10
10
  variant String
11
11
 
12
- # An integer ID.
12
+ # An unsigned 64-bit integer ID.
13
13
  variant Integer
14
14
 
15
15
  # @!method self.variants
@@ -11,6 +11,7 @@ module Turbopuffer
11
11
  required :status, const: :ACCEPTED
12
12
 
13
13
  # @!attribute message
14
+ # A message describing the result of the request.
14
15
  #
15
16
  # @return [String, nil]
16
17
  optional :message, String
@@ -18,7 +19,7 @@ module Turbopuffer
18
19
  # @!method initialize(message: nil, status: :ACCEPTED)
19
20
  # The response to a successful cache warm request.
20
21
  #
21
- # @param message [String]
22
+ # @param message [String] A message describing the result of the request.
22
23
  #
23
24
  # @param status [Symbol, :ACCEPTED] The status of the request.
24
25
  end
@@ -29,6 +29,7 @@ module Turbopuffer
29
29
  required :encryption, union: -> { Turbopuffer::Encryption }
30
30
 
31
31
  # @!attribute index
32
+ # The state of the namespace's index.
32
33
  #
33
34
  # @return [Turbopuffer::Models::NamespaceMetadata::Index::IndexUpToDate, Turbopuffer::Models::NamespaceMetadata::Index::IndexUpdating]
34
35
  required :index, union: -> { Turbopuffer::NamespaceMetadata::Index }
@@ -81,7 +82,7 @@ module Turbopuffer
81
82
  #
82
83
  # @param encryption [Turbopuffer::Models::Encryption::CustomerManaged, Turbopuffer::Models::Encryption::Default] The encryption configuration for a namespace.
83
84
  #
84
- # @param index [Turbopuffer::Models::NamespaceMetadata::Index::IndexUpToDate, Turbopuffer::Models::NamespaceMetadata::Index::IndexUpdating]
85
+ # @param index [Turbopuffer::Models::NamespaceMetadata::Index::IndexUpToDate, Turbopuffer::Models::NamespaceMetadata::Index::IndexUpdating] The state of the namespace's index.
85
86
  #
86
87
  # @param schema [Hash{Symbol=>Turbopuffer::Models::AttributeSchemaConfig}] The schema of the namespace.
87
88
  #
@@ -93,12 +94,16 @@ module Turbopuffer
93
94
  #
94
95
  # @param sharding [Turbopuffer::Models::ShardingConfig] Configuration for namespace sharding, which partitions a namespace's documents a
95
96
 
97
+ # The state of the namespace's index.
98
+ #
96
99
  # @see Turbopuffer::Models::NamespaceMetadata#index
97
100
  module Index
98
101
  extend Turbopuffer::Internal::Type::Union
99
102
 
103
+ # Every document in the namespace is indexed.
100
104
  variant -> { Turbopuffer::NamespaceMetadata::Index::IndexUpToDate }
101
105
 
106
+ # Some documents are in the write-ahead log and haven't been indexed yet.
102
107
  variant -> { Turbopuffer::NamespaceMetadata::Index::IndexUpdating }
103
108
 
104
109
  class IndexUpToDate < Turbopuffer::Internal::Type::BaseModel
@@ -108,6 +113,8 @@ module Turbopuffer
108
113
  required :status, const: :"up-to-date"
109
114
 
110
115
  # @!method initialize(status: :"up-to-date")
116
+ # Every document in the namespace is indexed.
117
+ #
111
118
  # @param status [Symbol, :"up-to-date"]
112
119
  end
113
120
 
@@ -134,6 +141,8 @@ module Turbopuffer
134
141
  # Some parameter documentations has been truncated, see
135
142
  # {Turbopuffer::Models::NamespaceMetadata::Index::IndexUpdating} for more details.
136
143
  #
144
+ # Some documents are in the write-ahead log and haven't been indexed yet.
145
+ #
137
146
  # @param unindexed_bytes [Integer] The number of bytes in the namespace that are in the write-ahead log but have no
138
147
  #
139
148
  # @param unindexed_rows [Integer] The number of rows in the write-ahead log that have not yet been indexed.
@@ -42,6 +42,7 @@ module Turbopuffer
42
42
  module Pinning
43
43
  extend Turbopuffer::Internal::Type::Union
44
44
 
45
+ # `true` to enable pinning with the default configuration, or `false` to remove pinning.
45
46
  variant Turbopuffer::Internal::Type::Boolean
46
47
 
47
48
  # Configuration for namespace pinning.
@@ -221,6 +221,7 @@ module Turbopuffer
221
221
  module Limit
222
222
  extend Turbopuffer::Internal::Type::Union
223
223
 
224
+ # Limits the total number of reranked documents returned.
224
225
  variant Integer
225
226
 
226
227
  # Limits the total number of reranked documents returned.
@@ -17,19 +17,24 @@ module Turbopuffer
17
17
  required :performance, -> { Turbopuffer::QueryPerformance }
18
18
 
19
19
  # @!attribute results
20
+ # The results of each subquery, in the same order as `queries`. With `rerank_by`,
21
+ # a single result combining the subqueries' rows.
20
22
  #
21
23
  # @return [Array<Turbopuffer::Models::NamespaceMultiQueryResponse::Result>]
22
24
  required :results,
23
25
  -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Models::NamespaceMultiQueryResponse::Result] }
24
26
 
25
27
  # @!method initialize(billing:, performance:, results:)
28
+ # Some parameter documentations has been truncated, see
29
+ # {Turbopuffer::Models::NamespaceMultiQueryResponse} for more details.
30
+ #
26
31
  # The result of a multi-query.
27
32
  #
28
33
  # @param billing [Turbopuffer::Models::QueryBilling] The billing information for a query.
29
34
  #
30
35
  # @param performance [Turbopuffer::Models::QueryPerformance] The performance information for a query.
31
36
  #
32
- # @param results [Array<Turbopuffer::Models::NamespaceMultiQueryResponse::Result>]
37
+ # @param results [Array<Turbopuffer::Models::NamespaceMultiQueryResponse::Result>] The results of each subquery, in the same order as `queries`. With `rerank_by`,
33
38
 
34
39
  class Result < Turbopuffer::Internal::Type::BaseModel
35
40
  # @!attribute aggregation_groups
@@ -44,14 +49,26 @@ module Turbopuffer
44
49
  optional :aggregations, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
45
50
 
46
51
  # @!attribute rows
52
+ # The documents that matched the query, ordered by `rank_by`. Only present when
53
+ # `rank_by` is set.
47
54
  #
48
55
  # @return [Array<Turbopuffer::Models::Row>, nil]
49
56
  optional :rows, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
50
57
 
51
58
  # @!method initialize(aggregation_groups: nil, aggregations: nil, rows: nil)
59
+ # Some parameter documentations has been truncated, see
60
+ # {Turbopuffer::Models::NamespaceMultiQueryResponse::Result} for more details.
61
+ #
62
+ # The result of a query, or of one subquery of a multi-query. With `aggregate_by`,
63
+ # `aggregations` maps each aggregation's label to its value. With `group_by` as
64
+ # well, `aggregation_groups` holds one object per group instead, with its group
65
+ # key and the value of each aggregation.
66
+ #
52
67
  # @param aggregation_groups [Array<Hash{Symbol=>Object}>]
68
+ #
53
69
  # @param aggregations [Hash{Symbol=>Object}]
54
- # @param rows [Array<Turbopuffer::Models::Row>]
70
+ #
71
+ # @param rows [Array<Turbopuffer::Models::Row>] The documents that matched the query, ordered by `rank_by`. Only present when `r
55
72
  end
56
73
  end
57
74
  end
@@ -85,6 +85,12 @@ module Turbopuffer
85
85
  # @return [Object, nil]
86
86
  optional :rank_by, Turbopuffer::Internal::Type::Unknown
87
87
 
88
+ # @!attribute rerank_by
89
+ # Rerank retrieved candidates with a model.
90
+ #
91
+ # @return [Turbopuffer::Models::RerankModelParams, nil]
92
+ optional :rerank_by, -> { Turbopuffer::RerankModelParams }
93
+
88
94
  # @!attribute top_k
89
95
  # The number of results to return.
90
96
  #
@@ -97,7 +103,7 @@ module Turbopuffer
97
103
  # @return [Symbol, Turbopuffer::Models::VectorEncoding, nil]
98
104
  optional :vector_encoding, enum: -> { Turbopuffer::VectorEncoding }
99
105
 
100
- # @!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, offset: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
106
+ # @!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, offset: nil, rank_by: nil, rerank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
101
107
  # Some parameter documentations has been truncated, see
102
108
  # {Turbopuffer::Models::NamespaceQueryParams} for more details.
103
109
  #
@@ -125,6 +131,8 @@ module Turbopuffer
125
131
  #
126
132
  # @param rank_by [Object] How to rank the documents in the namespace.
127
133
  #
134
+ # @param rerank_by [Turbopuffer::Models::RerankModelParams] Rerank retrieved candidates with a model.
135
+ #
128
136
  # @param top_k [Integer] The number of results to return.
129
137
  #
130
138
  # @param vector_encoding [Symbol, Turbopuffer::Models::VectorEncoding] The encoding to use for vectors in the response.
@@ -28,12 +28,20 @@ module Turbopuffer
28
28
  optional :aggregations, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
29
29
 
30
30
  # @!attribute rows
31
+ # The documents that matched the query, ordered by `rank_by`. Only present when
32
+ # `rank_by` is set.
31
33
  #
32
34
  # @return [Array<Turbopuffer::Models::Row>, nil]
33
35
  optional :rows, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
34
36
 
35
37
  # @!method initialize(billing:, performance:, aggregation_groups: nil, aggregations: nil, rows: nil)
36
- # The result of a query.
38
+ # Some parameter documentations has been truncated, see
39
+ # {Turbopuffer::Models::NamespaceQueryResponse} for more details.
40
+ #
41
+ # The result of a query. With `aggregate_by`, `aggregations` maps each
42
+ # aggregation's label to its value. With `group_by` as well, `aggregation_groups`
43
+ # holds one object per group instead, with its group key and the value of each
44
+ # aggregation.
37
45
  #
38
46
  # @param billing [Turbopuffer::Models::QueryBilling] The billing information for a query.
39
47
  #
@@ -43,7 +51,7 @@ module Turbopuffer
43
51
  #
44
52
  # @param aggregations [Hash{Symbol=>Object}]
45
53
  #
46
- # @param rows [Array<Turbopuffer::Models::Row>]
54
+ # @param rows [Array<Turbopuffer::Models::Row>] The documents that matched the query, ordered by `rank_by`. Only present when `r
47
55
  end
48
56
  end
49
57
  end
@@ -59,6 +59,11 @@ module Turbopuffer
59
59
  required :query_vector, Turbopuffer::Internal::Type::ArrayOf[Float]
60
60
 
61
61
  # @!method initialize(nearest_neighbors:, query_vector:)
62
+ # One of the searches the evaluation ran: its query vector, sampled at random from
63
+ # the namespace's vectors unless `rank_by` is set, and the query's true nearest
64
+ # neighbors, found by exhaustive search. Recall compares these neighbors to the
65
+ # results of the approximate nearest neighbor (ANN) search.
66
+ #
62
67
  # @param nearest_neighbors [Array<Turbopuffer::Models::Row>] The true nearest neighbors with their distances and vectors.
63
68
  #
64
69
  # @param query_vector [Array<Float>] The query vector used for this search.
@@ -11,6 +11,8 @@ module Turbopuffer
11
11
  required :token, String
12
12
 
13
13
  # @!method initialize(token:)
14
+ # The response to a successful request to start a copy.
15
+ #
14
16
  # @param token [String] The token identifying the copy operation.
15
17
  end
16
18
  end
@@ -77,7 +77,7 @@ module Turbopuffer
77
77
  optional :encryption, union: -> { Turbopuffer::Encryption }
78
78
 
79
79
  # @!attribute patch_by_filter
80
- # The patch and filter specifying which documents to patch.
80
+ # Sets the attributes in `patch` on every document that matches `filters`.
81
81
  #
82
82
  # @return [Turbopuffer::Models::NamespaceWriteParams::PatchByFilter, nil]
83
83
  optional :patch_by_filter, -> { Turbopuffer::NamespaceWriteParams::PatchByFilter }
@@ -175,7 +175,7 @@ module Turbopuffer
175
175
  #
176
176
  # @param encryption [Turbopuffer::Models::Encryption::CustomerManaged, Turbopuffer::Models::Encryption::Default] The encryption configuration for a namespace.
177
177
  #
178
- # @param patch_by_filter [Turbopuffer::Models::NamespaceWriteParams::PatchByFilter] The patch and filter specifying which documents to patch.
178
+ # @param patch_by_filter [Turbopuffer::Models::NamespaceWriteParams::PatchByFilter] Sets the attributes in `patch` on every document that matches `filters`.
179
179
  #
180
180
  # @param patch_by_filter_allow_partial [Boolean] Allow partial completion when filter matches too many documents.
181
181
  #
@@ -212,7 +212,7 @@ module Turbopuffer
212
212
  required :patch, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
213
213
 
214
214
  # @!method initialize(filters:, patch:)
215
- # The patch and filter specifying which documents to patch.
215
+ # Sets the attributes in `patch` on every document that matches `filters`.
216
216
  #
217
217
  # @param filters [Object] Filter by attributes. Same syntax as the query endpoint.
218
218
  #
@@ -16,6 +16,8 @@ module Turbopuffer
16
16
  required :status_code, Integer
17
17
 
18
18
  # @!method initialize(detail:, status_code:)
19
+ # The error of an asynchronous operation that failed.
20
+ #
19
21
  # @param detail [Turbopuffer::Models::OperationError::Detail] The response to an unsuccessful request.
20
22
  #
21
23
  # @param status_code [Integer] The HTTP status code of the operation's error.
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class RerankModelParams < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute attribute
7
+ # The string attribute to score. Must be included in `include_attributes` in every
8
+ # query.
9
+ #
10
+ # @return [String]
11
+ required :attribute, String
12
+
13
+ # @!attribute model
14
+ # Which reranking model to use.
15
+ #
16
+ # @return [String]
17
+ required :model, String
18
+
19
+ # @!attribute query
20
+ # The query text to score each document against.
21
+ #
22
+ # @return [String]
23
+ required :query, String
24
+
25
+ # @!method initialize(attribute:, model:, query:)
26
+ # Some parameter documentations has been truncated, see
27
+ # {Turbopuffer::Models::RerankModelParams} for more details.
28
+ #
29
+ # Rerank retrieved candidates with a model.
30
+ #
31
+ # @param attribute [String] The string attribute to score. Must be included in `include_attributes` in every
32
+ #
33
+ # @param model [String] Which reranking model to use.
34
+ #
35
+ # @param query [String] The query text to score each document against.
36
+ end
37
+ end
38
+ end
@@ -82,7 +82,7 @@ module Turbopuffer
82
82
  # Some parameter documentations has been truncated, see
83
83
  # {Turbopuffer::Models::WriteResult} for more details.
84
84
  #
85
- # The response to a successful write request.
85
+ # The copy succeeded, with the result of its write.
86
86
  #
87
87
  # @param billing [Turbopuffer::Models::WriteBilling] The billing information for a write request.
88
88
  #
@@ -148,6 +148,8 @@ module Turbopuffer
148
148
 
149
149
  RerankLimit = Turbopuffer::Models::RerankLimit
150
150
 
151
+ RerankModelParams = Turbopuffer::Models::RerankModelParams
152
+
151
153
  Row = Turbopuffer::Models::Row
152
154
 
153
155
  RrfParams = Turbopuffer::Models::RrfParams
@@ -271,7 +271,7 @@ module Turbopuffer
271
271
  #
272
272
  # Query, filter, full-text search and vector search documents.
273
273
  #
274
- # @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, offset: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
274
+ # @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, offset: nil, rank_by: nil, rerank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
275
275
  #
276
276
  # @param namespace [String] Path param: The name of the namespace.
277
277
  #
@@ -297,6 +297,8 @@ module Turbopuffer
297
297
  #
298
298
  # @param rank_by [Object] Body param: How to rank the documents in the namespace.
299
299
  #
300
+ # @param rerank_by [Turbopuffer::Models::RerankModelParams] Body param: Rerank retrieved candidates with a model.
301
+ #
300
302
  # @param top_k [Integer] Body param: The number of results to return.
301
303
  #
302
304
  # @param vector_encoding [Symbol, Turbopuffer::Models::VectorEncoding] Body param: The encoding to use for vectors in the response.
@@ -514,7 +516,7 @@ module Turbopuffer
514
516
  #
515
517
  # @param encryption [Turbopuffer::Models::Encryption::CustomerManaged, Turbopuffer::Models::Encryption::Default] Body param: The encryption configuration for a namespace.
516
518
  #
517
- # @param patch_by_filter [Turbopuffer::Models::NamespaceWriteParams::PatchByFilter] Body param: The patch and filter specifying which documents to patch.
519
+ # @param patch_by_filter [Turbopuffer::Models::NamespaceWriteParams::PatchByFilter] Body param: Sets the attributes in `patch` on every document that matches `filte
518
520
  #
519
521
  # @param patch_by_filter_allow_partial [Boolean] Body param: Allow partial completion when filter matches too many documents.
520
522
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Turbopuffer
4
- VERSION = "2.7.0"
4
+ VERSION = "2.9.0"
5
5
  end
data/lib/turbopuffer.rb CHANGED
@@ -49,9 +49,11 @@ require_relative "turbopuffer/internal"
49
49
  require_relative "turbopuffer/request_options"
50
50
  require_relative "turbopuffer/file_part"
51
51
  require_relative "turbopuffer/errors"
52
+ require_relative "turbopuffer/internal/transport/request_observer"
52
53
  require_relative "turbopuffer/internal/transport/base_client"
53
54
  require_relative "turbopuffer/internal/transport/pooled_net_requester"
54
55
  require_relative "turbopuffer/internal/respond_async"
56
+ require_relative "turbopuffer/internal/telemetry"
55
57
  require_relative "turbopuffer/client"
56
58
  require_relative "turbopuffer/internal/namespace_page"
57
59
  require_relative "turbopuffer/models/pinning_config"
@@ -120,6 +122,7 @@ require_relative "turbopuffer/models/operation_error"
120
122
  require_relative "turbopuffer/models/query_billing"
121
123
  require_relative "turbopuffer/models/query_performance"
122
124
  require_relative "turbopuffer/models/rerank_limit"
125
+ require_relative "turbopuffer/models/rerank_model_params"
123
126
  require_relative "turbopuffer/models/row"
124
127
  require_relative "turbopuffer/models/rrf_params"
125
128
  require_relative "turbopuffer/models/saturate_params"
@@ -66,6 +66,7 @@ module Turbopuffer
66
66
  default_namespace: T.nilable(String),
67
67
  base_url: T.nilable(String),
68
68
  compression: T::Boolean,
69
+ telemetry: T.nilable(T::Boolean),
69
70
  max_retries: Integer,
70
71
  timeout: Float,
71
72
  initial_retry_delay: Float,
@@ -83,6 +84,10 @@ module Turbopuffer
83
84
  base_url: ENV["TURBOPUFFER_BASE_URL"],
84
85
  # Whether to request compressed responses. Defaults to false.
85
86
  compression: false,
87
+ # Whether to report client-side request timings to turbopuffer on subsequent
88
+ # requests. Defaults to `ENV["TURBOPUFFER_TELEMETRY"]`, and is off when that's
89
+ # unset.
90
+ telemetry: nil,
86
91
  # Max number of retries to attempt after a failed retryable request.
87
92
  max_retries: Turbopuffer::Client::DEFAULT_MAX_RETRIES,
88
93
  timeout: Turbopuffer::Client::DEFAULT_TIMEOUT_IN_SECONDS,