# WeaviateHybridSearchRetriever

**URL:** <https://forum.weaviate.io/t/weaviatehybridsearchretriever/1998>\
**Category:** Support\
**Tags:** bug\
**Created:** [April 12, 2024, 8:29am UTC](https://forum.weaviate.io/t/weaviatehybridsearchretriever/1998 "2024-04-12T08:29:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![engelsl](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/engelsl/32/1292_2.png) [@engelsl](https://forum.weaviate.io/u/engelsl)\
**Post date:** [April 12, 2024, 8:29am UTC](https://forum.weaviate.io/t/weaviatehybridsearchretriever/1998/1 "2024-04-12T08:29:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [April 12, 2024, 1:21pm UTC](https://forum.weaviate.io/t/weaviatehybridsearchretriever/1998/2 "2024-04-12T13:21:26Z")

</div>

HI @engelsl !

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

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

> **[recipes/integrations/langchain/loading-data at main · weaviate/recipes](https://github.com/weaviate/recipes/tree/main/integrations/langchain/loading-data)**
>
> This repository shares end-to-end notebooks on how to use various features and integrations with Weaviate at the core! - weaviate/recipes

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!

---

<div class="post-metadata">

**Author:** ![engelsl](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/engelsl/32/1292_2.png) [@engelsl](https://forum.weaviate.io/u/engelsl)\
**Post date:** [April 16, 2024, 9:09am UTC](https://forum.weaviate.io/t/weaviatehybridsearchretriever/1998/3 "2024-04-16T09:09:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![engelsl](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/engelsl/32/1292_2.png) [@engelsl](https://forum.weaviate.io/u/engelsl)\
**Post date:** [April 16, 2024, 12:15pm UTC](https://forum.weaviate.io/t/weaviatehybridsearchretriever/1998/4 "2024-04-16T12:15:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [April 17, 2024, 6:39pm UTC](https://forum.weaviate.io/t/weaviatehybridsearchretriever/1998/5 "2024-04-17T18:39:12Z")

</div>

Awesome, @engelsl !

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

---

<div class="post-metadata">

**Author:** ![pj812](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/pj812/32/1636_2.png) [@pj812](https://forum.weaviate.io/u/pj812)\
**Post date:** [July 15, 2024, 3:05am UTC](https://forum.weaviate.io/t/weaviatehybridsearchretriever/1998/6 "2024-07-15T03:05:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [July 15, 2024, 7:28pm UTC](https://forum.weaviate.io/t/weaviatehybridsearchretriever/1998/7 "2024-07-15T19:28:38Z")

</div>

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:

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

```

while for v4:

```python
client = weaviate.connect_to_local()

```

`connect_to_local` or other option.

Check here for a nice doc on how to migrate:

> **[Migrate from v3 to v4 | Weaviate - Vector Database](https://weaviate.io/developers/weaviate/client-libraries/python/v3_v4_migration)**
>
> The current Python client version is v||site.pythonclientversion||

Thanks!
