turbopuffer-ruby 0.2.0.pre.alpha.1

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 (194) hide show
  1. checksums.yaml +7 -0
  2. data/.ignore +2 -0
  3. data/CHANGELOG.md +60 -0
  4. data/README.md +291 -0
  5. data/SECURITY.md +27 -0
  6. data/lib/turbopuffer/client.rb +130 -0
  7. data/lib/turbopuffer/errors.rb +214 -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 +563 -0
  11. data/lib/turbopuffer/internal/transport/pooled_net_requester.rb +209 -0
  12. data/lib/turbopuffer/internal/type/array_of.rb +167 -0
  13. data/lib/turbopuffer/internal/type/base_model.rb +534 -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 +300 -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 +187 -0
  20. data/lib/turbopuffer/internal/type/request_parameters.rb +42 -0
  21. data/lib/turbopuffer/internal/type/union.rb +252 -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/attribute_schema.rb +19 -0
  26. data/lib/turbopuffer/models/attribute_schema_config.rb +48 -0
  27. data/lib/turbopuffer/models/attribute_type.rb +7 -0
  28. data/lib/turbopuffer/models/client_namespaces_params.rb +38 -0
  29. data/lib/turbopuffer/models/columns.rb +64 -0
  30. data/lib/turbopuffer/models/distance_metric.rb +19 -0
  31. data/lib/turbopuffer/models/full_text_search.rb +20 -0
  32. data/lib/turbopuffer/models/full_text_search_config.rb +72 -0
  33. data/lib/turbopuffer/models/id.rb +19 -0
  34. data/lib/turbopuffer/models/include_attributes.rb +22 -0
  35. data/lib/turbopuffer/models/language.rb +32 -0
  36. data/lib/turbopuffer/models/namespace_delete_all_params.rb +20 -0
  37. data/lib/turbopuffer/models/namespace_delete_all_response.rb +19 -0
  38. data/lib/turbopuffer/models/namespace_hint_cache_warm_params.rb +20 -0
  39. data/lib/turbopuffer/models/namespace_hint_cache_warm_response.rb +26 -0
  40. data/lib/turbopuffer/models/namespace_metadata.rb +35 -0
  41. data/lib/turbopuffer/models/namespace_metadata_params.rb +20 -0
  42. data/lib/turbopuffer/models/namespace_multi_query_params.rb +73 -0
  43. data/lib/turbopuffer/models/namespace_multi_query_response.rb +51 -0
  44. data/lib/turbopuffer/models/namespace_query_params.rb +119 -0
  45. data/lib/turbopuffer/models/namespace_query_response.rb +41 -0
  46. data/lib/turbopuffer/models/namespace_recall_params.rb +57 -0
  47. data/lib/turbopuffer/models/namespace_recall_response.rb +39 -0
  48. data/lib/turbopuffer/models/namespace_schema_params.rb +20 -0
  49. data/lib/turbopuffer/models/namespace_schema_response.rb +8 -0
  50. data/lib/turbopuffer/models/namespace_summary.rb +19 -0
  51. data/lib/turbopuffer/models/namespace_update_schema_params.rb +29 -0
  52. data/lib/turbopuffer/models/namespace_update_schema_response.rb +9 -0
  53. data/lib/turbopuffer/models/namespace_write_params.rb +158 -0
  54. data/lib/turbopuffer/models/namespace_write_response.rb +67 -0
  55. data/lib/turbopuffer/models/query.rb +63 -0
  56. data/lib/turbopuffer/models/query_billing.rb +26 -0
  57. data/lib/turbopuffer/models/query_performance.rb +63 -0
  58. data/lib/turbopuffer/models/row.rb +38 -0
  59. data/lib/turbopuffer/models/tokenizer.rb +17 -0
  60. data/lib/turbopuffer/models/vector.rb +22 -0
  61. data/lib/turbopuffer/models/vector_encoding.rb +16 -0
  62. data/lib/turbopuffer/models/write_billing.rb +26 -0
  63. data/lib/turbopuffer/models.rb +101 -0
  64. data/lib/turbopuffer/namespace.rb +22 -0
  65. data/lib/turbopuffer/request_options.rb +77 -0
  66. data/lib/turbopuffer/resources/namespaces.rb +311 -0
  67. data/lib/turbopuffer/version.rb +5 -0
  68. data/lib/turbopuffer.rb +94 -0
  69. data/manifest.yaml +15 -0
  70. data/rbi/turbopuffer/client.rbi +91 -0
  71. data/rbi/turbopuffer/errors.rbi +178 -0
  72. data/rbi/turbopuffer/file_part.rbi +37 -0
  73. data/rbi/turbopuffer/internal/namespace_page.rbi +22 -0
  74. data/rbi/turbopuffer/internal/transport/base_client.rbi +298 -0
  75. data/rbi/turbopuffer/internal/transport/pooled_net_requester.rbi +80 -0
  76. data/rbi/turbopuffer/internal/type/array_of.rbi +104 -0
  77. data/rbi/turbopuffer/internal/type/base_model.rbi +304 -0
  78. data/rbi/turbopuffer/internal/type/base_page.rbi +43 -0
  79. data/rbi/turbopuffer/internal/type/boolean.rbi +58 -0
  80. data/rbi/turbopuffer/internal/type/converter.rbi +162 -0
  81. data/rbi/turbopuffer/internal/type/enum.rbi +82 -0
  82. data/rbi/turbopuffer/internal/type/file_input.rbi +59 -0
  83. data/rbi/turbopuffer/internal/type/hash_of.rbi +104 -0
  84. data/rbi/turbopuffer/internal/type/request_parameters.rbi +31 -0
  85. data/rbi/turbopuffer/internal/type/union.rbi +121 -0
  86. data/rbi/turbopuffer/internal/type/unknown.rbi +58 -0
  87. data/rbi/turbopuffer/internal/util.rbi +487 -0
  88. data/rbi/turbopuffer/internal.rbi +18 -0
  89. data/rbi/turbopuffer/models/attribute_schema.rbi +17 -0
  90. data/rbi/turbopuffer/models/attribute_schema_config.rbi +92 -0
  91. data/rbi/turbopuffer/models/attribute_type.rbi +7 -0
  92. data/rbi/turbopuffer/models/client_namespaces_params.rbi +71 -0
  93. data/rbi/turbopuffer/models/columns.rbi +82 -0
  94. data/rbi/turbopuffer/models/distance_metric.rbi +27 -0
  95. data/rbi/turbopuffer/models/full_text_search.rbi +19 -0
  96. data/rbi/turbopuffer/models/full_text_search_config.rbi +116 -0
  97. data/rbi/turbopuffer/models/id.rbi +16 -0
  98. data/rbi/turbopuffer/models/include_attributes.rbi +24 -0
  99. data/rbi/turbopuffer/models/language.rbi +36 -0
  100. data/rbi/turbopuffer/models/namespace_delete_all_params.rbi +41 -0
  101. data/rbi/turbopuffer/models/namespace_delete_all_response.rbi +31 -0
  102. data/rbi/turbopuffer/models/namespace_hint_cache_warm_params.rbi +41 -0
  103. data/rbi/turbopuffer/models/namespace_hint_cache_warm_response.rbi +38 -0
  104. data/rbi/turbopuffer/models/namespace_metadata.rbi +54 -0
  105. data/rbi/turbopuffer/models/namespace_metadata_params.rbi +41 -0
  106. data/rbi/turbopuffer/models/namespace_multi_query_params.rbi +175 -0
  107. data/rbi/turbopuffer/models/namespace_multi_query_response.rbi +111 -0
  108. data/rbi/turbopuffer/models/namespace_query_params.rbi +241 -0
  109. data/rbi/turbopuffer/models/namespace_query_response.rbi +73 -0
  110. data/rbi/turbopuffer/models/namespace_recall_params.rbi +93 -0
  111. data/rbi/turbopuffer/models/namespace_recall_response.rbi +59 -0
  112. data/rbi/turbopuffer/models/namespace_schema_params.rbi +41 -0
  113. data/rbi/turbopuffer/models/namespace_schema_response.rbi +11 -0
  114. data/rbi/turbopuffer/models/namespace_summary.rbi +28 -0
  115. data/rbi/turbopuffer/models/namespace_update_schema_params.rbi +80 -0
  116. data/rbi/turbopuffer/models/namespace_update_schema_response.rbi +11 -0
  117. data/rbi/turbopuffer/models/namespace_write_params.rbi +290 -0
  118. data/rbi/turbopuffer/models/namespace_write_response.rbi +101 -0
  119. data/rbi/turbopuffer/models/query.rbi +106 -0
  120. data/rbi/turbopuffer/models/query_billing.rbi +46 -0
  121. data/rbi/turbopuffer/models/query_performance.rbi +82 -0
  122. data/rbi/turbopuffer/models/row.rbi +47 -0
  123. data/rbi/turbopuffer/models/tokenizer.rbi +22 -0
  124. data/rbi/turbopuffer/models/vector.rbi +22 -0
  125. data/rbi/turbopuffer/models/vector_encoding.rbi +22 -0
  126. data/rbi/turbopuffer/models/write_billing.rbi +49 -0
  127. data/rbi/turbopuffer/models.rbi +64 -0
  128. data/rbi/turbopuffer/namespace.rbi +8 -0
  129. data/rbi/turbopuffer/request_options.rbi +59 -0
  130. data/rbi/turbopuffer/resources/namespaces.rbi +243 -0
  131. data/rbi/turbopuffer/version.rbi +5 -0
  132. data/sig/turbopuffer/client.rbs +41 -0
  133. data/sig/turbopuffer/errors.rbs +110 -0
  134. data/sig/turbopuffer/file_part.rbs +21 -0
  135. data/sig/turbopuffer/internal/namespace_page.rbs +13 -0
  136. data/sig/turbopuffer/internal/transport/base_client.rbs +131 -0
  137. data/sig/turbopuffer/internal/transport/pooled_net_requester.rbs +45 -0
  138. data/sig/turbopuffer/internal/type/array_of.rbs +48 -0
  139. data/sig/turbopuffer/internal/type/base_model.rbs +102 -0
  140. data/sig/turbopuffer/internal/type/base_page.rbs +24 -0
  141. data/sig/turbopuffer/internal/type/boolean.rbs +26 -0
  142. data/sig/turbopuffer/internal/type/converter.rbs +62 -0
  143. data/sig/turbopuffer/internal/type/enum.rbs +32 -0
  144. data/sig/turbopuffer/internal/type/file_input.rbs +25 -0
  145. data/sig/turbopuffer/internal/type/hash_of.rbs +48 -0
  146. data/sig/turbopuffer/internal/type/request_parameters.rbs +19 -0
  147. data/sig/turbopuffer/internal/type/union.rbs +52 -0
  148. data/sig/turbopuffer/internal/type/unknown.rbs +26 -0
  149. data/sig/turbopuffer/internal/util.rbs +185 -0
  150. data/sig/turbopuffer/internal.rbs +9 -0
  151. data/sig/turbopuffer/models/attribute_schema.rbs +11 -0
  152. data/sig/turbopuffer/models/attribute_schema_config.rbs +45 -0
  153. data/sig/turbopuffer/models/attribute_type.rbs +5 -0
  154. data/sig/turbopuffer/models/client_namespaces_params.rbs +38 -0
  155. data/sig/turbopuffer/models/columns.rbs +42 -0
  156. data/sig/turbopuffer/models/distance_metric.rbs +17 -0
  157. data/sig/turbopuffer/models/full_text_search.rbs +11 -0
  158. data/sig/turbopuffer/models/full_text_search_config.rbs +68 -0
  159. data/sig/turbopuffer/models/id.rbs +11 -0
  160. data/sig/turbopuffer/models/include_attributes.rbs +13 -0
  161. data/sig/turbopuffer/models/language.rbs +48 -0
  162. data/sig/turbopuffer/models/namespace_delete_all_params.rbs +25 -0
  163. data/sig/turbopuffer/models/namespace_delete_all_response.rbs +13 -0
  164. data/sig/turbopuffer/models/namespace_hint_cache_warm_params.rbs +25 -0
  165. data/sig/turbopuffer/models/namespace_hint_cache_warm_response.rbs +17 -0
  166. data/sig/turbopuffer/models/namespace_metadata.rbs +30 -0
  167. data/sig/turbopuffer/models/namespace_metadata_params.rbs +25 -0
  168. data/sig/turbopuffer/models/namespace_multi_query_params.rbs +86 -0
  169. data/sig/turbopuffer/models/namespace_multi_query_response.rbs +53 -0
  170. data/sig/turbopuffer/models/namespace_query_params.rbs +125 -0
  171. data/sig/turbopuffer/models/namespace_query_response.rbs +39 -0
  172. data/sig/turbopuffer/models/namespace_recall_params.rbs +56 -0
  173. data/sig/turbopuffer/models/namespace_recall_response.rbs +26 -0
  174. data/sig/turbopuffer/models/namespace_schema_params.rbs +25 -0
  175. data/sig/turbopuffer/models/namespace_schema_response.rbs +8 -0
  176. data/sig/turbopuffer/models/namespace_summary.rbs +13 -0
  177. data/sig/turbopuffer/models/namespace_update_schema_params.rbs +37 -0
  178. data/sig/turbopuffer/models/namespace_update_schema_response.rbs +8 -0
  179. data/sig/turbopuffer/models/namespace_write_params.rbs +156 -0
  180. data/sig/turbopuffer/models/namespace_write_response.rbs +56 -0
  181. data/sig/turbopuffer/models/query.rbs +61 -0
  182. data/sig/turbopuffer/models/query_billing.rbs +25 -0
  183. data/sig/turbopuffer/models/query_performance.rbs +45 -0
  184. data/sig/turbopuffer/models/row.rbs +24 -0
  185. data/sig/turbopuffer/models/tokenizer.rbs +15 -0
  186. data/sig/turbopuffer/models/vector.rbs +13 -0
  187. data/sig/turbopuffer/models/vector_encoding.rbs +14 -0
  188. data/sig/turbopuffer/models/write_billing.rbs +27 -0
  189. data/sig/turbopuffer/models.rbs +61 -0
  190. data/sig/turbopuffer/namespace.rbs +5 -0
  191. data/sig/turbopuffer/request_options.rbs +36 -0
  192. data/sig/turbopuffer/resources/namespaces.rbs +81 -0
  193. data/sig/turbopuffer/version.rbs +3 -0
  194. metadata +251 -0
