Skip to content

Commit

Permalink
Fix non-string ids
Browse files Browse the repository at this point in the history
  • Loading branch information
AliOsm committed Dec 21, 2023
1 parent eedf7f1 commit c9b5a5b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
chromable (0.3.3)
chromable (0.3.4)
chroma-db (>= 0.6.0)

GEM
Expand Down
6 changes: 3 additions & 3 deletions lib/chromable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,21 @@ def self.included(base)
end

def chroma_embedding
self.class.chroma_collection.get(ids: [id])[0]
self.class.chroma_collection.get(ids: [id.to_s])[0]
end

def chroma_upsert_embedding
self.class.chroma_collection.upsert(build_embedding)
end

def chroma_destroy_embedding
self.class.chroma_collection.delete(ids: [id])
self.class.chroma_collection.delete(ids: [id.to_s])
end

def chroma_neighbors(results: 10, where: {}, where_document: {})
collection = self.class.chroma_collection

embedding = collection.get(ids: [id], include: [:embeddings])[0].embedding
embedding = collection.get(ids: [id.to_s], include: [:embeddings])[0].embedding

self.class.find(collection.query(
query_embeddings: [embedding],
Expand Down
2 changes: 1 addition & 1 deletion lib/chromable/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Chromable
VERSION = '0.3.3'
VERSION = '0.3.4'
end

0 comments on commit c9b5a5b

Please # to comment.