turbopuffer 0.1.0 → 1.2.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 (207) hide show
  1. checksums.yaml +4 -4
  2. data/.ignore +2 -0
  3. data/CHANGELOG.md +205 -0
  4. data/README.md +270 -40
  5. data/SECURITY.md +27 -0
  6. data/lib/turbopuffer/client.rb +122 -16
  7. data/lib/turbopuffer/errors.rb +228 -0
  8. data/lib/turbopuffer/file_part.rb +55 -0
  9. data/lib/turbopuffer/internal/namespace_page.rb +86 -0
  10. data/lib/turbopuffer/internal/transport/base_client.rb +567 -0
  11. data/lib/turbopuffer/internal/transport/pooled_net_requester.rb +201 -0
  12. data/lib/turbopuffer/internal/type/array_of.rb +168 -0
  13. data/lib/turbopuffer/internal/type/base_model.rb +529 -0
  14. data/lib/turbopuffer/internal/type/base_page.rb +55 -0
  15. data/lib/turbopuffer/internal/type/boolean.rb +77 -0
  16. data/lib/turbopuffer/internal/type/converter.rb +327 -0
  17. data/lib/turbopuffer/internal/type/enum.rb +152 -0
  18. data/lib/turbopuffer/internal/type/file_input.rb +108 -0
  19. data/lib/turbopuffer/internal/type/hash_of.rb +188 -0
  20. data/lib/turbopuffer/internal/type/request_parameters.rb +42 -0
  21. data/lib/turbopuffer/internal/type/union.rb +254 -0
  22. data/lib/turbopuffer/internal/type/unknown.rb +81 -0
  23. data/lib/turbopuffer/internal/util.rb +914 -0
  24. data/lib/turbopuffer/internal.rb +20 -0
  25. data/lib/turbopuffer/models/aggregation_group.rb +8 -0
  26. data/lib/turbopuffer/models/attribute_schema.rb +19 -0
  27. data/lib/turbopuffer/models/attribute_schema_config.rb +56 -0
  28. data/lib/turbopuffer/models/attribute_type.rb +7 -0
  29. data/lib/turbopuffer/models/client_namespaces_params.rb +38 -0
  30. data/lib/turbopuffer/models/columns.rb +64 -0
  31. data/lib/turbopuffer/models/distance_metric.rb +19 -0
  32. data/lib/turbopuffer/models/full_text_search.rb +20 -0
  33. data/lib/turbopuffer/models/full_text_search_config.rb +83 -0
  34. data/lib/turbopuffer/models/id.rb +19 -0
  35. data/lib/turbopuffer/models/include_attributes.rb +22 -0
  36. data/lib/turbopuffer/models/language.rb +32 -0
  37. data/lib/turbopuffer/models/namespace_delete_all_params.rb +20 -0
  38. data/lib/turbopuffer/models/namespace_delete_all_response.rb +19 -0
  39. data/lib/turbopuffer/models/namespace_explain_query_params.rb +137 -0
  40. data/lib/turbopuffer/models/namespace_explain_query_response.rb +19 -0
  41. data/lib/turbopuffer/models/namespace_hint_cache_warm_params.rb +20 -0
  42. data/lib/turbopuffer/models/namespace_hint_cache_warm_response.rb +26 -0
  43. data/lib/turbopuffer/models/namespace_metadata.rb +43 -0
  44. data/lib/turbopuffer/models/namespace_metadata_params.rb +20 -0
  45. data/lib/turbopuffer/models/namespace_multi_query_params.rb +73 -0
  46. data/lib/turbopuffer/models/namespace_multi_query_response.rb +58 -0
  47. data/lib/turbopuffer/models/namespace_query_params.rb +137 -0
  48. data/lib/turbopuffer/models/namespace_query_response.rb +49 -0
  49. data/lib/turbopuffer/models/namespace_recall_params.rb +66 -0
  50. data/lib/turbopuffer/models/namespace_recall_response.rb +68 -0
  51. data/lib/turbopuffer/models/namespace_schema_params.rb +20 -0
  52. data/lib/turbopuffer/models/namespace_schema_response.rb +8 -0
  53. data/lib/turbopuffer/models/namespace_summary.rb +19 -0
  54. data/lib/turbopuffer/models/namespace_update_schema_params.rb +29 -0
  55. data/lib/turbopuffer/models/namespace_update_schema_response.rb +9 -0
  56. data/lib/turbopuffer/models/namespace_write_params.rb +158 -0
  57. data/lib/turbopuffer/models/namespace_write_response.rb +67 -0
  58. data/lib/turbopuffer/models/query.rb +81 -0
  59. data/lib/turbopuffer/models/query_billing.rb +26 -0
  60. data/lib/turbopuffer/models/query_performance.rb +63 -0
  61. data/lib/turbopuffer/models/row.rb +46 -0
  62. data/lib/turbopuffer/models/tokenizer.rb +19 -0
  63. data/lib/turbopuffer/models/vector.rb +22 -0
  64. data/lib/turbopuffer/models/vector_encoding.rb +16 -0
  65. data/lib/turbopuffer/models/write_billing.rb +26 -0
  66. data/lib/turbopuffer/models.rb +106 -0
  67. data/lib/turbopuffer/namespace.rb +14 -50
  68. data/lib/turbopuffer/request_options.rb +77 -0
  69. data/lib/turbopuffer/resources/namespaces.rb +366 -0
  70. data/lib/turbopuffer/version.rb +1 -1
  71. data/lib/turbopuffer.rb +92 -4
  72. data/manifest.yaml +15 -0
  73. data/rbi/turbopuffer/client.rbi +91 -0
  74. data/rbi/turbopuffer/errors.rbi +205 -0
  75. data/rbi/turbopuffer/file_part.rbi +37 -0
  76. data/rbi/turbopuffer/internal/namespace_page.rbi +22 -0
  77. data/rbi/turbopuffer/internal/transport/base_client.rbi +297 -0
  78. data/rbi/turbopuffer/internal/transport/pooled_net_requester.rbi +80 -0
  79. data/rbi/turbopuffer/internal/type/array_of.rbi +104 -0
  80. data/rbi/turbopuffer/internal/type/base_model.rbi +304 -0
  81. data/rbi/turbopuffer/internal/type/base_page.rbi +43 -0
  82. data/rbi/turbopuffer/internal/type/boolean.rbi +58 -0
  83. data/rbi/turbopuffer/internal/type/converter.rbi +216 -0
  84. data/rbi/turbopuffer/internal/type/enum.rbi +82 -0
  85. data/rbi/turbopuffer/internal/type/file_input.rbi +59 -0
  86. data/rbi/turbopuffer/internal/type/hash_of.rbi +104 -0
  87. data/rbi/turbopuffer/internal/type/request_parameters.rbi +31 -0
  88. data/rbi/turbopuffer/internal/type/union.rbi +128 -0
  89. data/rbi/turbopuffer/internal/type/unknown.rbi +58 -0
  90. data/rbi/turbopuffer/internal/util.rbi +487 -0
  91. data/rbi/turbopuffer/internal.rbi +18 -0
  92. data/rbi/turbopuffer/models/aggregation_group.rbi +13 -0
  93. data/rbi/turbopuffer/models/attribute_schema.rbi +17 -0
  94. data/rbi/turbopuffer/models/attribute_schema_config.rbi +103 -0
  95. data/rbi/turbopuffer/models/attribute_type.rbi +7 -0
  96. data/rbi/turbopuffer/models/client_namespaces_params.rbi +71 -0
  97. data/rbi/turbopuffer/models/columns.rbi +82 -0
  98. data/rbi/turbopuffer/models/distance_metric.rbi +27 -0
  99. data/rbi/turbopuffer/models/full_text_search.rbi +19 -0
  100. data/rbi/turbopuffer/models/full_text_search_config.rbi +133 -0
  101. data/rbi/turbopuffer/models/id.rbi +16 -0
  102. data/rbi/turbopuffer/models/include_attributes.rbi +24 -0
  103. data/rbi/turbopuffer/models/language.rbi +36 -0
  104. data/rbi/turbopuffer/models/namespace_delete_all_params.rbi +41 -0
  105. data/rbi/turbopuffer/models/namespace_delete_all_response.rbi +31 -0
  106. data/rbi/turbopuffer/models/namespace_explain_query_params.rbi +273 -0
  107. data/rbi/turbopuffer/models/namespace_explain_query_response.rbi +34 -0
  108. data/rbi/turbopuffer/models/namespace_hint_cache_warm_params.rbi +41 -0
  109. data/rbi/turbopuffer/models/namespace_hint_cache_warm_response.rbi +38 -0
  110. data/rbi/turbopuffer/models/namespace_metadata.rbi +62 -0
  111. data/rbi/turbopuffer/models/namespace_metadata_params.rbi +41 -0
  112. data/rbi/turbopuffer/models/namespace_multi_query_params.rbi +175 -0
  113. data/rbi/turbopuffer/models/namespace_multi_query_response.rbi +121 -0
  114. data/rbi/turbopuffer/models/namespace_query_params.rbi +267 -0
  115. data/rbi/turbopuffer/models/namespace_query_response.rbi +84 -0
  116. data/rbi/turbopuffer/models/namespace_recall_params.rbi +106 -0
  117. data/rbi/turbopuffer/models/namespace_recall_response.rbi +134 -0
  118. data/rbi/turbopuffer/models/namespace_schema_params.rbi +41 -0
  119. data/rbi/turbopuffer/models/namespace_schema_response.rbi +11 -0
  120. data/rbi/turbopuffer/models/namespace_summary.rbi +28 -0
  121. data/rbi/turbopuffer/models/namespace_update_schema_params.rbi +80 -0
  122. data/rbi/turbopuffer/models/namespace_update_schema_response.rbi +11 -0
  123. data/rbi/turbopuffer/models/namespace_write_params.rbi +290 -0
  124. data/rbi/turbopuffer/models/namespace_write_response.rbi +101 -0
  125. data/rbi/turbopuffer/models/query.rbi +132 -0
  126. data/rbi/turbopuffer/models/query_billing.rbi +46 -0
  127. data/rbi/turbopuffer/models/query_performance.rbi +82 -0
  128. data/rbi/turbopuffer/models/row.rbi +47 -0
  129. data/rbi/turbopuffer/models/tokenizer.rbi +24 -0
  130. data/rbi/turbopuffer/models/vector.rbi +22 -0
  131. data/rbi/turbopuffer/models/vector_encoding.rbi +22 -0
  132. data/rbi/turbopuffer/models/write_billing.rbi +49 -0
  133. data/rbi/turbopuffer/models.rbi +72 -0
  134. data/rbi/turbopuffer/namespace.rbi +8 -0
  135. data/rbi/turbopuffer/request_options.rbi +59 -0
  136. data/rbi/turbopuffer/resources/namespaces.rbi +304 -0
  137. data/rbi/turbopuffer/version.rbi +5 -0
  138. data/sig/turbopuffer/client.rbs +41 -0
  139. data/sig/turbopuffer/errors.rbs +117 -0
  140. data/sig/turbopuffer/file_part.rbs +21 -0
  141. data/sig/turbopuffer/internal/namespace_page.rbs +13 -0
  142. data/sig/turbopuffer/internal/transport/base_client.rbs +131 -0
  143. data/sig/turbopuffer/internal/transport/pooled_net_requester.rbs +45 -0
  144. data/sig/turbopuffer/internal/type/array_of.rbs +48 -0
  145. data/sig/turbopuffer/internal/type/base_model.rbs +102 -0
  146. data/sig/turbopuffer/internal/type/base_page.rbs +24 -0
  147. data/sig/turbopuffer/internal/type/boolean.rbs +26 -0
  148. data/sig/turbopuffer/internal/type/converter.rbs +79 -0
  149. data/sig/turbopuffer/internal/type/enum.rbs +32 -0
  150. data/sig/turbopuffer/internal/type/file_input.rbs +25 -0
  151. data/sig/turbopuffer/internal/type/hash_of.rbs +48 -0
  152. data/sig/turbopuffer/internal/type/request_parameters.rbs +19 -0
  153. data/sig/turbopuffer/internal/type/union.rbs +52 -0
  154. data/sig/turbopuffer/internal/type/unknown.rbs +26 -0
  155. data/sig/turbopuffer/internal/util.rbs +185 -0
  156. data/sig/turbopuffer/internal.rbs +9 -0
  157. data/sig/turbopuffer/models/aggregation_group.rbs +7 -0
  158. data/sig/turbopuffer/models/attribute_schema.rbs +11 -0
  159. data/sig/turbopuffer/models/attribute_schema_config.rbs +52 -0
  160. data/sig/turbopuffer/models/attribute_type.rbs +5 -0
  161. data/sig/turbopuffer/models/client_namespaces_params.rbs +38 -0
  162. data/sig/turbopuffer/models/columns.rbs +42 -0
  163. data/sig/turbopuffer/models/distance_metric.rbs +17 -0
  164. data/sig/turbopuffer/models/full_text_search.rbs +11 -0
  165. data/sig/turbopuffer/models/full_text_search_config.rbs +75 -0
  166. data/sig/turbopuffer/models/id.rbs +11 -0
  167. data/sig/turbopuffer/models/include_attributes.rbs +13 -0
  168. data/sig/turbopuffer/models/language.rbs +48 -0
  169. data/sig/turbopuffer/models/namespace_delete_all_params.rbs +25 -0
  170. data/sig/turbopuffer/models/namespace_delete_all_response.rbs +13 -0
  171. data/sig/turbopuffer/models/namespace_explain_query_params.rbs +141 -0
  172. data/sig/turbopuffer/models/namespace_explain_query_response.rbs +15 -0
  173. data/sig/turbopuffer/models/namespace_hint_cache_warm_params.rbs +25 -0
  174. data/sig/turbopuffer/models/namespace_hint_cache_warm_response.rbs +18 -0
  175. data/sig/turbopuffer/models/namespace_metadata.rbs +35 -0
  176. data/sig/turbopuffer/models/namespace_metadata_params.rbs +25 -0
  177. data/sig/turbopuffer/models/namespace_multi_query_params.rbs +86 -0
  178. data/sig/turbopuffer/models/namespace_multi_query_response.rbs +65 -0
  179. data/sig/turbopuffer/models/namespace_query_params.rbs +139 -0
  180. data/sig/turbopuffer/models/namespace_query_response.rbs +48 -0
  181. data/sig/turbopuffer/models/namespace_recall_params.rbs +63 -0
  182. data/sig/turbopuffer/models/namespace_recall_response.rbs +61 -0
  183. data/sig/turbopuffer/models/namespace_schema_params.rbs +25 -0
  184. data/sig/turbopuffer/models/namespace_schema_response.rbs +8 -0
  185. data/sig/turbopuffer/models/namespace_summary.rbs +13 -0
  186. data/sig/turbopuffer/models/namespace_update_schema_params.rbs +37 -0
  187. data/sig/turbopuffer/models/namespace_update_schema_response.rbs +8 -0
  188. data/sig/turbopuffer/models/namespace_write_params.rbs +156 -0
  189. data/sig/turbopuffer/models/namespace_write_response.rbs +56 -0
  190. data/sig/turbopuffer/models/query.rbs +75 -0
  191. data/sig/turbopuffer/models/query_billing.rbs +25 -0
  192. data/sig/turbopuffer/models/query_performance.rbs +45 -0
  193. data/sig/turbopuffer/models/row.rbs +24 -0
  194. data/sig/turbopuffer/models/tokenizer.rbs +16 -0
  195. data/sig/turbopuffer/models/vector.rbs +13 -0
  196. data/sig/turbopuffer/models/vector_encoding.rbs +14 -0
  197. data/sig/turbopuffer/models/write_billing.rbs +27 -0
  198. data/sig/turbopuffer/models.rbs +65 -0
  199. data/sig/turbopuffer/namespace.rbs +5 -0
  200. data/sig/turbopuffer/request_options.rbs +36 -0
  201. data/sig/turbopuffer/resources/namespaces.rbs +99 -0
  202. data/sig/turbopuffer/version.rbs +3 -0
  203. metadata +218 -29
  204. data/.standard.yml +0 -3
  205. data/LICENSE.txt +0 -21
  206. data/Rakefile +0 -10
  207. data/sig/turbopuffer.rbs +0 -4
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#metadata
6
+ class NamespaceMetadata < Turbopuffer::Internal::Type::BaseModel
7
+ # @!attribute approx_logical_bytes
8
+ # The approximate number of logical bytes in the namespace.
9
+ #
10
+ # @return [Integer]
11
+ required :approx_logical_bytes, Integer
12
+
13
+ # @!attribute approx_row_count
14
+ # The approximate number of rows in the namespace.
15
+ #
16
+ # @return [Integer]
17
+ required :approx_row_count, Integer
18
+
19
+ # @!attribute created_at
20
+ # The timestamp when the namespace was created.
21
+ #
22
+ # @return [Time]
23
+ required :created_at, Time
24
+
25
+ # @!attribute schema
26
+ # The schema of the namespace.
27
+ #
28
+ # @return [Hash{Symbol=>Turbopuffer::Models::AttributeSchemaConfig}]
29
+ required :schema, -> { Turbopuffer::Internal::Type::HashOf[Turbopuffer::AttributeSchemaConfig] }
30
+
31
+ # @!method initialize(approx_logical_bytes:, approx_row_count:, created_at:, schema:)
32
+ # Metadata about a namespace.
33
+ #
34
+ # @param approx_logical_bytes [Integer] The approximate number of logical bytes in the namespace.
35
+ #
36
+ # @param approx_row_count [Integer] The approximate number of rows in the namespace.
37
+ #
38
+ # @param created_at [Time] The timestamp when the namespace was created.
39
+ #
40
+ # @param schema [Hash{Symbol=>Turbopuffer::Models::AttributeSchemaConfig}] The schema of the namespace.
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#metadata
6
+ class NamespaceMetadataParams < 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
+ # @!method initialize(namespace: nil, request_options: {})
16
+ # @param namespace [String]
17
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#multi_query
6
+ class NamespaceMultiQueryParams < 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 queries
16
+ #
17
+ # @return [Array<Turbopuffer::Models::Query>]
18
+ required :queries, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Query] }
19
+
20
+ # @!attribute consistency
21
+ # The consistency level for a query.
22
+ #
23
+ # @return [Turbopuffer::Models::NamespaceMultiQueryParams::Consistency, nil]
24
+ optional :consistency, -> { Turbopuffer::NamespaceMultiQueryParams::Consistency }
25
+
26
+ # @!attribute vector_encoding
27
+ # The encoding to use for vectors in the response.
28
+ #
29
+ # @return [Symbol, Turbopuffer::Models::VectorEncoding, nil]
30
+ optional :vector_encoding, enum: -> { Turbopuffer::VectorEncoding }
31
+
32
+ # @!method initialize(queries:, namespace: nil, consistency: nil, vector_encoding: nil, request_options: {})
33
+ # @param queries [Array<Turbopuffer::Models::Query>]
34
+ #
35
+ # @param namespace [String]
36
+ #
37
+ # @param consistency [Turbopuffer::Models::NamespaceMultiQueryParams::Consistency] The consistency level for a query.
38
+ #
39
+ # @param vector_encoding [Symbol, Turbopuffer::Models::VectorEncoding] The encoding to use for vectors in the response.
40
+ #
41
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
42
+
43
+ class Consistency < Turbopuffer::Internal::Type::BaseModel
44
+ # @!attribute level
45
+ # The query's consistency level.
46
+ #
47
+ # @return [Symbol, Turbopuffer::Models::NamespaceMultiQueryParams::Consistency::Level, nil]
48
+ optional :level, enum: -> { Turbopuffer::NamespaceMultiQueryParams::Consistency::Level }
49
+
50
+ # @!method initialize(level: nil)
51
+ # The consistency level for a query.
52
+ #
53
+ # @param level [Symbol, Turbopuffer::Models::NamespaceMultiQueryParams::Consistency::Level] The query's consistency level.
54
+
55
+ # The query's consistency level.
56
+ #
57
+ # @see Turbopuffer::Models::NamespaceMultiQueryParams::Consistency#level
58
+ module Level
59
+ extend Turbopuffer::Internal::Type::Enum
60
+
61
+ # Strong consistency. Requires a round-trip to object storage to fetch the latest writes.
62
+ STRONG = :strong
63
+
64
+ # Eventual consistency. Does not require a round-trip to object storage, but may not see the latest writes.
65
+ EVENTUAL = :eventual
66
+
67
+ # @!method self.values
68
+ # @return [Array<Symbol>]
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#multi_query
6
+ class NamespaceMultiQueryResponse < Turbopuffer::Internal::Type::BaseModel
7
+ # @!attribute billing
8
+ # The billing information for a query.
9
+ #
10
+ # @return [Turbopuffer::Models::QueryBilling]
11
+ required :billing, -> { Turbopuffer::QueryBilling }
12
+
13
+ # @!attribute performance
14
+ # The performance information for a query.
15
+ #
16
+ # @return [Turbopuffer::Models::QueryPerformance]
17
+ required :performance, -> { Turbopuffer::QueryPerformance }
18
+
19
+ # @!attribute results
20
+ #
21
+ # @return [Array<Turbopuffer::Models::NamespaceMultiQueryResponse::Result>]
22
+ required :results,
23
+ -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Models::NamespaceMultiQueryResponse::Result] }
24
+
25
+ # @!method initialize(billing:, performance:, results:)
26
+ # The result of a multi-query.
27
+ #
28
+ # @param billing [Turbopuffer::Models::QueryBilling] The billing information for a query.
29
+ #
30
+ # @param performance [Turbopuffer::Models::QueryPerformance] The performance information for a query.
31
+ #
32
+ # @param results [Array<Turbopuffer::Models::NamespaceMultiQueryResponse::Result>]
33
+
34
+ class Result < Turbopuffer::Internal::Type::BaseModel
35
+ # @!attribute aggregation_groups
36
+ #
37
+ # @return [Array<Hash{Symbol=>Object}>, nil]
38
+ optional :aggregation_groups,
39
+ Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]]
40
+
41
+ # @!attribute aggregations
42
+ #
43
+ # @return [Hash{Symbol=>Object}, nil]
44
+ optional :aggregations, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
45
+
46
+ # @!attribute rows
47
+ #
48
+ # @return [Array<Turbopuffer::Models::Row>, nil]
49
+ optional :rows, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
50
+
51
+ # @!method initialize(aggregation_groups: nil, aggregations: nil, rows: nil)
52
+ # @param aggregation_groups [Array<Hash{Symbol=>Object}>]
53
+ # @param aggregations [Hash{Symbol=>Object}]
54
+ # @param rows [Array<Turbopuffer::Models::Row>]
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,137 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#query
6
+ class NamespaceQueryParams < 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 aggregate_by
16
+ # Aggregations to compute over all documents in the namespace that match the
17
+ # filters.
18
+ #
19
+ # @return [Hash{Symbol=>Object}, nil]
20
+ optional :aggregate_by, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
21
+
22
+ # @!attribute consistency
23
+ # The consistency level for a query.
24
+ #
25
+ # @return [Turbopuffer::Models::NamespaceQueryParams::Consistency, nil]
26
+ optional :consistency, -> { Turbopuffer::NamespaceQueryParams::Consistency }
27
+
28
+ # @!attribute distance_metric
29
+ # A function used to calculate vector similarity.
30
+ #
31
+ # @return [Symbol, Turbopuffer::Models::DistanceMetric, nil]
32
+ optional :distance_metric, enum: -> { Turbopuffer::DistanceMetric }
33
+
34
+ # @!attribute exclude_attributes
35
+ # List of attribute names to exclude from the response. All other attributes will
36
+ # be included in the response.
37
+ #
38
+ # @return [Array<String>, nil]
39
+ optional :exclude_attributes, Turbopuffer::Internal::Type::ArrayOf[String]
40
+
41
+ # @!attribute filters
42
+ # Exact filters for attributes to refine search results for. Think of it as a SQL
43
+ # WHERE clause.
44
+ #
45
+ # @return [Object, nil]
46
+ optional :filters, Turbopuffer::Internal::Type::Unknown
47
+
48
+ # @!attribute group_by
49
+ # Groups documents by the specified attributes (the "group key") before computing
50
+ # aggregates. Aggregates are computed separately for each group.
51
+ #
52
+ # @return [Array<String>, nil]
53
+ optional :group_by, Turbopuffer::Internal::Type::ArrayOf[String]
54
+
55
+ # @!attribute include_attributes
56
+ # Whether to include attributes in the response.
57
+ #
58
+ # @return [Boolean, Array<String>, nil]
59
+ optional :include_attributes, union: -> { Turbopuffer::IncludeAttributes }
60
+
61
+ # @!attribute rank_by
62
+ # How to rank the documents in the namespace.
63
+ #
64
+ # @return [Object, nil]
65
+ optional :rank_by, Turbopuffer::Internal::Type::Unknown
66
+
67
+ # @!attribute top_k
68
+ # The number of results to return.
69
+ #
70
+ # @return [Integer, nil]
71
+ optional :top_k, Integer
72
+
73
+ # @!attribute vector_encoding
74
+ # The encoding to use for vectors in the response.
75
+ #
76
+ # @return [Symbol, Turbopuffer::Models::VectorEncoding, nil]
77
+ optional :vector_encoding, enum: -> { Turbopuffer::VectorEncoding }
78
+
79
+ # @!method initialize(namespace: nil, aggregate_by: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
80
+ # Some parameter documentations has been truncated, see
81
+ # {Turbopuffer::Models::NamespaceQueryParams} for more details.
82
+ #
83
+ # @param namespace [String]
84
+ #
85
+ # @param aggregate_by [Hash{Symbol=>Object}] Aggregations to compute over all documents in the namespace that match the filte
86
+ #
87
+ # @param consistency [Turbopuffer::Models::NamespaceQueryParams::Consistency] The consistency level for a query.
88
+ #
89
+ # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
90
+ #
91
+ # @param exclude_attributes [Array<String>] List of attribute names to exclude from the response. All other attributes will
92
+ #
93
+ # @param filters [Object] Exact filters for attributes to refine search results for. Think of it as a SQL
94
+ #
95
+ # @param group_by [Array<String>] Groups documents by the specified attributes (the "group key") before computing
96
+ #
97
+ # @param include_attributes [Boolean, Array<String>] Whether to include attributes in the response.
98
+ #
99
+ # @param rank_by [Object] How to rank the documents in the namespace.
100
+ #
101
+ # @param top_k [Integer] The number of results to return.
102
+ #
103
+ # @param vector_encoding [Symbol, Turbopuffer::Models::VectorEncoding] The encoding to use for vectors in the response.
104
+ #
105
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
106
+
107
+ class Consistency < Turbopuffer::Internal::Type::BaseModel
108
+ # @!attribute level
109
+ # The query's consistency level.
110
+ #
111
+ # @return [Symbol, Turbopuffer::Models::NamespaceQueryParams::Consistency::Level, nil]
112
+ optional :level, enum: -> { Turbopuffer::NamespaceQueryParams::Consistency::Level }
113
+
114
+ # @!method initialize(level: nil)
115
+ # The consistency level for a query.
116
+ #
117
+ # @param level [Symbol, Turbopuffer::Models::NamespaceQueryParams::Consistency::Level] The query's consistency level.
118
+
119
+ # The query's consistency level.
120
+ #
121
+ # @see Turbopuffer::Models::NamespaceQueryParams::Consistency#level
122
+ module Level
123
+ extend Turbopuffer::Internal::Type::Enum
124
+
125
+ # Strong consistency. Requires a round-trip to object storage to fetch the latest writes.
126
+ STRONG = :strong
127
+
128
+ # Eventual consistency. Does not require a round-trip to object storage, but may not see the latest writes.
129
+ EVENTUAL = :eventual
130
+
131
+ # @!method self.values
132
+ # @return [Array<Symbol>]
133
+ end
134
+ end
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#query
6
+ class NamespaceQueryResponse < Turbopuffer::Internal::Type::BaseModel
7
+ # @!attribute billing
8
+ # The billing information for a query.
9
+ #
10
+ # @return [Turbopuffer::Models::QueryBilling]
11
+ required :billing, -> { Turbopuffer::QueryBilling }
12
+
13
+ # @!attribute performance
14
+ # The performance information for a query.
15
+ #
16
+ # @return [Turbopuffer::Models::QueryPerformance]
17
+ required :performance, -> { Turbopuffer::QueryPerformance }
18
+
19
+ # @!attribute aggregation_groups
20
+ #
21
+ # @return [Array<Hash{Symbol=>Object}>, nil]
22
+ optional :aggregation_groups,
23
+ Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]]
24
+
25
+ # @!attribute aggregations
26
+ #
27
+ # @return [Hash{Symbol=>Object}, nil]
28
+ optional :aggregations, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
29
+
30
+ # @!attribute rows
31
+ #
32
+ # @return [Array<Turbopuffer::Models::Row>, nil]
33
+ optional :rows, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
34
+
35
+ # @!method initialize(billing:, performance:, aggregation_groups: nil, aggregations: nil, rows: nil)
36
+ # The result of a query.
37
+ #
38
+ # @param billing [Turbopuffer::Models::QueryBilling] The billing information for a query.
39
+ #
40
+ # @param performance [Turbopuffer::Models::QueryPerformance] The performance information for a query.
41
+ #
42
+ # @param aggregation_groups [Array<Hash{Symbol=>Object}>]
43
+ #
44
+ # @param aggregations [Hash{Symbol=>Object}]
45
+ #
46
+ # @param rows [Array<Turbopuffer::Models::Row>]
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#recall
6
+ class NamespaceRecallParams < 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 filters
16
+ # Filter by attributes. Same syntax as the query endpoint.
17
+ #
18
+ # @return [Object, nil]
19
+ optional :filters, Turbopuffer::Internal::Type::Unknown
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
+
28
+ # @!attribute num
29
+ # The number of searches to run.
30
+ #
31
+ # @return [Integer, nil]
32
+ optional :num, Integer
33
+
34
+ # @!attribute queries
35
+ # Use specific query vectors for the measurement. If omitted, sampled from the
36
+ # index.
37
+ #
38
+ # @return [Array<Float>, nil]
39
+ optional :queries, Turbopuffer::Internal::Type::ArrayOf[Float]
40
+
41
+ # @!attribute top_k
42
+ # Search for `top_k` nearest neighbors.
43
+ #
44
+ # @return [Integer, nil]
45
+ optional :top_k, Integer
46
+
47
+ # @!method initialize(namespace: nil, filters: nil, include_ground_truth: nil, num: nil, queries: nil, top_k: nil, request_options: {})
48
+ # Some parameter documentations has been truncated, see
49
+ # {Turbopuffer::Models::NamespaceRecallParams} for more details.
50
+ #
51
+ # @param namespace [String]
52
+ #
53
+ # @param filters [Object] Filter by attributes. Same syntax as the query endpoint.
54
+ #
55
+ # @param include_ground_truth [Boolean] Include ground truth data (query vectors and true nearest neighbors) in the resp
56
+ #
57
+ # @param num [Integer] The number of searches to run.
58
+ #
59
+ # @param queries [Array<Float>] Use specific query vectors for the measurement. If omitted, sampled from the ind
60
+ #
61
+ # @param top_k [Integer] Search for `top_k` nearest neighbors.
62
+ #
63
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#recall
6
+ class NamespaceRecallResponse < Turbopuffer::Internal::Type::BaseModel
7
+ # @!attribute avg_ann_count
8
+ # The average number of documents retrieved by the approximate nearest neighbor
9
+ # searches.
10
+ #
11
+ # @return [Float]
12
+ required :avg_ann_count, Float
13
+
14
+ # @!attribute avg_exhaustive_count
15
+ # The average number of documents retrieved by the exhaustive searches.
16
+ #
17
+ # @return [Float]
18
+ required :avg_exhaustive_count, Float
19
+
20
+ # @!attribute avg_recall
21
+ # The average recall of the queries.
22
+ #
23
+ # @return [Float]
24
+ required :avg_recall, Float
25
+
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)
35
+ # Some parameter documentations has been truncated, see
36
+ # {Turbopuffer::Models::NamespaceRecallResponse} for more details.
37
+ #
38
+ # The response to a successful cache warm request.
39
+ #
40
+ # @param avg_ann_count [Float] The average number of documents retrieved by the approximate nearest neighbor se
41
+ #
42
+ # @param avg_exhaustive_count [Float] The average number of documents retrieved by the exhaustive searches.
43
+ #
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
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#schema
6
+ class NamespaceSchemaParams < 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
+ # @!method initialize(namespace: nil, request_options: {})
16
+ # @param namespace [String]
17
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @type [Turbopuffer::Internal::Type::Converter]
6
+ NamespaceSchemaResponse = Turbopuffer::Internal::Type::HashOf[-> { Turbopuffer::AttributeSchemaConfig }]
7
+ end
8
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Client#namespaces
6
+ class NamespaceSummary < Turbopuffer::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ # The namespace ID.
9
+ #
10
+ # @return [String]
11
+ required :id, String
12
+
13
+ # @!method initialize(id:)
14
+ # A summary of a namespace.
15
+ #
16
+ # @param id [String] The namespace ID.
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#update_schema
6
+ class NamespaceUpdateSchemaParams < 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 schema
16
+ # The desired schema for the namespace.
17
+ #
18
+ # @return [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig}, nil]
19
+ optional :schema, -> { Turbopuffer::Internal::Type::HashOf[union: Turbopuffer::AttributeSchema] }
20
+
21
+ # @!method initialize(namespace: nil, schema: nil, request_options: {})
22
+ # @param namespace [String]
23
+ #
24
+ # @param schema [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig}] The desired schema for the namespace.
25
+ #
26
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @type [Turbopuffer::Internal::Type::Converter]
6
+ NamespaceUpdateSchemaResponse =
7
+ Turbopuffer::Internal::Type::HashOf[-> { Turbopuffer::AttributeSchemaConfig }]
8
+ end
9
+ end