turbopuffer 2.3.0 → 2.5.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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +40 -0
  3. data/README.md +1 -10
  4. data/lib/turbopuffer/client.rb +2 -2
  5. data/lib/turbopuffer/internal/type/union.rb +17 -7
  6. data/lib/turbopuffer/models/attribute_schema_config.rb +14 -1
  7. data/lib/turbopuffer/models/copy_from_namespace_operation.rb +84 -0
  8. data/lib/turbopuffer/models/copy_from_namespace_operation_result.rb +37 -0
  9. data/lib/turbopuffer/models/highlight_config_params.rb +46 -0
  10. data/lib/turbopuffer/models/highlight_fragment_by.rb +25 -0
  11. data/lib/turbopuffer/models/highlight_offset_units.rb +17 -0
  12. data/lib/turbopuffer/models/namespace_explain_query_params.rb +20 -1
  13. data/lib/turbopuffer/models/namespace_metadata.rb +32 -2
  14. data/lib/turbopuffer/models/namespace_metadata_patch.rb +10 -1
  15. data/lib/turbopuffer/models/namespace_multi_query_params.rb +55 -2
  16. data/lib/turbopuffer/models/namespace_poll_copy_from_params.rb +26 -0
  17. data/lib/turbopuffer/models/namespace_query_params.rb +20 -1
  18. data/lib/turbopuffer/models/namespace_start_copy_from_params.rb +53 -0
  19. data/lib/turbopuffer/models/namespace_start_copy_from_response.rb +17 -0
  20. data/lib/turbopuffer/models/namespace_write_params.rb +12 -1
  21. data/lib/turbopuffer/models/operation_error.rb +46 -0
  22. data/lib/turbopuffer/models/rerank_limit.rb +18 -0
  23. data/lib/turbopuffer/models/rrf_params.rb +14 -1
  24. data/lib/turbopuffer/models/sharding_config.rb +21 -0
  25. data/lib/turbopuffer/models/write_result.rb +112 -0
  26. data/lib/turbopuffer/models.rb +22 -0
  27. data/lib/turbopuffer/resources/namespaces.rb +87 -5
  28. data/lib/turbopuffer/version.rb +1 -1
  29. data/lib/turbopuffer.rb +12 -0
  30. data/rbi/turbopuffer/client.rbi +2 -2
  31. data/rbi/turbopuffer/models/attribute_schema_config.rbi +20 -3
  32. data/rbi/turbopuffer/models/copy_from_namespace_operation.rbi +133 -0
  33. data/rbi/turbopuffer/models/copy_from_namespace_operation_result.rbi +85 -0
  34. data/rbi/turbopuffer/models/highlight_config_params.rbi +85 -0
  35. data/rbi/turbopuffer/models/highlight_fragment_by.rbi +36 -0
  36. data/rbi/turbopuffer/models/highlight_offset_units.rbi +27 -0
  37. data/rbi/turbopuffer/models/namespace_explain_query_params.rbi +28 -0
  38. data/rbi/turbopuffer/models/namespace_metadata.rbi +50 -4
  39. data/rbi/turbopuffer/models/namespace_metadata_patch.rbi +18 -3
  40. data/rbi/turbopuffer/models/namespace_multi_query_params.rbi +69 -0
  41. data/rbi/turbopuffer/models/namespace_poll_copy_from_params.rbi +49 -0
  42. data/rbi/turbopuffer/models/namespace_query_params.rbi +28 -0
  43. data/rbi/turbopuffer/models/namespace_start_copy_from_params.rbi +113 -0
  44. data/rbi/turbopuffer/models/namespace_start_copy_from_response.rbi +30 -0
  45. data/rbi/turbopuffer/models/namespace_write_params.rbi +17 -0
  46. data/rbi/turbopuffer/models/operation_error.rbi +77 -0
  47. data/rbi/turbopuffer/models/rerank_limit.rbi +28 -0
  48. data/rbi/turbopuffer/models/rrf_params.rbi +22 -3
  49. data/rbi/turbopuffer/models/sharding_config.rbi +31 -0
  50. data/rbi/turbopuffer/models/write_result.rbi +159 -0
  51. data/rbi/turbopuffer/models.rbi +24 -0
  52. data/rbi/turbopuffer/resources/namespaces.rbi +87 -0
  53. data/sig/turbopuffer/models/attribute_schema_config.rbs +12 -3
  54. data/sig/turbopuffer/models/copy_from_namespace_operation.rbs +65 -0
  55. data/sig/turbopuffer/models/copy_from_namespace_operation_result.rbs +33 -0
  56. data/sig/turbopuffer/models/highlight_config_params.rbs +47 -0
  57. data/sig/turbopuffer/models/highlight_fragment_by.rbs +23 -0
  58. data/sig/turbopuffer/models/highlight_offset_units.rbs +15 -0
  59. data/sig/turbopuffer/models/namespace_explain_query_params.rbs +14 -0
  60. data/sig/turbopuffer/models/namespace_metadata.rbs +29 -4
  61. data/sig/turbopuffer/models/namespace_metadata_patch.rbs +12 -3
  62. data/sig/turbopuffer/models/namespace_multi_query_params.rbs +38 -0
  63. data/sig/turbopuffer/models/namespace_poll_copy_from_params.rbs +30 -0
  64. data/sig/turbopuffer/models/namespace_query_params.rbs +14 -0
  65. data/sig/turbopuffer/models/namespace_start_copy_from_params.rbs +56 -0
  66. data/sig/turbopuffer/models/namespace_start_copy_from_response.rbs +13 -0
  67. data/sig/turbopuffer/models/namespace_write_params.rbs +9 -0
  68. data/sig/turbopuffer/models/operation_error.rbs +34 -0
  69. data/sig/turbopuffer/models/rerank_limit.rbs +13 -0
  70. data/sig/turbopuffer/models/rrf_params.rbs +10 -3
  71. data/sig/turbopuffer/models/sharding_config.rbs +13 -0
  72. data/sig/turbopuffer/models/write_result.rbs +99 -0
  73. data/sig/turbopuffer/models.rbs +22 -0
  74. data/sig/turbopuffer/resources/namespaces.rbs +23 -0
  75. metadata +38 -2
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#poll_copy_from
6
+ class NamespacePollCopyFromParams < Turbopuffer::Internal::Type::BaseModel
7
+ extend Turbopuffer::Internal::Type::RequestParameters::Converter
8
+ include Turbopuffer::Internal::Type::RequestParameters
9
+
10
+ # @!attribute namespace
11
+ #
12
+ # @return [String, nil]
13
+ optional :namespace, String
14
+
15
+ # @!attribute token
16
+ #
17
+ # @return [String]
18
+ required :token, String
19
+
20
+ # @!method initialize(token:, namespace: nil, request_options: {})
21
+ # @param token [String]
22
+ # @param namespace [String]
23
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
24
+ end
25
+ end
26
+ 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
  #
