speaky 0.1.6 → 0.1.7

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: 3dea3c0900c9679d76d464ded63bc6c3d8cfad6d03da8661ad19b1013779b255
4
- data.tar.gz: 62858d2b9e755c8c56a18b34d0a5651c8dcdb5687b15b1294d1a3c48986a4176
3
+ metadata.gz: 978cd92d282523846c4b7b592776656f3d351162a361e28460de95e4af338378
4
+ data.tar.gz: dac048c47d89c41ef1b96dc31d3a7f600ee2ef393d59bffd203af1b7f97c17cd
5
5
  SHA512:
6
- metadata.gz: 304614f14107c1a2effe210d1d00f599fab93ce6f1a086d09f398b0f7b42b0b129b95d585f3a6fccb36b9d3a0cee797342365634392ee15430ade4e3ccbf2aca
7
- data.tar.gz: '01229a40b984e5165e8ed669df1d94c8923ddc1f1b42a02ff3557215b6301531389c44e1a744092785fb1312842b498c7160c53888a7b5b640a587d677986e8c'
6
+ metadata.gz: 06e1d13344593cce42a57f730d44e4f838660a7581810a5357e023b42a6f7a00c866e3fadcbb98d6a4398f202a0c693c02202c69415f7eac16ca7f9190903b93
7
+ data.tar.gz: 3afc6a7bd45fd9fff233a5e753a6778421d8664405ccc33c1e7189988770056dcd6a45dd04c60052aa2d24b1c7eb61ecb85ee508959c9360e53e1b26ca70f211
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'rails'
3
4
  require 'active_support'
4
5
 
5
6
  module Speaky
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'rails'
3
4
  require 'qdrant'
4
5
 
5
6
  module Speaky
@@ -29,7 +30,7 @@ module Speaky
29
30
  collection_name: @config[:collection_name],
30
31
  points: [
31
32
  {
32
- id: id,
33
+ id: string_id_to_unique_int_id(id),
33
34
  vector: embeddings,
34
35
  payload: {
35
36
  content: data
@@ -50,7 +51,7 @@ module Speaky
50
51
  def remove(id)
51
52
  points_delete = @client.points.delete(
52
53
  collection_name: @config[:collection_name],
53
- points: [id],
54
+ points: [string_id_to_unique_int_id(id)],
54
55
  )
55
56
 
56
57
  if !points_delete || points_delete.dig('status') != 'ok'
@@ -117,5 +118,11 @@ module Speaky
117
118
 
118
119
  true
119
120
  end
121
+
122
+ # This method is used to convert a string ID to a unique integer ID
123
+ # that can be used by the Qdrant API.
124
+ def string_id_to_unique_int_id(string_id)
125
+ string_id.to_s.hash.abs
126
+ end
120
127
  end
121
128
  end
@@ -1,3 +1,3 @@
1
1
  module Speaky
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: speaky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante