qdrant-ruby 0.9.7 → 0.9.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: daa79e8d789d5a0c4da9cd5592dc361674c60c29b8365e4817a8f5c1f0ebacdb
4
- data.tar.gz: 4d3d67bdf59663ba8f4fb4644d4be74cc9e7cdb0e547047ee4485b149021ea9c
3
+ metadata.gz: fb6e4fdc4875c35aa2a6e4a921fae8fd79c7407ec4d20395382829e843e33827
4
+ data.tar.gz: eb54d1c1e4cafb05a792c990325a633cb42dcaae8231c3f2246af285578a6b77
5
5
  SHA512:
6
- metadata.gz: 2d3d7c91a53f269543925feda94237599c4f0886e6812504d96427739aab8914693890cd8c98f0c4dffb17c971fa99a09f6026d990d0170be521ce186211fe0c
7
- data.tar.gz: 8fe548b7eef0acea610057d67e19f21e7835ec98ee732d31c42cdefd2d39254b743cc038d665e6720fe709e3cbe284361141a21743e9232b7c255765aea3a92b
6
+ metadata.gz: 7db835fa9f01ba9c1ada4732c0a21b531ded39088edc5f523fa12226275f595ec434d7be1f83040c1f7534002f8fdded17b9b26cf1b1beb3c87ea03e5476085c
7
+ data.tar.gz: 06017bfade0b83bde059a15012c53cb943a56b61bce6be10d906f449e599b0e8275b5ba492502a4846ed75bdbbbc7bbbe09595cc27325cee8eddafda53ba6386
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.9.9] - 2024-04-11
4
+ - Allow sparse_vectors to be passed to collections.create
5
+ - Support query endpoint
6
+
7
+ ## [0.9.8] - 2024-10-01
8
+ - Qdrant::Client constructor accepts customer logger: to be passed in
9
+
3
10
  ## [0.9.7] - 2024-01-19
4
11
  - fix: points/delete api
5
12
 
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in qdrant.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.0"
8
+ gem "rake", "~> 13.2"
9
9
 
10
- gem "rspec", "~> 3.0"
11
- gem "standard", "~> 1.25.0"
10
+ gem "rspec", "~> 3.13"
11
+ gem "standard", "~> 1.28.5"
data/Gemfile.lock CHANGED
@@ -1,74 +1,88 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qdrant-ruby (0.9.7)
4
+ qdrant-ruby (0.9.9)
5
5
  faraday (>= 2.0.1, < 3)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  ast (2.4.2)
11
+ base64 (0.2.0)
11
12
  byebug (11.1.3)
12
13
  coderay (1.1.3)
13
- diff-lcs (1.5.0)
14
- faraday (2.7.10)
14
+ diff-lcs (1.5.1)
15
+ faraday (2.8.1)
16
+ base64
15
17
  faraday-net_http (>= 2.0, < 3.1)
16
18
  ruby2_keywords (>= 0.0.4)
17
19
  faraday-net_http (3.0.2)
18
- json (2.6.3)
20
+ json (2.7.4)
19
21
  language_server-protocol (3.17.0.3)
22
+ lint_roller (1.1.0)
20
23
  method_source (1.0.0)
21
- parallel (1.22.1)
22
- parser (3.2.1.1)
24
+ parallel (1.24.0)
25
+ parser (3.3.5.0)
23
26
  ast (~> 2.4.1)
27
+ racc
24
28
  pry (0.14.2)
25
29
  coderay (~> 1.1)
26
30
  method_source (~> 1.0)
27
31
  pry-byebug (3.10.1)
28
32
  byebug (~> 11.0)
29
33
  pry (>= 0.13, < 0.15)
34
+ racc (1.8.1)
30
35
  rainbow (3.1.1)
31
- rake (13.0.6)
32
- regexp_parser (2.7.0)
33
- rexml (3.2.5)
34
- rspec (3.11.0)
35
- rspec-core (~> 3.11.0)
36
- rspec-expectations (~> 3.11.0)
37
- rspec-mocks (~> 3.11.0)
38
- rspec-core (3.11.0)
39
- rspec-support (~> 3.11.0)
40
- rspec-expectations (3.11.0)
36
+ rake (13.2.1)
37
+ regexp_parser (2.9.2)
38
+ rexml (3.3.9)
39
+ rspec (3.13.0)
40
+ rspec-core (~> 3.13.0)
41
+ rspec-expectations (~> 3.13.0)
42
+ rspec-mocks (~> 3.13.0)
43
+ rspec-core (3.13.2)
44
+ rspec-support (~> 3.13.0)
45
+ rspec-expectations (3.13.3)
41
46
  diff-lcs (>= 1.2.0, < 2.0)