@@ -0,0 +1,119 @@
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 filters
35
+ # Exact filters for attributes to refine search results for. Think of it as a SQL
36
+ # WHERE clause.
37
+ #
38
+ # @return [Object, nil]
39
+ optional :filters, Turbopuffer::Internal::Type::Unknown
40
+
41
+ # @!attribute include_attributes
42
+ # Whether to include attributes in the response.
43
+ #
44
+ # @return [Boolean, Array<String>, nil]
45
+ optional :include_attributes, union: -> { Turbopuffer::IncludeAttributes }
46
+
47
+ # @!attribute rank_by
48
+ # How to rank the documents in the namespace.
49
+ #
50
+ # @return [Object, nil]
51
+ optional :rank_by, Turbopuffer::Internal::Type::Unknown
52
+
53
+ # @!attribute top_k
54
+ # The number of results to return.
55
+ #
56
+ # @return [Integer, nil]
57
+ optional :top_k, Integer
58
+
59
+ # @!attribute vector_encoding
60
+ # The encoding to use for vectors in the response.
61
+ #
62
+ # @return [Symbol, Turbopuffer::Models::VectorEncoding, nil]
63
+ optional :vector_encoding, enum: -> { Turbopuffer::VectorEncoding }
64
+
65
+ # @!method initialize(namespace: nil, aggregate_by: nil, consistency: nil, distance_metric: nil, filters: nil, include_attributes: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
66
+ # Some parameter documentations has been truncated, see
67
+ # {Turbopuffer::Models::NamespaceQueryParams} for more details.
68
+ #
69
+ # @param namespace [String]
70
+ #
71
+ # @param aggregate_by [Hash{Symbol=>Object}] Aggregations to compute over all documents in the namespace that match the filte
72
+ #
73
+ # @param consistency [Turbopuffer::Models::NamespaceQueryParams::Consistency] The consistency level for a query.
74
+ #
75
+ # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
76
+ #
77
+ # @param filters [Object] Exact filters for attributes to refine search results for. Think of it as a SQL
78
+ #
79
+ # @param include_attributes [Boolean, Array<String>] Whether to include attributes in the response.
80
+ #
81
+ # @param rank_by [Object] How to rank the documents in the namespace.
82
+ #
83
+ # @param top_k [Integer] The number of results to return.
84
+ #
85
+ # @param vector_encoding [Symbol, Turbopuffer::Models::VectorEncoding] The encoding to use for vectors in the response.
86
+ #
87
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
88
+
89
+ class Consistency < Turbopuffer::Internal::Type::BaseModel
90
+ # @!attribute level
91
+ # The query's consistency level.
92
+ #
93
+ # @return [Symbol, Turbopuffer::Models::NamespaceQueryParams::Consistency::Level, nil]
94
+ optional :level, enum: -> { Turbopuffer::NamespaceQueryParams::Consistency::Level }
95
+
96
+ # @!method initialize(level: nil)
97
+ # The consistency level for a query.
98
+ #
99
+ # @param level [Symbol, Turbopuffer::Models::NamespaceQueryParams::Consistency::Level] The query's consistency level.
100
+
101
+ # The query's consistency level.
102
+ #
103
+ # @see Turbopuffer::Models::NamespaceQueryParams::Consistency#level
104
+ module Level
105
+ extend Turbopuffer::Internal::Type::Enum
106
+
107
+ # Strong consistency. Requires a round-trip to object storage to fetch the latest writes.
108
+ STRONG = :strong
109
+
110
+ # Eventual consistency. Does not require a round-trip to object storage, but may not see the latest writes.
111
+ EVENTUAL = :eventual
112
+
113
+ # @!method self.values
114
+ # @return [Array<Symbol>]
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,41 @@
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 aggregations
20
+ #
21
+ # @return [Hash{Symbol=>Object}, nil]
22
+ optional :aggregations, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
23
+
24
+ # @!attribute rows
25
+ #
26
+ # @return [Array<Turbopuffer::Models::Row>, nil]
27
+ optional :rows, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
28
+
29
+ # @!method initialize(billing:, performance:, aggregations: nil, rows: nil)
30
+ # The result of a query.
31
+ #
32
+ # @param billing [Turbopuffer::Models::QueryBilling] The billing information for a query.
33
+ #
34
+ # @param performance [Turbopuffer::Models::QueryPerformance] The performance information for a query.
35
+ #
36
+ # @param aggregations [Hash{Symbol=>Object}]
37
+ #
38
+ # @param rows [Array<Turbopuffer::Models::Row>]
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,57 @@
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 num
22
+ # The number of searches to run.
23
+ #
24
+ # @return [Integer, nil]
25
+ optional :num, Integer
26
+
27
+ # @!attribute queries
28
+ # Use specific query vectors for the measurement. If omitted, sampled from the
29
+ # index.
30
+ #
31
+ # @return [Array<Float>, nil]
32
+ optional :queries, Turbopuffer::Internal::Type::ArrayOf[Float]
33
+
34
+ # @!attribute top_k
35
+ # Search for `top_k` nearest neighbors.
36
+ #
37
+ # @return [Integer, nil]
38
+ optional :top_k, Integer
39
+
40
+ # @!method initialize(namespace: nil, filters: nil, num: nil, queries: nil, top_k: nil, request_options: {})
41
+ # Some parameter documentations has been truncated, see
42
+ # {Turbopuffer::Models::NamespaceRecallParams} for more details.
43
+ #
44
+ # @param namespace [String]
45
+ #
46
+ # @param filters [Object] Filter by attributes. Same syntax as the query endpoint.
47
+ #
48
+ # @param num [Integer] The number of searches to run.
49
+ #
50
+ # @param queries [Array<Float>] Use specific query vectors for the measurement. If omitted, sampled from the ind
51
+ #
52
+ # @param top_k [Integer] Search for `top_k` nearest neighbors.
53
+ #
54
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,39 @@
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
+ # @!method initialize(avg_ann_count:, avg_exhaustive_count:, avg_recall:)
27
+ # Some parameter documentations has been truncated, see
28
+ # {Turbopuffer::Models::NamespaceRecallResponse} for more details.
29
+ #
30
+ # The response to a successful cache warm request.
31
+ #
32
+ # @param avg_ann_count [Float] The average number of documents retrieved by the approximate nearest neighbor se
33
+ #
34
+ # @param avg_exhaustive_count [Float] The average number of documents retrieved by the exhaustive searches.
35
+ #
36
+ # @param avg_recall [Float] The average recall of the queries.
37
+ end
38
+ end
39
+ 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
@@ -0,0 +1,158 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#write
6
+ class NamespaceWriteParams < 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 copy_from_namespace
16
+ # The namespace to copy documents from.
17
+ #
18
+ # @return [String, nil]
19
+ optional :copy_from_namespace, String
20
+
21
+ # @!attribute delete_by_filter
22
+ # The filter specifying which documents to delete.
23
+ #
24
+ # @return [Object, nil]
25
+ optional :delete_by_filter, Turbopuffer::Internal::Type::Unknown
26
+
27
+ # @!attribute delete_condition
28
+ # A condition evaluated against the current value of each document targeted by a
29
+ # delete write. Only documents that pass the condition are deleted.
30
+ #
31
+ # @return [Object, nil]
32
+ optional :delete_condition, Turbopuffer::Internal::Type::Unknown
33
+
34
+ # @!attribute deletes
35
+ #
36
+ # @return [Array<String, Integer>, nil]
37
+ optional :deletes, -> { Turbopuffer::Internal::Type::ArrayOf[union: Turbopuffer::ID] }
38
+
39
+ # @!attribute distance_metric
40
+ # A function used to calculate vector similarity.
41
+ #
42
+ # @return [Symbol, Turbopuffer::Models::DistanceMetric, nil]
43
+ optional :distance_metric, enum: -> { Turbopuffer::DistanceMetric }
44
+
45
+ # @!attribute encryption
46
+ # The encryption configuration for a namespace.
47
+ #
48
+ # @return [Turbopuffer::Models::NamespaceWriteParams::Encryption, nil]
49
+ optional :encryption, -> { Turbopuffer::NamespaceWriteParams::Encryption }
50
+
51
+ # @!attribute patch_columns
52
+ # A list of documents in columnar format. Each key is a column name, mapped to an
53
+ # array of values for that column.
54
+ #
55
+ # @return [Turbopuffer::Models::Columns, nil]
56
+ optional :patch_columns, -> { Turbopuffer::Columns }
57
+
58
+ # @!attribute patch_condition
59
+ # A condition evaluated against the current value of each document targeted by a
60
+ # patch write. Only documents that pass the condition are patched.
61
+ #
62
+ # @return [Object, nil]
63
+ optional :patch_condition, Turbopuffer::Internal::Type::Unknown
64
+
65
+ # @!attribute patch_rows
66
+ #
67
+ # @return [Array<Turbopuffer::Models::Row>, nil]
68
+ optional :patch_rows, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
69
+
70
+ # @!attribute schema
71
+ # The schema of the attributes attached to the documents.
72
+ #
73
+ # @return [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig}, nil]
74
+ optional :schema, -> { Turbopuffer::Internal::Type::HashOf[union: Turbopuffer::AttributeSchema] }
75
+
76
+ # @!attribute upsert_columns
77
+ # A list of documents in columnar format. Each key is a column name, mapped to an
78
+ # array of values for that column.
79
+ #
80
+ # @return [Turbopuffer::Models::Columns, nil]
81
+ optional :upsert_columns, -> { Turbopuffer::Columns }
82
+
83
+ # @!attribute upsert_condition
84
+ # A condition evaluated against the current value of each document targeted by an
85
+ # upsert write. Only documents that pass the condition are upserted.
86
+ #
87
+ # @return [Object, nil]
88
+ optional :upsert_condition, Turbopuffer::Internal::Type::Unknown
89
+
90
+ # @!attribute upsert_rows
91
+ #
92
+ # @return [Array<Turbopuffer::Models::Row>, nil]
93
+ optional :upsert_rows, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
94
+
95
+ # @!method initialize(namespace: nil, copy_from_namespace: nil, delete_by_filter: nil, delete_condition: nil, deletes: nil, distance_metric: nil, encryption: nil, patch_columns: nil, patch_condition: nil, patch_rows: nil, schema: nil, upsert_columns: nil, upsert_condition: nil, upsert_rows: nil, request_options: {})
96
+ # Some parameter documentations has been truncated, see
97
+ # {Turbopuffer::Models::NamespaceWriteParams} for more details.
98
+ #
99
+ # @param namespace [String]
100
+ #
101
+ # @param copy_from_namespace [String] The namespace to copy documents from.
102
+ #
103
+ # @param delete_by_filter [Object] The filter specifying which documents to delete.
104
+ #
105
+ # @param delete_condition [Object] A condition evaluated against the current value of each document targeted by a d
106
+ #
107
+ # @param deletes [Array<String, Integer>]
108
+ #
109
+ # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
110
+ #
111
+ # @param encryption [Turbopuffer::Models::NamespaceWriteParams::Encryption] The encryption configuration for a namespace.
112
+ #
113
+ # @param patch_columns [Turbopuffer::Models::Columns] A list of documents in columnar format. Each key is a column name, mapped to an
114
+ #
115
+ # @param patch_condition [Object] A condition evaluated against the current value of each document targeted by a p
116
+ #
117
+ # @param patch_rows [Array<Turbopuffer::Models::Row>]
118
+ #
119
+ # @param schema [Hash{Symbol=>String, Turbopuffer::Models::AttributeSchemaConfig}] The schema of the attributes attached to the documents.
120
+ #
121
+ # @param upsert_columns [Turbopuffer::Models::Columns] A list of documents in columnar format. Each key is a column name, mapped to an
122
+ #
123
+ # @param upsert_condition [Object] A condition evaluated against the current value of each document targeted by an
124
+ #
125
+ # @param upsert_rows [Array<Turbopuffer::Models::Row>]
126
+ #
127
+ # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
128
+
129
+ class Encryption < Turbopuffer::Internal::Type::BaseModel
130
+ # @!attribute cmek
131
+ #
132
+ # @return [Turbopuffer::Models::NamespaceWriteParams::Encryption::Cmek, nil]
133
+ optional :cmek, -> { Turbopuffer::NamespaceWriteParams::Encryption::Cmek }
134
+
135
+ # @!method initialize(cmek: nil)
136
+ # The encryption configuration for a namespace.
137
+ #
138
+ # @param cmek [Turbopuffer::Models::NamespaceWriteParams::Encryption::Cmek]
139
+
140
+ # @see Turbopuffer::Models::NamespaceWriteParams::Encryption#cmek
141
+ class Cmek < Turbopuffer::Internal::Type::BaseModel
142
+ # @!attribute key_name
143
+ # The identifier of the CMEK key to use for encryption. For GCP, the
144
+ # fully-qualified resource name of the key. For AWS, the ARN of the key.
145
+ #
146
+ # @return [String]
147
+ required :key_name, String
148
+
149
+ # @!method initialize(key_name:)
150
+ # Some parameter documentations has been truncated, see
151
+ # {Turbopuffer::Models::NamespaceWriteParams::Encryption::Cmek} for more details.
152
+ #
153
+ # @param key_name [String] The identifier of the CMEK key to use for encryption. For GCP, the fully-qualifi
154
+ end
155
+ end
156
+ end
157
+ end
158
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # @see Turbopuffer::Resources::Namespaces#write
6
+ class NamespaceWriteResponse < Turbopuffer::Internal::Type::BaseModel
7
+ # @!attribute billing
8
+ # The billing information for a write request.
9
+ #
10
+ # @return [Turbopuffer::Models::WriteBilling]
11
+ required :billing, -> { Turbopuffer::WriteBilling }
12
+
13
+ # @!attribute message
14
+ # A message describing the result of the write request.
15
+ #
16
+ # @return [String]
17
+ required :message, String
18
+
19
+ # @!attribute rows_affected
20
+ # The number of rows affected by the write request.
21
+ #
22
+ # @return [Integer]
23
+ required :rows_affected, Integer
24
+
25
+ # @!attribute status
26
+ # The status of the request.
27
+ #
28
+ # @return [Symbol, :OK]
29
+ required :status, const: :OK
30
+
31
+ # @!attribute rows_deleted
32
+ # The number of rows deleted by the write request.
33
+ #
34
+ # @return [Integer, nil]
35
+ optional :rows_deleted, Integer
36
+
37
+ # @!attribute rows_patched
38
+ # The number of rows patched by the write request.
39
+ #
40
+ # @return [Integer, nil]
41
+ optional :rows_patched, Integer
42
+
43
+ # @!attribute rows_upserted
44
+ # The number of rows upserted by the write request.
45
+ #
46
+ # @return [Integer, nil]
47
+ optional :rows_upserted, Integer
48
+
49
+ # @!method initialize(billing:, message:, rows_affected:, rows_deleted: nil, rows_patched: nil, rows_upserted: nil, status: :OK)
50
+ # The response to a successful write request.
51
+ #
52
+ # @param billing [Turbopuffer::Models::WriteBilling] The billing information for a write request.
53
+ #
54
+ # @param message [String] A message describing the result of the write request.
55
+ #
56
+ # @param rows_affected [Integer] The number of rows affected by the write request.
57
+ #
58
+ # @param rows_deleted [Integer] The number of rows deleted by the write request.
59
+ #
60
+ # @param rows_patched [Integer] The number of rows patched by the write request.
61
+ #
62
+ # @param rows_upserted [Integer] The number of rows upserted by the write request.
63
+ #
64
+ # @param status [Symbol, :OK] The status of the request.
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class Query < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute aggregate_by
7
+ # Aggregations to compute over all documents in the namespace that match the
8
+ # filters.
9
+ #
10
+ # @return [Hash{Symbol=>Object}, nil]
11
+ optional :aggregate_by, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
12
+
13
+ # @!attribute distance_metric
14
+ # A function used to calculate vector similarity.
15
+ #
16
+ # @return [Symbol, Turbopuffer::Models::DistanceMetric, nil]
17
+ optional :distance_metric, enum: -> { Turbopuffer::DistanceMetric }
18
+
19
+ # @!attribute filters
20
+ # Exact filters for attributes to refine search results for. Think of it as a SQL
21
+ # WHERE clause.
22
+ #
23
+ # @return [Object, nil]
24
+ optional :filters, Turbopuffer::Internal::Type::Unknown
25
+
26
+ # @!attribute include_attributes
27
+ # Whether to include attributes in the response.
28
+ #
29
+ # @return [Boolean, Array<String>, nil]
30
+ optional :include_attributes, union: -> { Turbopuffer::IncludeAttributes }
31
+
32
+ # @!attribute rank_by
33
+ # How to rank the documents in the namespace.
34
+ #
35
+ # @return [Object, nil]
36
+ optional :rank_by, Turbopuffer::Internal::Type::Unknown
37
+
38
+ # @!attribute top_k
39
+ # The number of results to return.
40
+ #
41
+ # @return [Integer, nil]
42
+ optional :top_k, Integer
43
+
44
+ # @!method initialize(aggregate_by: nil, distance_metric: nil, filters: nil, include_attributes: nil, rank_by: nil, top_k: nil)
45
+ # Some parameter documentations has been truncated, see
46
+ # {Turbopuffer::Models::Query} for more details.
47
+ #
48
+ # Query, filter, full-text search and vector search documents.
49
+ #
50
+ # @param aggregate_by [Hash{Symbol=>Object}] Aggregations to compute over all documents in the namespace that match the filte
51
+ #
52
+ # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
53
+ #
54
+ # @param filters [Object] Exact filters for attributes to refine search results for. Think of it as a SQL
55
+ #
56
+ # @param include_attributes [Boolean, Array<String>] Whether to include attributes in the response.
57
+ #
58
+ # @param rank_by [Object] How to rank the documents in the namespace.
59
+ #
60
+ # @param top_k [Integer] The number of results to return.
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class QueryBilling < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute billable_logical_bytes_queried
7
+ # The number of billable logical bytes queried from the namespace.
8
+ #
9
+ # @return [Integer]
10
+ required :billable_logical_bytes_queried, Integer
11
+
12
+ # @!attribute billable_logical_bytes_returned
13
+ # The number of billable logical bytes returned from the query.
14
+ #
15
+ # @return [Integer]
16
+ required :billable_logical_bytes_returned, Integer
17
+
18
+ # @!method initialize(billable_logical_bytes_queried:, billable_logical_bytes_returned:)
19
+ # The billing information for a query.
20
+ #
21
+ # @param billable_logical_bytes_queried [Integer] The number of billable logical bytes queried from the namespace.
22
+ #
23
+ # @param billable_logical_bytes_returned [Integer] The number of billable logical bytes returned from the query.
24
+ end
25
+ end
26
+ end