@@ -64,6 +72,13 @@ module Turbopuffer
64
72
  # @return [Integer, Turbopuffer::Models::Limit, nil]
65
73
  optional :limit, union: -> { Turbopuffer::NamespaceQueryParams::Limit }
66
74
 
75
+ # @!attribute offset
76
+ # Number of documents to skip before returning results. Supported only in v2
77
+ # queries with an explicit `rank_by` and `top_k` or `limit`.
78
+ #
79
+ # @return [Integer, nil]
80
+ optional :offset, Integer
81
+
67
82
  # @!attribute rank_by
68
83
  # How to rank the documents in the namespace.
69
84
  #
@@ -82,7 +97,7 @@ module Turbopuffer
82
97
  # @return [Symbol, Turbopuffer::Models::VectorEncoding, nil]
83
98
  optional :vector_encoding, enum: -> { Turbopuffer::VectorEncoding }
84
99
 
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: {})
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: {})
86
101
  # Some parameter documentations has been truncated, see
87
102
  # {Turbopuffer::Models::NamespaceQueryParams} for more details.
88
103
  #
@@ -90,6 +105,8 @@ module Turbopuffer
90
105
  #
91
106
  # @param aggregate_by [Hash{Symbol=>Object}] Aggregations to compute over all documents in the namespace that match the filte
92
107
  #
108
+ # @param compute_attributes [Hash{Symbol=>Object}] Computes additional values on documents returned by a query. Each key is the nam
109
+ #
93
110
  # @param consistency [Turbopuffer::Models::NamespaceQueryParams::Consistency] The consistency level for a query.
94
111
  #
95
112
  # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
@@ -104,6 +121,8 @@ module Turbopuffer
104
121
  #