42
- rspec-support (~> 3.11.0)
43
- rspec-mocks (3.11.1)
47
+ rspec-support (~> 3.13.0)
48
+ rspec-mocks (3.13.2)
44
49
  diff-lcs (>= 1.2.0, < 2.0)
45
- rspec-support (~> 3.11.0)
46
- rspec-support (3.11.0)
47
- rubocop (1.48.1)
50
+ rspec-support (~> 3.13.0)
51
+ rspec-support (3.13.1)
52
+ rubocop (1.50.2)
48
53
  json (~> 2.3)
49
54
  parallel (~> 1.10)
50
55
  parser (>= 3.2.0.0)
51
56
  rainbow (>= 2.2.2, < 4.0)
52
57
  regexp_parser (>= 1.8, < 3.0)
53
58
  rexml (>= 3.2.5, < 4.0)
54
- rubocop-ast (>= 1.26.0, < 2.0)
59
+ rubocop-ast (>= 1.28.0, < 2.0)
55
60
  ruby-progressbar (~> 1.7)
56
61
  unicode-display_width (>= 2.4.0, < 3.0)
57
- rubocop-ast (1.28.0)
62
+ rubocop-ast (1.30.0)
58
63
  parser (>= 3.2.1.0)
59
64
  rubocop-performance (1.16.0)
60
65
  rubocop (>= 1.7.0, < 2.0)
61
66
  rubocop-ast (>= 0.4.0)
62
67
  ruby-progressbar (1.13.0)
63
68
  ruby2_keywords (0.0.5)
64
- standard (1.25.3)
69
+ standard (1.28.5)
65
70
  language_server-protocol (~> 3.17.0.2)
66
- rubocop (~> 1.48.1)
71
+ lint_roller (~> 1.0)
72
+ rubocop (~> 1.50.2)
73
+ standard-custom (~> 1.0.0)
74
+ standard-performance (~> 1.0.1)
75
+ standard-custom (1.0.2)
76
+ lint_roller (~> 1.0)
77
+ rubocop (~> 1.50)
78
+ standard-performance (1.0.1)
79
+ lint_roller (~> 1.0)
67
80
  rubocop-performance (~> 1.16.0)
68
- unicode-display_width (2.4.2)
81
+ unicode-display_width (2.6.0)
69
82
 
70
83
  PLATFORMS
71
84
  arm64-darwin-23
85
+ arm64-darwin-24
72
86
  x86_64-darwin-19
73
87
  x86_64-darwin-21
74
88
  x86_64-linux
@@ -76,9 +90,9 @@ PLATFORMS
76
90
  DEPENDENCIES
77
91
  pry-byebug (~> 3.9)
78
92
  qdrant-ruby!
79
- rake (~> 13.0)
80
- rspec (~> 3.0)
81
- standard (~> 1.25.0)
93
+ rake (~> 13.2)
94
+ rspec (~> 3.13)
95
+ standard (~> 1.28.5)
82
96
 
83
97
  BUNDLED WITH
84
98
  2.4.0
data/README.md CHANGED
@@ -34,8 +34,8 @@ If bundler is not being used to manage dependencies, install the gem by executin
34
34
  require 'qdrant'
35
35
 
36
36
  client = Qdrant::Client.new(
37
- url: "your-qdrant-url",
38
- api_key: "your-qdrant-api-key"
37
+ url: ENV["QDRANT_URL"],
38
+ api_key: ENV["QDRANT_API_KEY"]
39
39
  )
