Skip to content

Commit

Permalink
Update chroma-db version v0.3.0 to v0.6.0 (patterns-ai-core#334)
Browse files Browse the repository at this point in the history
* Update chroma-db version v0.3.0 to v0.6.0

* Fix commit miss
  • Loading branch information
uehara1414 authored Oct 3, 2023
1 parent 6816e67 commit 6b44644
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
15 changes: 12 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ GEM
builder (3.2.4)
byebug (11.1.3)
childprocess (4.1.0)
chroma-db (0.3.0)
chroma-db (0.6.0)
dry-monads (~> 1.6)
ruby-next-core (>= 0.15.0)
ruby-next (>= 0.15.0)
coderay (1.1.3)
cohere-ruby (0.9.6)
faraday (>= 2.0.1, < 3.0)
Expand Down Expand Up @@ -248,7 +248,13 @@ GEM
rubocop-performance (1.16.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
ruby-next (0.15.3)
ruby-next-core (= 0.15.3)
ruby-next-parser (>= 3.1.1.0)
unparser (~> 0.6.0)
ruby-next-core (0.15.3)
ruby-next-parser (3.1.1.3)
parser (>= 3.0.3.1)
ruby-openai (4.1.0)
faraday (>= 1)
faraday-multipart (>= 1)
Expand Down Expand Up @@ -285,6 +291,9 @@ GEM
concurrent-ruby (~> 1.0)
unicode (0.4.4.4)
unicode-display_width (2.4.2)
unparser (0.6.8)
diff-lcs (~> 1.3)
parser (>= 3.2.0)
weaviate-ruby (0.8.7)
faraday (>= 2.0.1, < 3.0)
graphlient (~> 0.7.0)
Expand All @@ -304,7 +313,7 @@ PLATFORMS
DEPENDENCIES
ai21 (~> 0.2.1)
anthropic (~> 0.1.0)
chroma-db (~> 0.3.0)
chroma-db (~> 0.6.0)
cohere-ruby (~> 0.9.6)
docx (~> 0.8.0)
dotenv-rails (~> 2.7.6)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ client = Langchain::Vectorsearch::Weaviate.new(
)

# You can instantiate any other supported vector search database:
client = Langchain::Vectorsearch::Chroma.new(...) # `gem "chroma-db", "~> 0.3.0"`
client = Langchain::Vectorsearch::Chroma.new(...) # `gem "chroma-db", "~> 0.6.0"`
client = Langchain::Vectorsearch::Hnswlib.new(...) # `gem "hnswlib", "~> 0.8.1"`
client = Langchain::Vectorsearch::Milvus.new(...) # `gem "milvus", "~> 0.9.2"`
client = Langchain::Vectorsearch::Pinecone.new(...) # `gem "pinecone", "~> 0.1.6"`
Expand Down
2 changes: 1 addition & 1 deletion examples/pdf_store_and_query_with_chroma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require "dotenv/load"

# gem install chroma-db
# or add `gem "chroma-db", "~> 0.3.0"` to your Gemfile
# or add `gem "chroma-db", "~> 0.6.0"` to your Gemfile

# Instantiate the Chroma client
chroma = Langchain::Vectorsearch::Chroma.new(
Expand Down
2 changes: 1 addition & 1 deletion langchain.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Gem::Specification.new do |spec|
# optional dependencies
spec.add_development_dependency "ai21", "~> 0.2.1"
spec.add_development_dependency "anthropic", "~> 0.1.0"
spec.add_development_dependency "chroma-db", "~> 0.3.0"
spec.add_development_dependency "chroma-db", "~> 0.6.0"
spec.add_development_dependency "cohere-ruby", "~> 0.9.6"
spec.add_development_dependency "docx", "~> 0.8.0"
spec.add_development_dependency "eqn", "~> 1.6.5"
Expand Down
7 changes: 3 additions & 4 deletions lib/langchain/vectorsearch/chroma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ class Chroma < Base
#
# Wrapper around Chroma DB
#
# Gem requirements: gem "chroma-db", "~> 0.3.0"
# Gem requirements: gem "chroma-db", "~> 0.6.0"
#
# Usage:
# chroma = Langchain::Vectorsearch::Chroma.new(url:, index_name:, llm:, llm_api_key:, api_key: nil)
#

# Initialize the Chroma client
# @param url [String] The URL of the Qdrant server
# @param api_key [String] The API key to use
# @param url [String] The URL of the Chroma server
# @param index_name [String] The name of the index to use
# @param llm [Object] The LLM client to use
def initialize(url:, index_name:, llm:, api_key: nil)
def initialize(url:, index_name:, llm:)
depends_on "chroma-db"

::Chroma.connect_host = url
Expand Down
5 changes: 3 additions & 2 deletions spec/langchain/vectorsearch/chroma_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
end

describe "#get_default_schema" do
let(:collection) { Chroma::Resources::Collection.new(name: "documents") }
let(:collection) { Chroma::Resources::Collection.new(id: collection_id, name: "documents") }

it "returns the collection" do
allow(Chroma::Resources::Collection).to receive(:get).and_return(collection)
Expand All @@ -41,7 +41,8 @@
end

let(:text) { "Hello World" }
let(:collection) { Chroma::Resources::Collection.new(name: "documents") }
let(:collection_id) { "3ee1c14a-0f08-4632-8161-8b6276ae16b4" }
let(:collection) { Chroma::Resources::Collection.new(id: collection_id, name: "documents") }
let(:embedding) { [0.1, 0.2, 0.3] }
let(:count) { 1 }
let(:query) { "Greetings Earth" }
Expand Down

0 comments on commit 6b44644

Please sign in to comment.