105
122
  # @param limit [Integer, Turbopuffer::Models::Limit] Limits the documents returned by a query.
106
123
  #
124
+ # @param offset [Integer] Number of documents to skip before returning results. Supported only in v2 queri
125
+ #
107
126
  # @param rank_by [Object] How to rank the documents in the namespace.
108
127
  #
109
128
  # @param top_k [Integer] The number of results to return.
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#start_copy_from
6
+ class NamespaceStartCopyFromParams < Turbopuffer::Internal::Type::BaseModel
7
+ extend Turbopuffer::Internal::Type::RequestParameters::Converter
8
+ include Turbopuffer::Internal::Type::RequestParameters
9
+
10
+ # @!attribute namespace
11
+ #
12
+ # @return [String, nil]
13
+ optional :namespace, String
14
+
15
+ # @!attribute source_namespace
16
+ # The namespace to copy documents from.
17
+ #
18
+ # @return [String]
19
+ required :source_namespace, String
20
+
21
+ # @!attribute dest_encryption
22
+ # (Optional) The encryption configuration for the destination namespace.
23
+ #
24
+ # @return [Turbopuffer::Models::Encryption::CustomerManaged, Turbopuffer::Models::Encryption::Default, nil]
25
+ optional :dest_encryption, union: -> { Turbopuffer::Encryption }
26
+
27
+ # @!attribute source_api_key
28
+ # (Optional) An API key for the organization containing the source namespace
29
+ #
30
+ # @return [String, nil]
31
+ optional :source_api_key, String
32
+
33
+ # @!attribute source_region
34
+ # (Optional) The region of the source namespace.
35
+ #
36
+ # @return [String, nil]
37
+ optional :source_region, String
38
+
39
+ # @!method initialize(source_namespace:, namespace: nil, dest_encryption: nil, source_api_key: nil, source_region: nil, request_options: {})
40
+ # @param source_namespace [String] The namespace to copy documents from.
41
+ #
42
+ # @param namespace [String]
43
+ #
44
+ # @param dest_encryption [Turbopuffer::Models::Encryption::CustomerManaged, Turbopuffer::Models::Encryption::Default] (Optional) The encryption configuration for the destination namespace.
45
+ #
46
+ # @param source_api_key [String] (Optional) An API key for the organization containing the source namespace
47
+ #
48
+ # @param source_region [String] (Optional) The region of the source namespace.
49
+ #
50
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#start_copy_from
6
+ class NamespaceStartCopyFromResponse < Turbopuffer::Internal::Type::BaseModel
7
+ # @!attribute token
8
+ # The token identifying the copy operation.
9
+ #
10
+ # @return [String]
11
+ required :token, String
12
+
13
+ # @!method initialize(token:)
14
+ # @param token [String] The token identifying the copy operation.
15
+ end
16
+ end
17
+ end
@@ -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
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class OperationError < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute detail
7
+ # The response to an unsuccessful request.
8
+ #
9
+ # @return [Turbopuffer::Models::OperationError::Detail]
10
+ required :detail, -> { Turbopuffer::OperationError::Detail }
11
+
12
+ # @!attribute status_code
13
+ # The HTTP status code of the operation's error.
14
+ #
15
+ # @return [Integer]
16
+ required :status_code, Integer
17
+
18
+ # @!method initialize(detail:, status_code:)
19
+ # @param detail [Turbopuffer::Models::OperationError::Detail] The response to an unsuccessful request.
20
+ #
21
+ # @param status_code [Integer] The HTTP status code of the operation's error.
22
+
23
+ # @see Turbopuffer::Models::OperationError#detail
24
+ class Detail < Turbopuffer::Internal::Type::BaseModel
25
+ # @!attribute error
26
+ # The error message.
27
+ #
28
+ # @return [String]
29
+ required :error, String
30
+
31
+ # @!attribute status
32
+ # The status of the request.
33
+ #
34
+ # @return [Symbol, :error]
35
+ required :status, const: :error
36
+
37
+ # @!method initialize(error:, status: :error)
38
+ # The response to an unsuccessful request.
39
+ #
40
+ # @param error [String] The error message.
41
+ #
42
+ # @param status [Symbol, :error] The status of the request.
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class RerankLimit < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute total
7
+ # Limits the total number of documents returned after reranking.
8
+ #
9
+ # @return [Integer]
10
+ required :total, Integer
11
+
12
+ # @!method initialize(total:)
13
+ # Limits the total number of reranked documents returned.
14
+ #
15
+ # @param total [Integer] Limits the total number of documents returned after reranking.
16
+ end
17
+ end
18
+ end
@@ -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
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class WriteResult < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute billing
7
+ # The billing information for a write request.
8
+ #
9
+ # @return [Turbopuffer::Models::WriteBilling]
10
+ required :billing, -> { Turbopuffer::WriteBilling }
11
+
12
+ # @!attribute message
13
+ # A message describing the result of the write request.
14
+ #
15
+ # @return [String]
16
+ required :message, String
17
+
18
+ # @!attribute rows_affected
19
+ # The number of rows affected by the write request.
20
+ #
21
+ # @return [Integer]
22
+ required :rows_affected, Integer
23
+
24
+ # @!attribute status
25
+ # The status of the request.
26
+ #
27
+ # @return [Symbol, :OK]
28
+ required :status, const: :OK
29
+
30
+ # @!attribute deleted_ids
31
+ # The IDs of documents that were deleted. Only included when `return_affected_ids`
32
+ # is true and at least one document was deleted.
33
+ #
34
+ # @return [Array<String, Integer>, nil]
35
+ optional :deleted_ids, -> { Turbopuffer::Internal::Type::ArrayOf[union: Turbopuffer::ID] }
36
+
37
+ # @!attribute patched_ids
38
+ # The IDs of documents that were patched. Only included when `return_affected_ids`
39
+ # is true and at least one document was patched.
40
+ #
41
+ # @return [Array<String, Integer>, nil]
42
+ optional :patched_ids, -> { Turbopuffer::Internal::Type::ArrayOf[union: Turbopuffer::ID] }
43
+
44
+ # @!attribute performance
45
+ # The performance information for a write request.
46
+ #
47
+ # @return [Turbopuffer::Models::WritePerformance, nil]
48
+ optional :performance, -> { Turbopuffer::WritePerformance }
49
+
50
+ # @!attribute rows_deleted
51
+ # The number of rows deleted by the write request.
52
+ #
53
+ # @return [Integer, nil]
54
+ optional :rows_deleted, Integer
55
+
56
+ # @!attribute rows_patched
57
+ # The number of rows patched by the write request.
58
+ #
59
+ # @return [Integer, nil]
60
+ optional :rows_patched, Integer
61
+
62
+ # @!attribute rows_remaining
63
+ # Whether more documents match the filter for partial operations.
64
+ #
65
+ # @return [Boolean, nil]
66
+ optional :rows_remaining, Turbopuffer::Internal::Type::Boolean
67
+
68
+ # @!attribute rows_upserted
69
+ # The number of rows upserted by the write request.
70
+ #
71
+ # @return [Integer, nil]
72
+ optional :rows_upserted, Integer
73
+
74
+ # @!attribute upserted_ids
75
+ # The IDs of documents that were upserted. Only included when
76
+ # `return_affected_ids` is true and at least one document was upserted.
77
+ #
78
+ # @return [Array<String, Integer>, nil]
79
+ optional :upserted_ids, -> { Turbopuffer::Internal::Type::ArrayOf[union: Turbopuffer::ID] }
80
+
81
+ # @!method initialize(billing:, message:, rows_affected:, deleted_ids: nil, patched_ids: nil, performance: nil, rows_deleted: nil, rows_patched: nil, rows_remaining: nil, rows_upserted: nil, upserted_ids: nil, status: :OK)
82
+ # Some parameter documentations has been truncated, see
83
+ # {Turbopuffer::Models::WriteResult} for more details.
84
+ #
85
+ # The response to a successful write request.
86
+ #
87
+ # @param billing [Turbopuffer::Models::WriteBilling] The billing information for a write request.
88
+ #
89
+ # @param message [String] A message describing the result of the write request.
90
+ #
91
+ # @param rows_affected [Integer] The number of rows affected by the write request.
92
+ #
93
+ # @param deleted_ids [Array<String, Integer>] The IDs of documents that were deleted. Only included when `return_affected_ids`
94
+ #
95
+ # @param patched_ids [Array<String, Integer>] The IDs of documents that were patched. Only included when `return_affected_ids`
96
+ #
97
+ # @param performance [Turbopuffer::Models::WritePerformance] The performance information for a write request.
98
+ #
99
+ # @param rows_deleted [Integer] The number of rows deleted by the write request.
100
+ #
101
+ # @param rows_patched [Integer] The number of rows patched by the write request.
102
+ #
103
+ # @param rows_remaining [Boolean] Whether more documents match the filter for partial operations.
104
+ #
105
+ # @param rows_upserted [Integer] The number of rows upserted by the write request.
106
+ #
107
+ # @param upserted_ids [Array<String, Integer>] The IDs of documents that were upserted. Only included when `return_affected_ids
108
+ #
109
+ # @param status [Symbol, :OK] The status of the request.
110
+ end
111
+ end
112
+ end
@@ -64,6 +64,10 @@ module Turbopuffer
64
64
 
