patterns-ai-core / weaviate-ruby

Ruby wrapper for the Weaviate vector search database API
https://rubydoc.info/gems/weaviate-ruby
MIT License
47 stars 16 forks source link

AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED in docker-compose.yml #54

Closed ethicalhack3r closed 1 month ago

ethicalhack3r commented 1 month ago

Hi team,

When using AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED in the docker-compose.yml file, I get an argument missing error when omitting the api_key.

/opt/homebrew/lib/ruby/gems/3.3.0/gems/langchainrb-0.14.0/lib/langchain/vectorsearch/weaviate.rb:20:in `initialize': missing keyword: :api_key (ArgumentError)
    from threatai.rb:8:in `new'
    from threatai.rb:8:in `<main>'

This is the Ruby code, I'm using to initialize:

client = Langchain::Vectorsearch::Weaviate.new(
    url: 'http://0.0.0.0:8080',
    # api_key: '',
    index_name: "Documents",
    llm: llm
)

This is my docker-compose.yml file:

version: '3.4'
services:
  weaviate:
    command:
    - --host
    - 0.0.0.0
    - --port
    - '8080'
    - --scheme
    - http
    image: cr.weaviate.io/semitechnologies/weaviate:1.26.1
    ports:
    - 8080:8080
    - 50051:50051
    volumes:
    - weaviate_data:/var/lib/weaviate
    restart: on-failure:0
    environment:
      QUERY_DEFAULTS_LIMIT: 25
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
      PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
      DEFAULT_VECTORIZER_MODULE: 'none'
      ENABLE_MODULES: 'text2vec-cohere,text2vec-huggingface,text2vec-palm,text2vec-openai,generative-openai,generative-cohere,generative-palm,ref2vec-centroid,reranker-cohere,qna-openai'
      CLUSTER_HOSTNAME: 'node1'
volumes:
  weaviate_data:

Is it possible to use weaviate-ruby to connect with anonymous access?

Thanks!

andreibondarev commented 1 month ago

@ethicalhack3r Yep, I'll fix it for you in a few hours.

ethicalhack3r commented 1 month ago

Thank you!