40
40
  ```
41
41
 
data/lib/qdrant/client.rb CHANGED
@@ -7,7 +7,7 @@ module Qdrant
7
7
  class Client
8
8
  extend Forwardable
9
9
 
10
- attr_reader :url, :api_key, :adapter, :raise_error
10
+ attr_reader :url, :api_key, :adapter, :raise_error, :logger
11
11
 
12
12
  def_delegators :service, :telemetry, :metrics, :locks, :set_lock
13
13
 
@@ -15,12 +15,14 @@ module Qdrant
15
15
  url:,
16
16
  api_key: nil,
17
17
  adapter: Faraday.default_adapter,
18
- raise_error: false
18
+ raise_error: false,
19
+ logger: nil
19
20
  )
20
21
  @url = url
21
22
  @api_key = api_key
22
23
  @adapter = adapter
23
24
  @raise_error = raise_error
25
+ @logger = logger || Logger.new($stdout)
24
26
  end
25
27
 
26
28
  def connection
@@ -29,6 +31,7 @@ module Qdrant
29
31
  faraday.headers["api-key"] = api_key
30
32
  end
31
33
  faraday.request :json
34
+ faraday.response :logger, @logger, {headers: true, bodies: true, errors: true}
32
35
  faraday.response :raise_error if raise_error
33
36
  faraday.response :json, content_type: /\bjson$/
34
37
  faraday.adapter adapter
@@ -20,6 +20,7 @@ module Qdrant
20
20
  def create(
21
21
  collection_name:,
22
22
  vectors:,
23
+ sparse_vectors: nil,
23
24
  shard_number: nil,
24
25
  replication_factor: nil,
25
26
  write_consistency_factor: nil,
@@ -33,6 +34,7 @@ module Qdrant
33
34
  response = client.connection.put("#{PATH}/#{collection_name}") do |req|
34
35
  req.body = {}
35
36
  req.body["vectors"] = vectors
37
+ req.body["sparse_vectors"] = sparse_vectors unless sparse_vectors.nil?
36
38
  req.body["shard_number"] = shard_number unless shard_number.nil?
37
39
  req.body["replication_factor"] = replication_factor unless replication_factor.nil?
38
40
  req.body["write_consistency_factor"] = write_consistency_factor unless write_consistency_factor.nil?
data/lib/qdrant/points.rb CHANGED
@@ -294,6 +294,45 @@ module Qdrant
294
294
  response.body
295
295
  end
296
296
 
297
+ # Universally query points. This endpoint covers all capabilities of search, recommend, discover, filters. But also enables hybrid and multi-stage queries.
298
+ def query(
299
+ collection_name:,
300
+ consistency: nil,
301
+ timeout: nil,
302
+ shard_key: nil,
303
+ prefetch: nil,
304
+ query: nil,
305
+ using: nil,
306
+ filter: nil,
307
+ params: nil,
308
+ score_threshold: nil,
309
+ limit: nil,
310
+ offset: nil,
311
+ with_vector: nil,
312
+ with_payload: nil,
313
+ lookup_from: nil
314
+ )
315
+ response = client.connection.post("collections/#{collection_name}/#{PATH}/query") do |req|
316
+ req.params["consistency"] = consistency unless consistency.nil?
317
+ req.params["timeout"] = timeout unless timeout.nil?
318
+
319
+ req.body = {}
320
+ req.body["shard_key"] = shard_key unless shard_key.nil?
321
+ req.body["prefetch"] = prefetch unless prefetch.nil?
322
+ req.body["query"] = query unless query.nil?
323
+ req.body["using"] = using unless using.nil?
324
+ req.body["filter"] = filter unless filter.nil?
325
+ req.body["params"] = params unless params.nil?
326
+ req.body["score_threshold"] = score_threshold unless score_threshold.nil?
327
+ req.body["limit"] = limit unless limit.nil?
328
+ req.body["offset"] = offset unless offset.nil?
329
+ req.body["with_vector"] = with_vector unless with_vector.nil?
330
+ req.body["with_payload"] = with_payload unless with_payload.nil?
331
+ req.body["lookup_from"] = lookup_from unless lookup_from.nil?
332
+ end
333
+ response.body
334
+ end
335
+
297
336
  # Count points which matches given filtering condition
298
337
  def count(
299
338
  collection_name:,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Qdrant
4
- VERSION = "0.9.7"
4
+ VERSION = "0.9.9"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qdrant-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Bondarev
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-01-19 00:00:00.000000000 Z
10
+ date: 2025-04-11 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: faraday
@@ -79,7 +78,6 @@ metadata:
79
78
  homepage_uri: https://github.com/andreibondarev/qdrant-ruby
80
79
  source_code_uri: https://github.com/andreibondarev/qdrant-ruby
81
80
  changelog_uri: https://github.com/andreibondarev/qdrant-ruby/CHANGELOG.md
82
- post_install_message:
83
81
  rdoc_options: []
84
82
  require_paths:
85
83
  - lib
@@ -94,8 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
92
  - !ruby/object:Gem::Version
95
93
  version: '0'
96
94
  requirements: []
97
- rubygems_version: 3.4.1
98
- signing_key:
95
+ rubygems_version: 3.6.2
99
96
  specification_version: 4
100
97
  summary: Ruby wrapper for the Qdrant vector search database API
101
98
  test_files: []