Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: qdrant.rb #229

Merged

Conversation

satoru02
Copy link
Contributor

Thank you for creating this Gem. I encountered a couple of bugs when trying to use Qdrant with VectorDatabase.

my code

require 'langchainrb'
require 'qdrant'
require 'pry'

client = Langchain::Vectorsearch::Qdrant.new(
  url: '*********************',
  api_key: '*********************',
  index_name: 'test',
  llm: Langchain::LLM::OpenAI.new(api_key: '*********************')
)

client.create_default_schema

company_info = Langchain::Processors::JSON.new.parse(Langchain.root.join('/user/dev/embedding_sample/company_info.json'))

client.add_texts(
  texts: company_info.to_s
)

puts client.ask(
  question: "#{ARGV}"
)
  • The first bug is related to the absence of default arguments in the 'add_texts' method, which caused an error.
/Users/satoru/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/langchainrb-0.6.3/lib/langchain/vectorsearch/qdrant.rb:35:in `add_texts': missing keyword: :ids (ArgumentError)
        from test_company_info.rb:19:in `<main>'
  • The second bug was found in the 'ask' method while mapping the 'search_results' object. It was unnecessary to include the 'result' parameter, so I removed it.
/Users/satoru/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/langchainrb-0.6.3/lib/langchain/vectorsearch/qdrant.rb:113:in `dig': no implicit conversion of String into Integer (TypeError)
        from /Users/satoru/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/langchainrb-0.6.3/lib/langchain/vectorsearch/qdrant.rb:113:in `ask'
        from test_company_info.rb:24:in `<main>'

@satoru02 satoru02 changed the title fix: gdrant.rb fix: qdrant.rb Jun 27, 2023
@andreibondarev andreibondarev self-requested a review June 27, 2023 13:23
@andreibondarev
Copy link
Collaborator

@satoru02 This is excellent! Thank you for contribution and fixes! Lmk if you have any other feedback on this gem!

@andreibondarev andreibondarev merged commit 8797b00 into patterns-ai-core:main Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants