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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9b214208dbf23c334c0a464b1dcb97937aeab3f74ca8b9afa5a001dc4cb5a2e
4
- data.tar.gz: b49f0fe71b1423e38e53e07277a6ca8567ea04534279e498466a50cbd59aad1d
3
+ metadata.gz: f74c1ea6246584d6e391d41a0a1389cf2258bd6d47a36db1f93ed0b1722efb24
4
+ data.tar.gz: 754d17967417cd4767bd94563c99bb6b6eea2625d2d1ba440d49dd9ca19ee7c1
5
5
  SHA512:
6
- metadata.gz: 3282d03c38c4f1cecf53d38f7b50356a1fd3571d6f16f422ffab07f25fbe28db2653987850d5b52e5dad2daefba0df803225d4fc6a898b0b6372dae240669659
7
- data.tar.gz: 4092bf2ccbf9df5e2be3f44752eb2d16b3625f62ea5bd95585451f2b3a4fae8a41b01baaefd759a51e11ce861bcdd492f8ce3598c5e73d3a84fb28ccedb98006
6
+ metadata.gz: 91baba24abe1f1a02347206aea162b5ac024f5cc82a7fc37282e7d074258e0c4eaeeff1d8929597c5a1c2a6078dcfd24343fdb22a8df9d22bd3dcde418f790d8
7
+ data.tar.gz: 8a30736b4f51cf69ad85ec23736d08138025f198dc5d97b73e4f7baeb75625ca02701a38029af28294421fff747d18b1cad5f78262d69a75ab92833aca818a97
data/.ignore ADDED
@@ -0,0 +1,2 @@
1
+ rbi/*
2
+ sig/*
data/CHANGELOG.md ADDED
@@ -0,0 +1,205 @@
1
+ # Changelog
2
+
3
+ ## 1.2.0 (2025-09-17)
4
+
5
+ Full Changelog: [v1.1.0...v1.2.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v1.1.0...v1.2.0)
6
+
7
+ ### Features
8
+
9
+ * expose response headers for both streams and errors ([05ceb63](https://github.com/turbopuffer/turbopuffer-ruby/commit/05ceb63799123872cae25afcc227ef3e5c0801b6))
10
+ * spec: move Ruby gem to `turbopuffer` ([c971adc](https://github.com/turbopuffer/turbopuffer-ruby/commit/c971adcdb550ecdb2796174dc823b7f611ba4686))
11
+
12
+ ## 1.1.0 (2025-09-11)
13
+
14
+ Full Changelog: [v1.0.0...v1.1.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v1.0.0...v1.1.0)
15
+
16
+ ### Features
17
+
18
+ * spec: add dedicated type for AggregationGroup response ([e30bb79](https://github.com/turbopuffer/turbopuffer-ruby/commit/e30bb796ff91b36d3f9424674470eb84feeaad63))
19
+ * tpuf: add include_ground_truth option to recall endpoint ([9d535c4](https://github.com/turbopuffer/turbopuffer-ruby/commit/9d535c44ce64f47a312a693d009506d635230322))
20
+
21
+ ## 1.0.0 (2025-08-28)
22
+
23
+ Full Changelog: [v0.2.6...v1.0.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.2.6...v1.0.0)
24
+
25
+ ### Features
26
+
27
+ * Make word_v2 the default FTS tokenizer ([80b7df4](https://github.com/turbopuffer/turbopuffer-ruby/commit/80b7df45beb96368a97af615330eb9bdff415577))
28
+
29
+
30
+ ### Bug Fixes
31
+
32
+ * bump sorbet version and fix new type errors from the breaking change ([751bf80](https://github.com/turbopuffer/turbopuffer-ruby/commit/751bf8010f07d33521d73c40b49ca341f9d26505))
33
+
34
+
35
+ ### Chores
36
+
37
+ * add json schema comment for rubocop.yml ([ce20bd0](https://github.com/turbopuffer/turbopuffer-ruby/commit/ce20bd0db6a9cead8cd66874a29a4c99c857b31e))
38
+
39
+ ## 0.2.6 (2025-08-18)
40
+
41
+ Full Changelog: [v0.2.5...v0.2.6](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.2.5...v0.2.6)
42
+
43
+ ### Bug Fixes
44
+
45
+ * **api:** add support for `group_by` query parameter ([c4e6261](https://github.com/turbopuffer/turbopuffer-ruby/commit/c4e626148df5642d654e5ae739d07588fcd4ad5d))
46
+ * remove 200 error code for hint_cache_warm API call (always 202 now) ([bbd6d75](https://github.com/turbopuffer/turbopuffer-ruby/commit/bbd6d759e25a1b7b4dd8e3208acc1089f1d35f36))
47
+
48
+
49
+ ### Chores
50
+
51
+ * **internal:** codegen related update ([880022b](https://github.com/turbopuffer/turbopuffer-ruby/commit/880022bea36595da811d14bd5a2e610624b283eb))
52
+
53
+ ## 0.2.5 (2025-08-11)
54
+
55
+ Full Changelog: [v0.2.4...v0.2.5](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.2.4...v0.2.5)
56
+
57
+ ### Chores
58
+
59
+ * collect metadata from type DSL ([79bb9bd](https://github.com/turbopuffer/turbopuffer-ruby/commit/79bb9bd39297006af6693580f09d35c1c801500f))
60
+ * **internal:** update comment in script ([0b151c0](https://github.com/turbopuffer/turbopuffer-ruby/commit/0b151c035ce5ba8785c3499247843428ba8267bd))
61
+ * update @stainless-api/prism-cli to v5.15.0 ([bb9a4b1](https://github.com/turbopuffer/turbopuffer-ruby/commit/bb9a4b1de0ac931671b2abeefa9c4cf8a67bae63))
62
+
63
+ ## 0.2.4 (2025-08-01)
64
+
65
+ Full Changelog: [v0.2.3...v0.2.4](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.2.3...v0.2.4)
66
+
67
+ ### Bug Fixes
68
+
69
+ * **api:** api update ([900bd73](https://github.com/turbopuffer/turbopuffer-ruby/commit/900bd73a945bdb8af7d1c23d7f44a359a154c1aa))
70
+ * **api:** api update ([d63b961](https://github.com/turbopuffer/turbopuffer-ruby/commit/d63b9613a0827be0969a218a29df23934ef8c46f))
71
+
72
+
73
+ ### Chores
74
+
75
+ * **internal:** increase visibility of internal helper method ([fc6e1e7](https://github.com/turbopuffer/turbopuffer-ruby/commit/fc6e1e7c7a5824c751d32bb3f88ab8c716f763cf))
76
+
77
+ ## 0.2.3 (2025-07-29)
78
+
79
+ Full Changelog: [v0.2.2...v0.2.3](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.2.2...v0.2.3)
80
+
81
+ ### Bug Fixes
82
+
83
+ * **api:** api update ([fc8709f](https://github.com/turbopuffer/turbopuffer-ruby/commit/fc8709fbebe7d26a2d82a8ba3c28b0e7f606cea2))
84
+ * **api:** api update ([5295ae2](https://github.com/turbopuffer/turbopuffer-ruby/commit/5295ae24caff9edd7acc8f14a8321323a831cf70))
85
+
86
+ ## 0.2.2 (2025-07-29)
87
+
88
+ Full Changelog: [v0.2.1...v0.2.2](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.2.1...v0.2.2)
89
+
90
+ ### Bug Fixes
91
+
92
+ * **api:** api update ([9650229](https://github.com/turbopuffer/turbopuffer-ruby/commit/965022936b5551d035ccba9dceb98f7b180ed34d))
93
+ * **api:** api update ([f27319a](https://github.com/turbopuffer/turbopuffer-ruby/commit/f27319a7f811a5f6975acbb2d714c113f32fb8e8))
94
+ * **internal:** ensure sorbet test always runs serially ([954ee15](https://github.com/turbopuffer/turbopuffer-ruby/commit/954ee1533f161a7da823cd98077edb0d7bb4b750))
95
+
96
+ ## 0.2.1 (2025-07-28)
97
+
98
+ Full Changelog: [v0.2.0...v0.2.1](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.2.0...v0.2.1)
99
+
100
+ ### Bug Fixes
101
+
102
+ * **api:** api update ([1e4eca8](https://github.com/turbopuffer/turbopuffer-ruby/commit/1e4eca8d1810c7b692a2922b6b2e0093f0a5cab3))
103
+
104
+
105
+ ### Chores
106
+
107
+ * update contribute.md ([3eba4ef](https://github.com/turbopuffer/turbopuffer-ruby/commit/3eba4ef08cf0ab697a19a9fec242926badf5e9e9))
108
+
109
+ ## 0.2.0 (2025-07-22)
110
+
111
+ Full Changelog: [v0.2.0-beta.1...v0.2.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.2.0-beta.1...v0.2.0)
112
+
113
+ ### Chores
114
+
115
+ * **internal:** version bump ([fbca51e](https://github.com/turbopuffer/turbopuffer-ruby/commit/fbca51ebf45d575644d28890d2717cf31d2306dc))
116
+
117
+ ## 0.2.0-beta.1 (2025-07-22)
118
+
119
+ Full Changelog: [v0.2.0-alpha.3...v0.2.0-beta.1](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.2.0-alpha.3...v0.2.0-beta.1)
120
+
121
+ ### Chores
122
+
123
+ * **internal:** version bump ([e91cbf9](https://github.com/turbopuffer/turbopuffer-ruby/commit/e91cbf90846f748935512620e0c46bd765c8790c))
124
+
125
+ ## 0.2.0-alpha.3 (2025-07-22)
126
+
127
+ Full Changelog: [v0.2.0-alpha.2...v0.2.0-alpha.3](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.2.0-alpha.2...v0.2.0-alpha.3)
128
+
129
+ ### Bug Fixes
130
+
131
+ * allow modifying Row objects in place ([269929a](https://github.com/turbopuffer/turbopuffer-ruby/commit/269929aace3a3b69a5db972d1382a01080f0c70a))
132
+ * improve the README example ([84793e6](https://github.com/turbopuffer/turbopuffer-ruby/commit/84793e649a8b45d3e7c0826c90899a3b25220190))
133
+ * **internal:** tests should use normalized property names ([a2bfe81](https://github.com/turbopuffer/turbopuffer-ruby/commit/a2bfe81c3149796e0d2fed0e54db8e6deacef03b))
134
+
135
+
136
+ ### Chores
137
+
138
+ * **internal:** version bump ([9ac2013](https://github.com/turbopuffer/turbopuffer-ruby/commit/9ac201321f311c97923ed9c667d88d1b9c4221f0))
139
+
140
+ ## 0.2.0-alpha.2 (2025-07-21)
141
+
142
+ Full Changelog: [v0.2.0-alpha.1...v0.2.0-alpha.2](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.2.0-alpha.1...v0.2.0-alpha.2)
143
+
144
+ ### Chores
145
+
146
+ * **internal:** version bump ([1f8048f](https://github.com/turbopuffer/turbopuffer-ruby/commit/1f8048f35780345a9f8de1ff55daa136fab72ff1))
147
+
148
+ ## 0.2.0-alpha.1 (2025-07-21)
149
+
150
+ Full Changelog: [v0.1.0-alpha.2...v0.2.0-alpha.1](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.1.0-alpha.2...v0.2.0-alpha.1)
151
+
152
+ ### Features
153
+
154
+ * **api:** introduce dedicated Query model ([420e42b](https://github.com/turbopuffer/turbopuffer-ruby/commit/420e42b03f05bafb3441e15167349184ac6705da))
155
+
156
+
157
+ ### Bug Fixes
158
+
159
+ * **api:** api update ([7348b90](https://github.com/turbopuffer/turbopuffer-ruby/commit/7348b90f988b59a00f5bb6adb76467a699da8273))
160
+ * **api:** api update ([e600278](https://github.com/turbopuffer/turbopuffer-ruby/commit/e60027807e7ca72cc92dae225c1afebb2b5bc455))
161
+ * **api:** api update ([823d059](https://github.com/turbopuffer/turbopuffer-ruby/commit/823d05948dfb60656d7388ea7d25f11b86e41eb3))
162
+ * **api:** api update ([6380572](https://github.com/turbopuffer/turbopuffer-ruby/commit/63805720cbaf84f048907907e86831fdaa19c546))
163
+ * **api:** api update ([ca95879](https://github.com/turbopuffer/turbopuffer-ruby/commit/ca958796c50576e1c3beb80d4e1eba4b63563b56))
164
+ * **api:** api update ([6f54464](https://github.com/turbopuffer/turbopuffer-ruby/commit/6f544641410f009b954f499a5771fb62965d2750))
165
+ * **ci:** plumb API key to tests ([25603e1](https://github.com/turbopuffer/turbopuffer-ruby/commit/25603e1dff1af7f8d0a4cc5163341b039b3483fc))
166
+ * **ci:** release-doctor — report correct token name ([df0b386](https://github.com/turbopuffer/turbopuffer-ruby/commit/df0b386b694d8b46df995553dd4c4e8116eab1b5))
167
+ * don't require region unless baseUrl contains {region} placeholder ([2d537ff](https://github.com/turbopuffer/turbopuffer-ruby/commit/2d537ff0a6ce8af113b724143b38ab573591c62e))
168
+ * formatting ([5d1aa92](https://github.com/turbopuffer/turbopuffer-ruby/commit/5d1aa92fb0a17331a4c228b01301581601767d22))
169
+ * issue where we cannot mutate arrays on base model derivatives ([bc889aa](https://github.com/turbopuffer/turbopuffer-ruby/commit/bc889aa6865671327bf7f6349bff783f2242a005))
170
+ * request parameters should not be marked required if they can be derived from client properties ([aaa1c73](https://github.com/turbopuffer/turbopuffer-ruby/commit/aaa1c73043810c7d7a12aae8972c0e616765308a))
171
+ * **test:** provide distance_metric ([2c41aee](https://github.com/turbopuffer/turbopuffer-ruby/commit/2c41aee42d290fd3bbd8641eb937f8644b324311))
172
+
173
+
174
+ ### Chores
175
+
176
+ * **ci:** enable for pull requests ([0abb0af](https://github.com/turbopuffer/turbopuffer-ruby/commit/0abb0afaaf0ab9b749eaee2fe602b65a64457945))
177
+ * **ci:** only run for pushes and fork pull requests ([eb299b8](https://github.com/turbopuffer/turbopuffer-ruby/commit/eb299b82e3884da5fa620d338be2c2bc6e7e79a9))
178
+ * **internal:** allow streams to also be unwrapped on a per-row basis ([85fbc15](https://github.com/turbopuffer/turbopuffer-ruby/commit/85fbc151fba8e0262a5ae106beecaa6e8eb310c7))
179
+
180
+ ## 0.1.0-alpha.2 (2025-06-14)
181
+
182
+ Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
183
+
184
+ ### Features
185
+
186
+ * add namespace resource and example ([5340ac0](https://github.com/turbopuffer/turbopuffer-ruby/commit/5340ac0b02ccf08dc23df33b1e75ccaa0d7c4ee7))
187
+
188
+
189
+ ### Chores
190
+
191
+ * sync repo ([816cc8d](https://github.com/turbopuffer/turbopuffer-ruby/commit/816cc8d9a8ac706c77023e7833c2cad49bc63357))
192
+
193
+ ## 0.1.0-alpha.1 (2025-06-14)
194
+
195
+ Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/turbopuffer/turbopuffer-ruby/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
196
+
197
+ ### Features
198
+
199
+ * add namespace resource and example ([f72d1f8](https://github.com/turbopuffer/turbopuffer-ruby/commit/f72d1f8d4bdb726f1a05b70be104eff825913fe9))
200
+
201
+
202
+ ### Chores
203
+
204
+ * configure new SDK language ([80e0005](https://github.com/turbopuffer/turbopuffer-ruby/commit/80e0005caa84cf6b8d120f78c2d13245d7b2db48))
205
+ * sync repo ([3498e80](https://github.com/turbopuffer/turbopuffer-ruby/commit/3498e802bc2ae9cfe2292b33c803a7762999a5ac))
data/README.md CHANGED
@@ -1,67 +1,297 @@
1
- # Turbopuffer
1
+ # Turbopuffer Ruby API library
2
2
 
3
- A Ruby client for accessing the Turbopuffer API.
3
+ The Turbopuffer Ruby library provides convenient access to the Turbopuffer REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/turbopuffer/turbopuffer-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.
4
+
5
+ It is generated with [Stainless](https://www.stainless.com/).
6
+
7
+ ## Documentation
8
+
9
+ Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/turbopuffer).
10
+
11
+ The REST API documentation can be found on [turbopuffer.com](https://turbopuffer.com/docs/auth).
4
12
 
5
13
  ## Installation
6
14
 
7
- TODO: Replace
8
- `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your
9
- gem name right after releasing it to RubyGems.org. Please do not do it earlier
10
- due to security reasons. Alternatively, replace this section with instructions
11
- to install your gem from git if you don't plan to release to RubyGems.org.
15
+ To use this gem, install via Bundler by adding the following to your application's `Gemfile`:
16
+
17
+ <!-- x-release-please-start-version -->
18
+
19
+ ```ruby
20
+ gem "turbopuffer", "~> 1.2.0"
21
+ ```
22
+
23
+ <!-- x-release-please-end -->
24
+
25
+ ## Usage
26
+
27
+ ```ruby
28
+ require "bundler/setup"
29
+ require "turbopuffer"
30
+ require "json"
31
+
32
+ tpuf = Turbopuffer::Client.new(
33
+ # API tokens are created in the dashboard: https://turbopuffer.com/dashboard
34
+ api_key: ENV["TURBOPUFFER_API_KEY"],
35
+ # Pick the right region: https://turbopuffer.com/docs/regions
36
+ region: "gcp-us-central1",
37
+ )
38
+
39
+ ns = tpuf.namespace("example")
12
40
 
13
- Install the gem and add to the application's Gemfile by executing:
41
+ # Query nearest neighbors with filter
42
+ result = ns.query(
43
+ rank_by: ["vector", "ANN", openai_or_rand_vector("walrus narwhal")],
44
+ top_k: 10,
45
+ filters: ["And", [["name", "Eq", "foo"], ["public", "Eq", 1]]],
46
+ include_attributes: ["name"],
47
+ )
48
+ puts result.rows
49
+ # {id: 1, "$dist": 0.0, name: "foo"}
14
50
 
15
- ```bash
16
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
51
+ # Full-text search on an attribute
52
+ # If you want to combine FTS and vector search, see https://turbopuffer.com/docs/hybrid-search
53
+ result = ns.query(
54
+ top_k: 10,
55
+ filters: ["name", "Eq", "foo"],
56
+ rank_by: ["text", "BM25", "quick walrus"],
57
+ )
58
+ puts result.rows
59
+ # {id: 1, "$dist": 0.19856808}
60
+ # {id: 2, "$dist": 0.16853257}
61
+
62
+ # See https://turbopuffer.com/docs/quickstart for more.s
17
63
  ```
18
64
 
19
- If bundler is not being used to manage dependencies, install the gem by
20
- executing:
65
+ ### Pagination
66
+
67
+ List methods in the Turbopuffer API are paginated.
21
68
 
22
- ```bash
23
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
69
+ This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
70
+
71
+ ```ruby
72
+ page = turbopuffer.namespaces(prefix: "products")
73
+
74
+ # Fetch single item from page.
75
+ client = page.namespaces[0]
76
+ puts(client.id)
77
+
78
+ # Automatically fetches more pages as needed.
79
+ page.auto_paging_each do |client|
80
+ puts(client.id)
81
+ end
24
82
  ```
25
83
 
26
- ## Usage
84
+ Alternatively, you can use the `#next_page?` and `#next_page` methods for more granular control working with pages.
27
85
 
28
86
  ```ruby
29
- tpuf = Turbopuffer::Client.new("your-token")
87
+ if page.next_page?
88
+ new_page = page.next_page
89
+ puts(new_page.namespaces[0].id)
90
+ end
91
+ ```
30
92
 
31
- ns = tpuf.namespace("namespace-name")
93
+ ### Handling errors
32
94
 
33
- ns.upsert(
34
- ids: [1, 2],
35
- vectors: [[0.1, 0.2], [0.3, 0.4]],
36
- attributes: {name: ["foo", "bar"]}
95
+ When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Turbopuffer::Errors::APIError` will be thrown:
96
+
97
+ ```ruby
98
+ begin
99
+ client = turbopuffer.namespaces(prefix: "foo")
100
+ rescue Turbopuffer::Errors::APIConnectionError => e
101
+ puts("The server could not be reached")
102
+ puts(e.cause) # an underlying Exception, likely raised within `net/http`
103
+ rescue Turbopuffer::Errors::RateLimitError => e
104
+ puts("A 429 status code was received; we should back off a bit.")
105
+ rescue Turbopuffer::Errors::APIStatusError => e
106
+ puts("Another non-200-range status code was received")
107
+ puts(e.status)
108
+ end
109
+ ```
110
+
111
+ Error codes are as follows:
112
+
113
+ | Cause | Error Type |
114
+ | ---------------- | -------------------------- |
115
+ | HTTP 400 | `BadRequestError` |
116
+ | HTTP 401 | `AuthenticationError` |
117
+ | HTTP 403 | `PermissionDeniedError` |
118
+ | HTTP 404 | `NotFoundError` |
119
+ | HTTP 409 | `ConflictError` |
120
+ | HTTP 422 | `UnprocessableEntityError` |
121
+ | HTTP 429 | `RateLimitError` |
122
+ | HTTP >= 500 | `InternalServerError` |
123
+ | Other HTTP error | `APIStatusError` |
124
+ | Timeout | `APITimeoutError` |
125
+ | Network error | `APIConnectionError` |
126
+
127
+ ### Retries
128
+
129
+ Certain errors will be automatically retried 4 times by default, with a short exponential backoff.
130
+
131
+ Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.
132
+
133
+ You can use the `max_retries` option to configure or disable this:
134
+
135
+ ```ruby
136
+ # Configure the default for all requests:
137
+ turbopuffer = Turbopuffer::Client.new(
138
+ max_retries: 0 # default is 4
37
139
  )
38
140
 
39
- results = ns.query(
40
- vector: [0.15, 0.22],
41
- top_k: 10
141
+ # Or, configure per-request:
142
+ turbopuffer.namespaces(prefix: "foo", request_options: {max_retries: 5})
143
+ ```
144
+
145
+ ### Timeouts
146
+
147
+ By default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this:
148
+
149
+ ```ruby
150
+ # Configure the default for all requests:
151
+ turbopuffer = Turbopuffer::Client.new(
152
+ timeout: nil # default is 60
42
153
  )
43
154
 
44
- ns.delete_all
155
+ # Or, configure per-request:
156
+ turbopuffer.namespaces(prefix: "foo", request_options: {timeout: 5})
45
157
  ```
46
158
 
47
- ## Development
159
+ On timeout, `Turbopuffer::Errors::APITimeoutError` is raised.
48
160
 
49
- After checking out the repo, run `bin/setup` to install dependencies. Then, run
50
- `rake test` to run the tests. You can also run `bin/console` for an interactive
51
- prompt that will allow you to experiment.
161
+ Note that requests that time out are retried by default.
52
162
 
53
- To install this gem onto your local machine, run `bundle exec rake install`. To
54
- release a new version, update the version number in `version.rb`, and then run
55
- `bundle exec rake release`, which will create a git tag for the version, push
56
- git commits and the created tag, and push the `.gem` file to
57
- [rubygems.org](https://rubygems.org).
163
+ ## Advanced concepts
58
164
 
59
- ## Contributing
165
+ ### BaseModel
166
+
167
+ All parameter and response objects inherit from `Turbopuffer::Internal::Type::BaseModel`, which provides several conveniences, including:
168
+
169
+ 1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.
170
+
171
+ 2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.
172
+
173
+ 3. Both instances and the classes themselves can be pretty-printed.
174
+
175
+ 4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.
176
+
177
+ ### Making custom or undocumented requests
178
+
179
+ #### Undocumented properties
180
+
181
+ You can send undocumented parameters to any endpoint, and read undocumented response properties, like so:
60
182
 
61
- Bug reports and pull requests are welcome on GitHub at
62
- https://github.com/xymbol/turbopuffer-ruby.
183
+ Note: the `extra_` parameters of the same name overrides the documented parameters.
63
184
 
64
- ## License
185
+ ```ruby
186
+ page =
187
+ turbopuffer.namespaces(
188
+ prefix: "foo",
189
+ request_options: {
190
+ extra_query: {my_query_parameter: value},
191
+ extra_body: {my_body_parameter: value},
192
+ extra_headers: {"my-header": value}
193
+ }
194
+ )
195
+
196
+ puts(page[:my_undocumented_property])
197
+ ```
198
+
199
+ #### Undocumented request params
200
+
201
+ If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.
202
+
203
+ #### Undocumented endpoints
204
+
205
+ To make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:
206
+
207
+ ```ruby
208
+ response = client.request(
209
+ method: :post,
210
+ path: '/undocumented/endpoint',
211
+ query: {"dog": "woof"},
212
+ headers: {"useful-header": "interesting-value"},
213
+ body: {"hello": "world"}
214
+ )
215
+ ```
216
+
217
+ ### Concurrency & connection pooling
218
+
219
+ The `Turbopuffer::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.
220
+
221
+ Each instance of `Turbopuffer::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.
222
+
223
+ When all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.
224
+
225
+ Unless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.
226
+
227
+ ## Sorbet
228
+
229
+ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.
230
+
231
+ You can provide typesafe request parameters like so:
232
+
233
+ ```ruby
234
+ turbopuffer.namespace("products").write(
235
+ distance_metric: "cosine_distance",
236
+ upsert_rows: [Turbopuffer::Row.new(id: "2108ed60-6851-49a0-9016-8325434f3845", vector: [0.1, 0.2])]
237
+ )
238
+ ```
239
+
240
+ Or, equivalently:
241
+
242
+ ```ruby
243
+ # Hashes work, but are not typesafe:
244
+ turbopuffer.namespace("products").write(
245
+ distance_metric: "cosine_distance",
246
+ upsert_rows: [{id: "2108ed60-6851-49a0-9016-8325434f3845", vector: [0.1, 0.2]}]
247
+ )
248
+
249
+ # You can also splat a full Params class:
250
+ params = Turbopuffer::NamespaceWriteParams.new(
251
+ distance_metric: "cosine_distance",
252
+ upsert_rows: [Turbopuffer::Row.new(id: "2108ed60-6851-49a0-9016-8325434f3845", vector: [0.1, 0.2])]
253
+ )
254
+ turbopuffer.namespace("products").write(**params)
255
+ ```
256
+
257
+ ### Enums
258
+
259
+ Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:
260
+
261
+ ```ruby
262
+ # :cosine_distance
263
+ puts(Turbopuffer::DistanceMetric::COSINE_DISTANCE)
264
+
265
+ # Revealed type: `T.all(Turbopuffer::DistanceMetric, Symbol)`
266
+ T.reveal_type(Turbopuffer::DistanceMetric::COSINE_DISTANCE)
267
+ ```
268
+
269
+ Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
270
+
271
+ ```ruby
272
+ # Using the enum constants preserves the tagged type information:
273
+ turbopuffer.namespaces.explain_query(
274
+ distance_metric: Turbopuffer::DistanceMetric::COSINE_DISTANCE,
275
+ # …
276
+ )
277
+
278
+ # Literal values are also permissible:
279
+ turbopuffer.namespaces.explain_query(
280
+ distance_metric: :cosine_distance,
281
+ # …
282
+ )
283
+ ```
284
+
285
+ ## Versioning
286
+
287
+ This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.
288
+
289
+ This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.
290
+
291
+ ## Requirements
292
+
293
+ Ruby 3.2.0 or higher.
294
+
295
+ ## Contributing
65
296
 
66
- The gem is available as open source under the terms of the [MIT
67
- License](https://opensource.org/licenses/MIT).
297
+ See [the contributing documentation](https://github.com/turbopuffer/turbopuffer-ruby/tree/main/CONTRIBUTING.md).
data/SECURITY.md ADDED
@@ -0,0 +1,27 @@
1
+ # Security Policy
2
+
3
+ ## Reporting Security Issues
4
+
5
+ This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
6
+
7
+ To report a security issue, please contact the Stainless team at security@stainless.com.
8
+
9
+ ## Responsible Disclosure
10
+
11
+ We appreciate the efforts of security researchers and individuals who help us maintain the security of
12
+ SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible
13
+ disclosure practices by allowing us a reasonable amount of time to investigate and address the issue
14
+ before making any information public.
15
+
16
+ ## Reporting Non-SDK Related Security Issues
17
+
18
+ If you encounter security issues that are not directly related to SDKs but pertain to the services
19
+ or products provided by Turbopuffer, please follow the respective company's security reporting guidelines.
20
+
21
+ ### Turbopuffer Terms and Policies
22
+
23
+ Please contact info@turbopuffer.com for any questions or concerns regarding the security of our services.
24
+
25
+ ---
26
+
27
+ Thank you for helping us keep the SDKs and systems they interact with secure.