WeaviateHybridSearchRetriever

Hi

I’m trying to use the WeaviateHybridSearchRetriever from langchain.
The issue i encounter is the following one :
WeaviateHybridSearchRetriever Requiere the python client v3 which is deprecated

Does someone have any solution to build an hybrid search retriever with the python client v4

Thanks in advance

HI @engelsl !

I have not yet played with the new integration, to be honest :frowning:

I have used this, but for the old integration. I plan on migrating this recipe I did for the new integration:

Please, if possible, share a notebook based on that recipe with what you want to accomplish.

This helps a lot as we have a MRE minimum reproducible example to play with.

Thanks!

Hi @DudaNogueira Thanks a lot for your help the notebook you shared was really helpful.

I was missing creating a correctly a collection.

Now i’m facing a new error and I have trouble to see where it could come from.
May you know this error or you see it somewhere else : vector search: knn search: distance between entrypoint and query node: vector lengths don’t match: 384 vs 768", ‘path’: [‘Get’, ‘TextChunk’]}]

If you have any idea on what could have been the potential issue
I know it’s hard to think just on a error but it’s more like if you have already face this issue on previous work and you have an idea on how to solve it.

Thanks in advance

I found the solution i had to add into the collection the precise embedding model that i use also to embedded the query

Awesome, @engelsl !

Also, I have just updated that recipe today to use the new Langchain integration :slight_smile:

Hi Duda, I had the same issue @engelsl had, I am trying to use, the Weaviate 4 version client with langchain hybrid retriever function. However, I get this error, when I am instantiating my client as I always doing it and it works for that piece. Here is the error I get when running the retriever function: alidationError: 1 validation error for WeaviateHybridSearchRetriever
root
client should be an instance of weaviate.Client, got <class ‘weaviate.client.WeaviateClient’> (type=value_error) You had responded to engels with the github. However, I think things have moved. I am not seeing code there. Can you point me to the right code. Here is my retriever code: retriever = WeaviateHybridSearchRetriever(
client=client,
index_name=Newcollection5, # replace with your collection name
text_key=“find this text”,
attributes=,
#embeddings=embeddings,
create_schema_if_missing=False
) Thanks, Paul

hi @pj812!

This error means that you are passing the wrong client.

right now, python v4 client package will include both v3 and v4 code.

the difference is how you instantiate the client.

for v3:

client = weaviate.Client("http://localhost:8080")

while for v4:

client = weaviate.connect_to_local()

connect_to_local or other option.

Check here for a nice doc on how to migrate:

Thanks!