pgvector 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 215f975cafa2f782f3777ec65dd2fea587b420286f7f5ccf63b6b68376756dfd
4
- data.tar.gz: e1979a1aa4fd4157cb04ae73c0c62b378046ca97154a25d4355e827be5abc53b
3
+ metadata.gz: 7485ea4be0d5be0177a972db911c696daf3438a661ddac61b08f4e8b2da3ac51
4
+ data.tar.gz: 2532ef79f5db88aecb681d9455e38f3e5fc1d30bde015d0a1e9daaa9fe82635e
5
5
  SHA512:
6
- metadata.gz: 1e54d7c41f8750b99262021e402f329252b428678ee99510dd52a1a113aeffdf35628a23b6ca9408ce55350a237cb2d224e66dfe7aafefd645612a29b74529ff
7
- data.tar.gz: c8a014bb3708690cf3e463954aa7a846ce79075da039e23b3f94644e50e3c28d05376539699fd8ffe3c3b93d54eecb393fed472bddb60619ba897a5204bc511a
6
+ metadata.gz: be40e4c3e16dd904a200115794a8ffaa850b40c5055330bd873ec7a707164a53b29d22040defbb4dd8a9cff597d4e1ad5c659d37a580ccc201ce30a9eb17fef9
7
+ data.tar.gz: f5d36289b043d987920911ab08d85d7d1066039f84dcc2a24436701c06b246adcb8fd3c32e3f76f3e1604001403574c14818f91a64357ce4ebd675458e57184c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.2 (2023-10-03)
2
+
3
+ - Added `nearest_neighbors` method to datasets with Sequel
4
+
1
5
  ## 0.2.1 (2023-06-04)
2
6
 
3
7
  - Added support for Sequel
data/README.md CHANGED
@@ -29,6 +29,12 @@ Or check out some examples:
29
29
 
30
30
  ## pg
31
31
 
32
+ Enable the extension
33
+
34
+ ```ruby
35
+ conn.exec("CREATE EXTENSION IF NOT EXISTS vector")
36
+ ```
37
+
32
38
  Register the vector type with your connection
33
39
 
34
40
  ```ruby
@@ -52,6 +58,12 @@ conn.exec_params("SELECT * FROM items ORDER BY embedding <-> $1 LIMIT 5", [embed
52
58
 
53
59
  ## Sequel
54
60
 
61
+ Enable the extension
62
+
63
+ ```ruby
64
+ DB.run("CREATE EXTENSION IF NOT EXISTS vector")
65
+ ```
66
+
55
67
  Create a table
56
68
 
57
69
  ```ruby
@@ -1,3 +1,3 @@
1
1
  module Pgvector
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -8,12 +8,10 @@ module Sequel
8
8
  end
9
9
  end
10
10
 
11
- module ClassMethods
12
- attr_accessor :vector_columns
13
-
11
+ module DatasetMethods
14
12
  def nearest_neighbors(column, value, distance:)
15
13
  value = ::Pgvector.encode(value) unless value.is_a?(String)
16
- quoted_column = dataset.quote_identifier(column)
14
+ quoted_column = quote_identifier(column)
17
15
  distance = distance.to_s
18
16
 
19
17
  operator =
@@ -41,6 +39,12 @@ module Sequel
41
39
  .exclude(column => nil)
42
40
  .order(Sequel.lit(order, value))
43
41
  end
42
+ end
43
+
44
+ module ClassMethods
45
+ attr_accessor :vector_columns
46
+
47
+ Sequel::Plugins.def_dataset_methods(self, :nearest_neighbors)
44
48
 
45
49
  Plugins.inherited_instance_variables(self, :@vector_columns => :dup)
46
50
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgvector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-05 00:00:00.000000000 Z
11
+ date: 2023-10-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: andrew@ankane.org