65
65
  ContainsAnyTokenFilterParams = Turbopuffer::Models::ContainsAnyTokenFilterParams
66
66
 
67
+ CopyFromNamespaceOperation = Turbopuffer::Models::CopyFromNamespaceOperation
68
+
69
+ CopyFromNamespaceOperationResult = Turbopuffer::Models::CopyFromNamespaceOperationResult
70
+
67
71
  CopyFromNamespaceParams = Turbopuffer::Models::CopyFromNamespaceParams
68
72
 
69
73
  DecayParams = Turbopuffer::Models::DecayParams
@@ -82,6 +86,12 @@ module Turbopuffer
82
86
 
83
87
  FuzzyParams = Turbopuffer::Models::FuzzyParams
84
88
 
89
+ HighlightConfigParams = Turbopuffer::Models::HighlightConfigParams
90
+
91
+ HighlightFragmentBy = Turbopuffer::Models::HighlightFragmentBy
92
+
93
+ HighlightOffsetUnits = Turbopuffer::Models::HighlightOffsetUnits
94
+
85
95
  ID = Turbopuffer::Models::ID
86
96
 
87
97
  IncludeAttributes = Turbopuffer::Models::IncludeAttributes
@@ -108,12 +118,16 @@ module Turbopuffer
108
118
 
