chromable 0.3.2 → 0.3.4

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: 27a945b9d1998457000926a7b02a95651e7093792d456d3c87de7d2c0afe64e8
4
- data.tar.gz: 4608b17041ae86a4fbebb80c95433c5527373b7b53440a505aafb25ad32daeb8
3
+ metadata.gz: f59d0e821f3f1dfb77fc3d5a70622b6677bccceafbda135c0a9a567c34e3c3a2
4
+ data.tar.gz: 07d3b41d12fe0ac9b4fe968b74548ce6f41a728f8a5d18742dc4c94b219611e2
5
5
  SHA512:
6
- metadata.gz: 36ecd1c084d1b9fa9272974009075fae3286de90a8939b14da614f0a5aa68146b555a207b52c0ae7ddba57769f9f7d894433168c6dec4761fa826a24db7c236e
7
- data.tar.gz: 8800c6c0971741ea9e6bc29d1bff504795e233fe41ce7d6ca0a9553d9c838e021732e614527440cc7907e07e18d32b74518646f4d2ac802470db51a174df5f8d
6
+ metadata.gz: d8eeedca5f7ece76799c158ed2ab57ba0090eb6fa8e4cc803c8d1012a3c436c0ce6b8a416cfbc46637cb227c06615adfdd962397c3e11bba566b1aeca9111d9a
7
+ data.tar.gz: baf99935d6f8345198c8a13e68f783b7dadbc49ee2363690095775d10debe86540a51bea5f1c155026720ae5ced4fad54416fc6a4929e899030710a95a90d1ef
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Chromable
4
- VERSION = '0.3.2'
4
+ VERSION = '0.3.4'
5
5
  end
data/lib/chromable.rb CHANGED
@@ -49,6 +49,8 @@ module Chromable
49
49
 
50
50
  def chroma_delete_collection
51
51
  Chroma::Resources::Collection.delete(chromable_settings.collection_name)
52
+ rescue Chroma::InvalidRequestError
53
+ Chroma::Util.log_debug("Collection #{chromable_settings.collection_name} does not exist.")
52
54
  end
53
55
 
54
56
  def chroma_query(text:, results: 10, where: {}, where_document: {}, **embedder_options)
@@ -75,7 +77,7 @@ module Chromable
75
77
  end
76
78
 
77
79
  def chroma_embedding
78
- self.class.chroma_collection.get(ids: [id])[0]
80
+ self.class.chroma_collection.get(ids: [id.to_s])[0]
79
81
  end
80
82
 
81
83
  def chroma_upsert_embedding
@@ -83,13 +85,13 @@ module Chromable
83
85
  end
84
86
 
85
87
  def chroma_destroy_embedding
86
- self.class.chroma_collection.delete(ids: [id])
88
+ self.class.chroma_collection.delete(ids: [id.to_s])
87
89
  end
88
90
 
89
91
  def chroma_neighbors(results: 10, where: {}, where_document: {})
90
92
  collection = self.class.chroma_collection
91
93
 
92
- embedding = collection.get(ids: [id], include: [:embeddings])[0].embedding
94
+ embedding = collection.get(ids: [id.to_s], include: [:embeddings])[0].embedding
93
95
 
94
96
  self.class.find(collection.query(
95
97
  query_embeddings: [embedding],
@@ -103,7 +105,7 @@ module Chromable
103
105
 
104
106
  def build_embedding
105
107
  Chroma::Resources::Embedding.new(
106
- id: id,
108
+ id: id.to_s,
107
109
  document: document_to_embed,
108
110
  embedding: document_embedding,
109
111
  metadata: embedding_metadata
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chromable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ali Hamdi Ali Fadel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-13 00:00:00.000000000 Z
11
+ date: 2023-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chroma-db