# Langchain/Weaviate

**URL:** <https://forum.weaviate.io/t/langchain-weaviate/9868>\
**Category:** Support\
**Created:** [January 23, 2025, 1:28pm UTC](https://forum.weaviate.io/t/langchain-weaviate/9868 "2025-01-23T13:28:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tatali](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/tatali/32/3413_2.png) [@Tatali](https://forum.weaviate.io/u/Tatali)\
**Post date:** [January 23, 2025, 1:28pm UTC](https://forum.weaviate.io/t/langchain-weaviate/9868/1 "2025-01-23T13:28:53Z")

</div>

### Description

Subject: Issue with weaviate.Client in LangChain: ValueError: client should be an instance of weaviate.Client, got \<class ‘weaviate.client.WeaviateClient’\>

Message:

Hi everyone,

I’ve been working on integrating Weaviate with LangChain to create a retriever for semantic search. However, I’m encountering an issue when trying to use the Weaviate class from LangChain to create a retriever. Here’s the error I’m getting:

```auto
ValueError: client should be an instance of weaviate.Client, got <class 'weaviate.client.WeaviateClient'>
Context

```

I’m using the following code to connect to Weaviate and create a retriever:

```auto
import os
from weaviate import connect_to_local
from weaviate.config import AdditionalConfig, Timeout
from langchain.vectorstores import Weaviate
from langchain.embeddings import OpenAIEmbeddings

# Connect to Weaviate
client = connect_to_local(
    headers={"X-OpenAI-Api-Key": os.getenv("OPENAI_APIKEY")},
    additional_config=AdditionalConfig(
        timeout=Timeout(init=10, query=60, insert=120)
    )
)

# Initialize embeddings
embeddings = OpenAIEmbeddings(openai_api_key=os.getenv("OPENAI_APIKEY"))

# Create a Weaviate retriever
retriever = Weaviate(
    client=client,
    index_name="EmailQuery",
    text_key=["subject", "beneficiary_email", "manager_response", "topic"],
    embedding=embeddings
).as_retriever()

```

Has anyone else encountered this issue when using LangChain with the latest Weaviate client?

### Any additional Information

langchain-community== 0.2.11  
langchain-weaviate==0.0.3  
weaviate-client== 4.8.1

---

<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:** [January 23, 2025, 2:07pm UTC](https://forum.weaviate.io/t/langchain-weaviate/9868/2 "2025-01-23T14:07:21Z")

</div>

hi @Tatali !!

WElcome to our community 🤗

I believe you are using the old Langchain integration.

Check here a nice recipe on how to use it:

> <https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/langchain/loading-data/langchain-simple-pdf.ipynb>

Let me know if that helps!

THanks!

---

<div class="post-metadata">

**Author:** ![Tatali](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/tatali/32/3413_2.png) [@Tatali](https://forum.weaviate.io/u/Tatali)\
**Post date:** [January 23, 2025, 2:37pm UTC](https://forum.weaviate.io/t/langchain-weaviate/9868/3 "2025-01-23T14:37:02Z")

</div>

Thanks @DudaNogueira for you reply.  
I found the correct code to use in the Notebook.

---

<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:** [January 23, 2025, 2:41pm UTC](https://forum.weaviate.io/t/langchain-weaviate/9868/4 "2025-01-23T14:41:38Z")

</div>

Awesome!

You can check the langchain module for this integration here:

> **[GitHub - langchain-ai/langchain-weaviate](https://github.com/langchain-ai/langchain-weaviate/)**
>
> Contribute to langchain-ai/langchain-weaviate development by creating an account on GitHub.

Happy coding!

---

<div class="post-metadata">

**Author:** ![Jixy](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@Jixy](https://forum.weaviate.io/u/Jixy)\
**Post date:** [March 8, 2025, 5:58am UTC](https://forum.weaviate.io/t/langchain-weaviate/9868/5 "2025-03-08T05:58:43Z")

</div>

Hello ，I just encounterd the same question when trying to use Weaviate with LangChain to cerate a example\_selector, but I found that the document you given is lost. Could you pleasae give me some solutions?

---

<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:** [March 9, 2025, 12:19pm UTC](https://forum.weaviate.io/t/langchain-weaviate/9868/6 "2025-03-09T12:19:42Z")

</div>

Hi!

There was a change in the folder name ☹

I have edited the link. here is the new place it lives:

> <https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/langchain/loading-data/langchain-simple-pdf.ipynb>

Our recipes “may” change folder names that will break links. I’ll try to go around fixing this.

Thanks!