109
119
  NamespaceMultiQueryParams = Turbopuffer::Models::NamespaceMultiQueryParams
110
120
 
121
+ NamespacePollCopyFromParams = Turbopuffer::Models::NamespacePollCopyFromParams
122
+
111
123
  NamespaceQueryParams = Turbopuffer::Models::NamespaceQueryParams
112
124
 
113
125
  NamespaceRecallParams = Turbopuffer::Models::NamespaceRecallParams
114
126
 
115
127
  NamespaceSchemaParams = Turbopuffer::Models::NamespaceSchemaParams
116
128
 
129
+ NamespaceStartCopyFromParams = Turbopuffer::Models::NamespaceStartCopyFromParams
130
+
117
131
  NamespaceSummary = Turbopuffer::Models::NamespaceSummary
118
132
 
119
133
  NamespaceUpdateMetadataParams = Turbopuffer::Models::NamespaceUpdateMetadataParams
@@ -122,18 +136,24 @@ module Turbopuffer
122
136
 
123
137
  NamespaceWriteParams = Turbopuffer::Models::NamespaceWriteParams
124
138
 
139
+ OperationError = Turbopuffer::Models::OperationError
140
+
125
141
  PinningConfig = Turbopuffer::Models::PinningConfig
126
142
 
127
143
  QueryBilling = Turbopuffer::Models::QueryBilling
128
144
 
129
145
  QueryPerformance = Turbopuffer::Models::QueryPerformance
130
146
 
147
+ RerankLimit = Turbopuffer::Models::RerankLimit
148
+
131
149
  Row = Turbopuffer::Models::Row
132
150
 
133
151
  RrfParams = Turbopuffer::Models::RrfParams
134
152
 
135
153
  SaturateParams = Turbopuffer::Models::SaturateParams
136
154
 
155
+ ShardingConfig = Turbopuffer::Models::ShardingConfig
156
+
137
157
  SparseDistanceMetric = Turbopuffer::Models::SparseDistanceMetric
138
158
 
139
159
  Tokenizer = Turbopuffer::Models::Tokenizer
@@ -145,4 +165,6 @@ module Turbopuffer
145
165
  WriteBilling = Turbopuffer::Models::WriteBilling
