turbopuffer-ruby 0.2.0.pre.alpha.2 → 0.2.0.pre.beta.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +31 -23
- data/lib/turbopuffer/models/row.rb +8 -0
- data/lib/turbopuffer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb071626be13c743cd73481efdd60f4530b1a564f9f6b082482abb14d3c94a1e
|
4
|
+
data.tar.gz: f9e8fa43b52f31880c473e07fba3c2c10f3ff1674a9c16bcff9b4bee1c31b072
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad59f18d9da894b1225989015c1f059d3644ac7c569600cc78b188f3b3e80df3c2b41a76a1a87ea1c675447a1a648c4e841a523cdea3214df99d8146fbff6828
|
7
|
+
data.tar.gz: 75c481bb5a08c129ef6b7734b1c48c9d37a5581f1b4957060cfd7b9041607a73f89b66b9ab4389db3783f2b696e109305f2fe915f9f5ded321b0c6894fe26773
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.2.0-beta.1 (2025-07-22)
|
4
|
+
|
5
|
+
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)
|
6
|
+
|
7
|
+
### Chores
|
8
|
+
|
9
|
+
* **internal:** version bump ([e91cbf9](https://github.com/turbopuffer/turbopuffer-ruby/commit/e91cbf90846f748935512620e0c46bd765c8790c))
|
10
|
+
|
11
|
+
## 0.2.0-alpha.3 (2025-07-22)
|
12
|
+
|
13
|
+
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)
|
14
|
+
|
15
|
+
### Bug Fixes
|
16
|
+
|
17
|
+
* allow modifying Row objects in place ([269929a](https://github.com/turbopuffer/turbopuffer-ruby/commit/269929aace3a3b69a5db972d1382a01080f0c70a))
|
18
|
+
* improve the README example ([84793e6](https://github.com/turbopuffer/turbopuffer-ruby/commit/84793e649a8b45d3e7c0826c90899a3b25220190))
|
19
|
+
* **internal:** tests should use normalized property names ([a2bfe81](https://github.com/turbopuffer/turbopuffer-ruby/commit/a2bfe81c3149796e0d2fed0e54db8e6deacef03b))
|
20
|
+
|
21
|
+
|
22
|
+
### Chores
|
23
|
+
|
24
|
+
* **internal:** version bump ([9ac2013](https://github.com/turbopuffer/turbopuffer-ruby/commit/9ac201321f311c97923ed9c667d88d1b9c4221f0))
|
25
|
+
|
3
26
|
## 0.2.0-alpha.2 (2025-07-21)
|
4
27
|
|
5
28
|
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)
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
17
17
|
<!-- x-release-please-start-version -->
|
18
18
|
|
19
19
|
```ruby
|
20
|
-
gem "turbopuffer-ruby", "~> 0.2.0.pre.
|
20
|
+
gem "turbopuffer-ruby", "~> 0.2.0.pre.beta.1"
|
21
21
|
```
|
22
22
|
|
23
23
|
<!-- x-release-please-end -->
|
@@ -27,19 +27,39 @@ gem "turbopuffer-ruby", "~> 0.2.0.pre.alpha.2"
|
|
27
27
|
```ruby
|
28
28
|
require "bundler/setup"
|
29
29
|
require "turbopuffer"
|
30
|
+
require "json"
|
30
31
|
|
31
|
-
|
32
|
-
|
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",
|
33
37
|
)
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
]
|
39
|
+
ns = tpuf.namespace("example")
|
40
|
+
|
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"],
|
40
47
|
)
|
48
|
+
puts result.rows
|
49
|
+
# {id: 1, "$dist": 0.0, name: "foo"}
|
50
|
+
|
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}
|
41
61
|
|
42
|
-
|
62
|
+
# See https://turbopuffer.com/docs/quickstart for more.s
|
43
63
|
```
|
44
64
|
|
45
65
|
### Pagination
|
@@ -213,13 +233,7 @@ You can provide typesafe request parameters like so:
|
|
213
233
|
```ruby
|
214
234
|
turbopuffer.namespace("products").write(
|
215
235
|
distance_metric: "cosine_distance",
|
216
|
-
upsert_rows: [
|
217
|
-
Turbopuffer::Row.new(
|
218
|
-
id: "2108ed60-6851-49a0-9016-8325434f3845",
|
219
|
-
vector: [0.1, 0.2],
|
220
|
-
attributes: {name: "Red boots", price: 34.99}
|
221
|
-
)
|
222
|
-
]
|
236
|
+
upsert_rows: [Turbopuffer::Row.new(id: "2108ed60-6851-49a0-9016-8325434f3845", vector: [0.1, 0.2])]
|
223
237
|
)
|
224
238
|
```
|
225
239
|
|
@@ -237,13 +251,7 @@ turbopuffer.namespace("products").write(
|
|
237
251
|
# You can also splat a full Params class:
|
238
252
|
params = Turbopuffer::NamespaceWriteParams.new(
|
239
253
|
distance_metric: "cosine_distance",
|
240
|
-
upsert_rows: [
|
241
|
-
Turbopuffer::Row.new(
|
242
|
-
id: "2108ed60-6851-49a0-9016-8325434f3845",
|
243
|
-
vector: [0.1, 0.2],
|
244
|
-
attributes: {name: "Red boots", price: 34.99}
|
245
|
-
)
|
246
|
-
]
|
254
|
+
upsert_rows: [Turbopuffer::Row.new(id: "2108ed60-6851-49a0-9016-8325434f3845", vector: [0.1, 0.2])]
|
247
255
|
)
|
248
256
|
turbopuffer.namespace("products").write(**params)
|
249
257
|
```
|
@@ -33,6 +33,14 @@ module Turbopuffer
|
|
33
33
|
def respond_to_missing?(name, include_private = false)
|
34
34
|
@data.key?(name) || super
|
35
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
|
36
44
|
end
|
37
45
|
end
|
38
46
|
end
|
data/lib/turbopuffer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbopuffer-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.pre.
|
4
|
+
version: 0.2.0.pre.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Turbopuffer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-07-
|
11
|
+
date: 2025-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|