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

Weaviate hybrid example errors: init missing required positional argument 'properties' #1612

Open
Robbie-Palmer opened this issue Jun 1, 2023 · 6 comments · May be fixed by #1692
Open

Weaviate hybrid example errors: init missing required positional argument 'properties' #1612

Robbie-Palmer opened this issue Jun 1, 2023 · 6 comments · May be fixed by #1692
Assignees

Comments

@Robbie-Palmer
Copy link

The documentation on the Weaviate Document Index, gives code for executing a hybrid search

The example code as one script looks like:

import numpy as np
from docarray import BaseDoc
from docarray.index.backends.weaviate import WeaviateDocumentIndex
from docarray.typing import NdArray
from pydantic import Field


class Document(BaseDoc):
    text: str
    embedding: NdArray[2] = Field(dims=2, is_embedding=True)
    file: NdArray[100] = Field(dims=100)


batch_config = dict(batch_size=20, dynamic=False, timeout_retries=3, num_workers=1)
runtime_config = WeaviateDocumentIndex.RuntimeConfig(batch_config=batch_config)

db_config = WeaviateDocumentIndex.DBConfig(host="http://localhost:8080")
store = WeaviateDocumentIndex[Document](db_config=db_config)
store.configure(runtime_config)

docs = [
    Document(text="Hello world", embedding=np.array([1, 2]), file=np.random.rand(100), id="1"),
    Document(text="Hello world, how are you?", embedding=np.array([3, 4]), file=np.random.rand(100), id="2"),
    Document(text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut",
             embedding=np.array([5, 6]), file=np.random.rand(100), id="3", ),
]
store.index(docs)

hybrid_search = store.build_query().text_search("world").find([1, 2]).limit(2).build()
hybrid_search_result = store.execute_query(hybrid_search)
print(hybrid_search_result.text)

But this throws the error:

Traceback (most recent call last):
  File "/home/robbie/repos/search/search/__init__.py", line 29, in <module>
    hybrid_search = store.build_query().text_search("world").find([1, 2]).limit(2).build()
  File "/home/robbie/miniconda3/envs/search/lib/python3.10/site-packages/docarray/index/backends/weaviate.py", line 780, in build
    self._make_proper_hybrid_query(q)
  File "/home/robbie/miniconda3/envs/search/lib/python3.10/site-packages/docarray/index/backends/weaviate.py", line 806, in _make_proper_hybrid_query
    hybrid_query = weaviate.gql.get.Hybrid(
TypeError: Hybrid.__init__() missing 1 required positional argument: 'properties'

This appears to be related to this comment on another issue

@hsm207
Copy link
Collaborator

hsm207 commented Jun 1, 2023

@Robbie-Palmer which version of the weaviate server and client are you using?

@Robbie-Palmer
Copy link
Author

I ran pip install docarray[weaviate] which installed v3.19.2 of the client
I'm running the server via Docker-compose with image semitechnologies/weaviate:1.19.6

@hsm207 hsm207 added index/weaviate type/bug Something isn't working labels Jun 4, 2023
@samsja
Copy link
Member

samsja commented Jun 6, 2023

@hsm207 any idea where the problem is coming from ?

@hsm207
Copy link
Collaborator

hsm207 commented Jun 6, 2023

@samsja it is coming from a recent update to the weaviate python client to allow search by specific fields(s) by the bm25 portion of the hybrid search.

@JoanFM
Copy link
Member

JoanFM commented Jun 6, 2023

@hsm207 , can we then please update?

@hsm207
Copy link
Collaborator

hsm207 commented Jun 6, 2023

@JoanFM sure, i'll try to fit this in in my next sprint.

@hsm207 hsm207 linked a pull request Jul 10, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo/Bug
Development

Successfully merging a pull request may close this issue.

4 participants