146
166
 
147
167
  WritePerformance = Turbopuffer::Models::WritePerformance
168
+
169
+ WriteResult = Turbopuffer::Models::WriteResult
148
170
  end
@@ -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, offset: 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.
@@ -118,6 +120,8 @@ module Turbopuffer
118
120
  #
119
121
  # @param limit [Integer, Turbopuffer::Models::Limit] Body param: Limits the documents returned by a query.
120
122
  #
123
+ # @param offset [Integer] Body param: Number of documents to skip before returning results. Supported only
124
+ #
121
125
  # @param rank_by [Object] Body param: How to rank the documents in the namespace.
122
126
  #
123
127
  # @param top_k [Integer] Body param: The number of results to return.
@@ -199,7 +203,7 @@ module Turbopuffer
199
203
  #
200
204
  # Issue multiple concurrent queries filter or search documents.
201
205
  #
202
- # @overload multi_query(queries:, namespace: nil, consistency: nil, rerank_by: nil, vector_encoding: nil, request_options: {})
206
+ # @overload multi_query(queries:, namespace: nil, consistency: nil, limit: nil, offset: nil, rerank_by: nil, vector_encoding: nil, request_options: {})
203
207
  #
204
208
  # @param queries [Array<Turbopuffer::Models::NamespaceMultiQueryParams::Query>] Body param
205
209
  #
@@ -207,6 +211,10 @@ module Turbopuffer
207
211
  #
208
212
  # @param consistency [Turbopuffer::Models::NamespaceMultiQueryParams::Consistency] Body param: The consistency level for a query.
209
213
  #
214
+ # @param limit [Integer, Turbopuffer::Models::RerankLimit] Body param: Limits the total number of reranked documents returned.
215
+ #
216
+ # @param offset [Integer] Body param: Number of reranked documents to skip before returning results. Requi
217
+ #
210
218
  # @param rerank_by [Object] Body param: How to combine the rows returned by each sub-query into a single ran
211
219
  #
212
220
  # @param vector_encoding [Symbol, Turbopuffer::Models::VectorEncoding] Body param: The encoding to use for vectors in the response.
@@ -231,17 +239,46 @@ module Turbopuffer
231
239
  )
232
240
  end
233
241
 
242
+ # Retrieve the current status of a copy operation.
243
+ #
244
+ # @overload poll_copy_from(token, namespace: nil, request_options: {})
245
+ #
246
+ # @param token [String] The operation token obtained when starting the copy.
247
+ #
248
+ # @param namespace [String] The name of the namespace.
249
+ #
250
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}, nil]
251
+ #
252
+ # @return [Turbopuffer::Models::CopyFromNamespaceOperation::Running, Turbopuffer::Models::CopyFromNamespaceOperation::Finished]
253
+ #
254
+ # @see Turbopuffer::Models::NamespacePollCopyFromParams
255
+ def poll_copy_from(token, params = {})
256
+ parsed, options = Turbopuffer::NamespacePollCopyFromParams.dump_request(params)
257
+ namespace =
258
+ parsed.delete(:namespace) do
259
+ @client.default_namespace
260
+ end
261
+ @client.request(
262
+ method: :get,
263
+ path: ["v1/namespaces/%1$s/operations/%2$s?stainless_overload=pollCopyFrom", namespace, token],
264
+ model: Turbopuffer::CopyFromNamespaceOperation,
265
+ options: options
266
+ )
267
+ end
268
+
234
269
  # Some parameter documentations has been truncated, see
235
270
  # {Turbopuffer::Models::NamespaceQueryParams} for more details.
236
271
  #
237
272
  # Query, filter, full-text search and vector search documents.
238
273
  #
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: {})
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: {})
240
275
  #
241
276
  # @param namespace [String] Path param: The name of the namespace.
242
277
  #
243
278
  # @param aggregate_by [Hash{Symbol=>Object}] Body param: Aggregations to compute over all documents in the namespace that mat
244
279
  #
280
+ # @param compute_attributes [Hash{Symbol=>Object}] Body param: Computes additional values on documents returned by a query. Each ke
281
+ #
245
282
  # @param consistency [Turbopuffer::Models::NamespaceQueryParams::Consistency] Body param: The consistency level for a query.
246
283
  #
247
284
  # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] Body param: A function used to calculate vector similarity.
