chromable 0.3.3 → 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: 30a53a0c8bde8c1d4c091e073058d6273d57cfd191cfeff0f4f48817e2bf14d4
4
- data.tar.gz: 4374788d45a3acb8e491c452f862bb20bf5634dcfb483cf194d9c7090b349de7
3
+ metadata.gz: f59d0e821f3f1dfb77fc3d5a70622b6677bccceafbda135c0a9a567c34e3c3a2
4
+ data.tar.gz: 07d3b41d12fe0ac9b4fe968b74548ce6f41a728f8a5d18742dc4c94b219611e2
5
5
  SHA512:
6
- metadata.gz: 2488713488c214ab53be05616da9ca3a7ee7e3c619c4627d3b338a1454680add7284b2fef6e84007285acc0f3830d24290f09024b5189241e3657bb9086cce17
7
- data.tar.gz: bf63bb358eb179ae5ab7e02fcdeb88d1657d2d3009e28b3e3c5d7354a8bb0a7e387a09020920d8bc88cb03ad10fb18ac4d5f3ac8926a979094a0fa575340af2e
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.3'
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],
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.3
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-18 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