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,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,81 @@
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 exclude_attributes
20
+ # List of attribute names to exclude from the response. All other attributes will
21
+ # be included in the response.
22
+ #
23
+ # @return [Array<String>, nil]
24
+ optional :exclude_attributes, Turbopuffer::Internal::Type::ArrayOf[String]
25
+
26
+ # @!attribute filters
27
+ # Exact filters for attributes to refine search results for. Think of it as a SQL
28
+ # WHERE clause.
29
+ #
30
+ # @return [Object, nil]
31
+ optional :filters, Turbopuffer::Internal::Type::Unknown
32
+
33
+ # @!attribute group_by
34
+ # Groups documents by the specified attributes (the "group key") before computing
35
+ # aggregates. Aggregates are computed separately for each group.
36
+ #
37
+ # @return [Array<String>, nil]
38
+ optional :group_by, Turbopuffer::Internal::Type::ArrayOf[String]
39
+
40
+ # @!attribute include_attributes
41
+ # Whether to include attributes in the response.
42
+ #
43
+ # @return [Boolean, Array<String>, nil]
44
+ optional :include_attributes, union: -> { Turbopuffer::IncludeAttributes }
45
+
46
+ # @!attribute rank_by
47
+ # How to rank the documents in the namespace.
48
+ #
49
+ # @return [Object, nil]
50
+ optional :rank_by, Turbopuffer::Internal::Type::Unknown
51
+
52
+ # @!attribute top_k
53
+ # The number of results to return.
54
+ #
55
+ # @return [Integer, nil]
56
+ optional :top_k, Integer
57
+
58
+ # @!method initialize(aggregate_by: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, rank_by: nil, top_k: nil)
59
+ # Some parameter documentations has been truncated, see
60
+ # {Turbopuffer::Models::Query} for more details.
61
+ #
62
+ # Query, filter, full-text search and vector search documents.
63
+ #
64
+ # @param aggregate_by [Hash{Symbol=>Object}] Aggregations to compute over all documents in the namespace that match the filte
65
+ #
66
+ # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
67
+ #
68
+ # @param exclude_attributes [Array<String>] List of attribute names to exclude from the response. All other attributes will
69
+ #
70
+ # @param filters [Object] Exact filters for attributes to refine search results for. Think of it as a SQL
71
+ #
72
+ # @param group_by [Array<String>] Groups documents by the specified attributes (the "group key") before computing
73
+ #
74
+ # @param include_attributes [Boolean, Array<String>] Whether to include attributes in the response.
75
+ #
76
+ # @param rank_by [Object] How to rank the documents in the namespace.
77
+ #
78
+ # @param top_k [Integer] The number of results to return.
79
+ end
80
+ end
81
+ 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
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class QueryPerformance < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute approx_namespace_size
7
+ # the approximate number of documents in the namespace.
8
+ #
9
+ # @return [Integer]
10
+ required :approx_namespace_size, Integer
11
+
12
+ # @!attribute cache_hit_ratio
13
+ # The ratio of cache hits to total cache lookups.
14
+ #
15
+ # @return [Float]
16
+ required :cache_hit_ratio, Float
17
+
18
+ # @!attribute cache_temperature
19
+ # A qualitative description of the cache hit ratio (`hot`, `warm`, or `cold`).
20
+ #
21
+ # @return [String]
22
+ required :cache_temperature, String
23
+
24
+ # @!attribute exhaustive_search_count
25
+ # The number of unindexed documents processed by the query.
26
+ #
27
+ # @return [Integer]
28
+ required :exhaustive_search_count, Integer
29
+
30
+ # @!attribute query_execution_ms
31
+ # Request time measured on the server, excluding time spent waiting due to the
32
+ # namespace concurrency limit.
33
+ #
34
+ # @return [Integer]
35
+ required :query_execution_ms, Integer
36
+
37
+ # @!attribute server_total_ms
38
+ # Request time measured on the server, including time spent waiting for other
39
+ # queries to complete if the namespace was at its concurrency limit.
40
+ #
41
+ # @return [Integer]
42
+ required :server_total_ms, Integer
43
+
44
+ # @!method initialize(approx_namespace_size:, cache_hit_ratio:, cache_temperature:, exhaustive_search_count:, query_execution_ms:, server_total_ms:)
45
+ # Some parameter documentations has been truncated, see
46
+ # {Turbopuffer::Models::QueryPerformance} for more details.
47
+ #
48
+ # The performance information for a query.
49
+ #
50
+ # @param approx_namespace_size [Integer] the approximate number of documents in the namespace.
51
+ #
52
+ # @param cache_hit_ratio [Float] The ratio of cache hits to total cache lookups.
53
+ #
54
+ # @param cache_temperature [String] A qualitative description of the cache hit ratio (`hot`, `warm`, or `cold`).
55
+ #
56
+ # @param exhaustive_search_count [Integer] The number of unindexed documents processed by the query.
57
+ #
58
+ # @param query_execution_ms [Integer] Request time measured on the server, excluding time spent waiting due to the nam
59
+ #
60
+ # @param server_total_ms [Integer] Request time measured on the server, including time spent waiting for other quer
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class Row < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute id
7
+ # An identifier for a document.
8
+ #
9
+ # @return [String, Integer]
10
+ required :id, union: -> { Turbopuffer::ID }
11
+
12
+ # @!attribute vector
13
+ # A vector embedding associated with a document.
14
+ #
15
+ # @return [Array<Float>, String, nil]
16
+ optional :vector, union: -> { Turbopuffer::Vector }
17
+
18
+ # @!method initialize(id:, vector: nil)
19
+ # A single document, in a row-based format.
20
+ #
21
+ # @param id [String, Integer] An identifier for a document.
22
+ #
23
+ # @param vector [Array<Float>, String] A vector embedding associated with a document.
24
+
25
+ def method_missing(name, *args, &block)
26
+ if @data.key?(name)
27
+ @data[name]
28
+ else
29
+ super
30
+ end
31
+ end
32
+
33
+ def respond_to_missing?(name, include_private = false)
34
+ @data.key?(name) || super
35
+ end
36
+
37
+ def []=(key, value)
38
+ unless key.instance_of?(Symbol)
39
+ raise ArgumentError.new("Expected symbol key for set, got #{key.inspect}")
40
+ end
41
+
42
+ @data[key] = value
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # The tokenizer to use for full-text search on an attribute. Defaults to
6
+ # `word_v2`.
7
+ module Tokenizer
8
+ extend Turbopuffer::Internal::Type::Enum
9
+
10
+ PRE_TOKENIZED_ARRAY = :pre_tokenized_array
11
+ WORD_V0 = :word_v0
12
+ WORD_V1 = :word_v1
13
+ WORD_V2 = :word_v2
14
+
15
+ # @!method self.values
16
+ # @return [Array<Symbol>]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # A vector embedding associated with a document.
6
+ module Vector
7
+ extend Turbopuffer::Internal::Type::Union
8
+
9
+ # A dense vector encoded as an array of floats.
10
+ variant -> { Turbopuffer::Models::Vector::FloatArray }
11
+
12
+ # A dense vector encoded as a base64 string.
13
+ variant String
14
+
15
+ # @!method self.variants
16
+ # @return [Array(Array<Float>, String)]
17
+
18
+ # @type [Turbopuffer::Internal::Type::Converter]
19
+ FloatArray = Turbopuffer::Internal::Type::ArrayOf[Float]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ # The encoding to use for vectors in the response.
6
+ module VectorEncoding
7
+ extend Turbopuffer::Internal::Type::Enum
8
+
9
+ FLOAT = :float
10
+ BASE64 = :base64
11
+
12
+ # @!method self.values
13
+ # @return [Array<Symbol>]
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ module Models
5
+ class WriteBilling < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute billable_logical_bytes_written
7
+ # The number of billable logical bytes written to the namespace.
8
+ #
9
+ # @return [Integer]
10
+ required :billable_logical_bytes_written, Integer
11
+
12
+ # @!attribute query
13
+ # The billing information for a query.
14
+ #
15
+ # @return [Turbopuffer::Models::QueryBilling, nil]
16
+ optional :query, -> { Turbopuffer::QueryBilling }
17
+
18
+ # @!method initialize(billable_logical_bytes_written:, query: nil)
19
+ # The billing information for a write request.
20
+ #
21
+ # @param billable_logical_bytes_written [Integer] The number of billable logical bytes written to the namespace.
22
+ #
23
+ # @param query [Turbopuffer::Models::QueryBilling] The billing information for a query.
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Turbopuffer
4
+ [Turbopuffer::Internal::Type::BaseModel, *Turbopuffer::Internal::Type::BaseModel.subclasses].each do |cls|
5
+ cls.define_sorbet_constant!(:OrHash) { T.type_alias { T.any(cls, Turbopuffer::Internal::AnyHash) } }
6
+ end
7
+
8
+ Turbopuffer::Internal::Util.walk_namespaces(Turbopuffer::Models).each do |mod|
9
+ case mod
10
+ in Turbopuffer::Internal::Type::Enum | Turbopuffer::Internal::Type::Union
11
+ mod.constants.each do |name|
12
+ case mod.const_get(name)
13
+ in true | false
14
+ mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
15
+ mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
16
+ in Integer
17
+ mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
18
+ mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
19
+ in Float
20
+ mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
21
+ mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
22
+ in Symbol
23
+ mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
24
+ mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
25
+ else
26
+ end
27
+ end
28
+ else
29
+ end
30
+ end
31
+
32
+ Turbopuffer::Internal::Util.walk_namespaces(Turbopuffer::Models)
33
+ .lazy
34
+ .grep(Turbopuffer::Internal::Type::Union)
35
+ .each do |mod|
36
+ const = :Variants
37
+ next if mod.sorbet_constant_defined?(const)
38
+
39
+ mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
40
+ end
41
+
42
+ # @type [Turbopuffer::Internal::Type::Converter]
43
+ AggregationGroup = Turbopuffer::Models::AggregationGroup
44
+
45
+ AttributeSchema = Turbopuffer::Models::AttributeSchema
46
+
47
+ AttributeSchemaConfig = Turbopuffer::Models::AttributeSchemaConfig
48
+
49
+ AttributeType = Turbopuffer::Models::AttributeType
50
+
51
+ ClientNamespacesParams = Turbopuffer::Models::ClientNamespacesParams
52
+
53
+ Columns = Turbopuffer::Models::Columns
54
+
55
+ DistanceMetric = Turbopuffer::Models::DistanceMetric
56
+
57
+ FullTextSearch = Turbopuffer::Models::FullTextSearch
58
+
59
+ FullTextSearchConfig = Turbopuffer::Models::FullTextSearchConfig
60
+
61
+ ID = Turbopuffer::Models::ID
62
+
63
+ IncludeAttributes = Turbopuffer::Models::IncludeAttributes
64
+
65
+ Language = Turbopuffer::Models::Language
66
+
67
+ NamespaceDeleteAllParams = Turbopuffer::Models::NamespaceDeleteAllParams
68
+
69
+ NamespaceExplainQueryParams = Turbopuffer::Models::NamespaceExplainQueryParams
70
+
71
+ NamespaceHintCacheWarmParams = Turbopuffer::Models::NamespaceHintCacheWarmParams
72
+
73
+ NamespaceMetadata = Turbopuffer::Models::NamespaceMetadata
74
+
75
+ NamespaceMetadataParams = Turbopuffer::Models::NamespaceMetadataParams
76
+
77
+ NamespaceMultiQueryParams = Turbopuffer::Models::NamespaceMultiQueryParams
78
+
79
+ NamespaceQueryParams = Turbopuffer::Models::NamespaceQueryParams
80
+
81
+ NamespaceRecallParams = Turbopuffer::Models::NamespaceRecallParams
82
+
83
+ NamespaceSchemaParams = Turbopuffer::Models::NamespaceSchemaParams
84
+
85
+ NamespaceSummary = Turbopuffer::Models::NamespaceSummary
86
+
87
+ NamespaceUpdateSchemaParams = Turbopuffer::Models::NamespaceUpdateSchemaParams
88
+
89
+ NamespaceWriteParams = Turbopuffer::Models::NamespaceWriteParams
90
+
91
+ Query = Turbopuffer::Models::Query
92
+
93
+ QueryBilling = Turbopuffer::Models::QueryBilling
94
+
95
+ QueryPerformance = Turbopuffer::Models::QueryPerformance
96
+
97
+ Row = Turbopuffer::Models::Row
98
+
99
+ Tokenizer = Turbopuffer::Models::Tokenizer
100
+
101
+ Vector = Turbopuffer::Models::Vector
102
+
103
+ VectorEncoding = Turbopuffer::Models::VectorEncoding
104
+
105
+ WriteBilling = Turbopuffer::Models::WriteBilling
106
+ end