@@ -256,6 +293,8 @@ module Turbopuffer
256
293
  #
257
294
  # @param limit [Integer, Turbopuffer::Models::Limit] Body param: Limits the documents returned by a query.
258
295
  #
296
+ # @param offset [Integer] Body param: Number of documents to skip before returning results. Supported only
297
+ #
259
298
  # @param rank_by [Object] Body param: How to rank the documents in the namespace.
260
299
  #
261
300
  # @param top_k [Integer] Body param: The number of results to return.
@@ -346,17 +385,58 @@ module Turbopuffer
346
385
  )
347
386
  end
348
387
 
388
+ # Some parameter documentations has been truncated, see
389
+ # {Turbopuffer::Models::NamespaceStartCopyFromParams} for more details.
390
+ #
391
+ # Start copying all documents from another namespace into this one. Returns an
392
+ # operation token without waiting for the copy to finish. Use the token to poll
393
+ # for progress and the result.
394
+ #
395
+ # @overload start_copy_from(source_namespace:, namespace: nil, dest_encryption: nil, source_api_key: nil, source_region: nil, request_options: {})
396
+ #
397
+ # @param source_namespace [String] Body param: The namespace to copy documents from.
398
+ #
399
+ # @param namespace [String] Path param: The name of the namespace.
400
+ #
401
+ # @param dest_encryption [Turbopuffer::Models::Encryption::CustomerManaged, Turbopuffer::Models::Encryption::Default] Body param: (Optional) The encryption configuration for the destination namespac
402
+ #
403
+ # @param source_api_key [String] Body param: (Optional) An API key for the organization containing the source nam
404
+ #
405
+ # @param source_region [String] Body param: (Optional) The region of the source namespace.
406
+ #
407
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}, nil]
408
+ #
409
+ # @return [Turbopuffer::Models::NamespaceStartCopyFromResponse]
410
+ #
411
+ # @see Turbopuffer::Models::NamespaceStartCopyFromParams
412
+ def start_copy_from(params)
413
+ parsed, options = Turbopuffer::NamespaceStartCopyFromParams.dump_request(params)
414
+ namespace =
415
+ parsed.delete(:namespace) do
416
+ @client.default_namespace
417
+ end
418
+ @client.request(
419
+ method: :post,
420
+ path: ["v2/namespaces/%1$s/async?stainless_overload=startCopyFrom", namespace],
421
+ body: {copy_from_namespace: parsed},
422
+ model: Turbopuffer::Models::NamespaceStartCopyFromResponse,
423
+ options: options
424
+ )
425
+ end
426
+
349
427
  # Some parameter documentations has been truncated, see
350
428
  # {Turbopuffer::Models::NamespaceUpdateMetadataParams} for more details.
351
429
  #
352
430
  # Update metadata configuration for a namespace.
353
431
  #
354
- # @overload update_metadata(namespace: nil, pinning: nil, request_options: {})
432
+ # @overload update_metadata(namespace: nil, pinning: nil, read_only: nil, request_options: {})
355
433
  #
356
434
  # @param namespace [String] Path param: The name of the namespace.
357
435
  #
358
436
  # @param pinning [Boolean, Turbopuffer::Models::PinningConfig, nil] Body param: Configuration for namespace pinning.
359
437
  #
438
+ # @param read_only [Boolean] Body param: Set to `true` to reject document and schema writes, or `false` to al
439
+ #
360
440
  # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}, nil]
361
441
  #
362
442
  # @return [Turbopuffer::Models::NamespaceMetadata]
@@ -410,7 +490,7 @@ module Turbopuffer
410
490
  #
411
491
  # Create, update, or delete documents.
412
492
  #
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: {})
493
+ # @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
494
  #
415
495
  # @param namespace [String] Path param: The name of the namespace.
416
496
  #
@@ -446,6 +526,8 @@ module Turbopuffer
446
526
  #
447
527
  # @param schema [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig}] Body param: The schema of the attributes attached to the documents.
448
528
  #
529
+ # @param sharding [Turbopuffer::Models::ShardingConfig] Body param: Configuration for namespace sharding, which partitions a namespace's
530
+ #
449
531
  # @param upsert_columns [Turbopuffer::Models::Columns] Body param: A list of documents in columnar format. Each key is a column name, m
450
532
  #
451
533
  # @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.5.0"
5
5
  end