# How to hide the client v3 deprecation warning?

**URL:** <https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165>\
**Category:** Support\
**Created:** [May 2, 2024, 10:41am UTC](https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165 "2024-05-02T10:41:18Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![elie](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/elie/32/1421_2.png) [@elie](https://forum.weaviate.io/u/elie)\
**Post date:** [May 2, 2024, 10:41am UTC](https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165/1 "2024-05-02T10:41:18Z")

</div>

How to hide this warning

```auto
DeprecationWarning: Dep016: You are using the Weaviate v3 client, which is deprecated.
            Consider upgrading to the new and improved v4 client instead!
            See here for usage: https://weaviate.io/developers/weaviate/client-libraries/python

  warnings.warn(

```

I can’t use the client v4 because langchain `WeaviateHybridSearchRetriever` only works with v3 at the moment, II already opened a [ticket about it](https://github.com/langchain-ai/langchain/issues/21147)

---

<div class="post-metadata">

**Author:** ![elie](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/elie/32/1421_2.png) [@elie](https://forum.weaviate.io/u/elie)\
**Post date:** [May 2, 2024, 1:10pm UTC](https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165/2 "2024-05-02T13:10:11Z")

</div>

I just added these lines on top of my code

```auto
import warnings
with warnings.catch_warnings():
    warnings.simplefilter("ignore")
    import weaviate

```

---

<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:** [May 2, 2024, 3:13pm UTC](https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165/3 "2024-05-02T15:13:19Z")

</div>

Hi! We have updated Langchain integration to use the python v4 client:

> **[Weaviate | 🦜️🔗 LangChain](https://python.langchain.com/docs/integrations/vectorstores/weaviate/#search-mechanism)**
>
> This notebook covers how to get started with the Weaviate vector store

Do you think that. can help you migrating to v4 client?

If not, let me know what else you need on that integration.

Thanks!

---

<div class="post-metadata">

**Author:** ![elie](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/elie/32/1421_2.png) [@elie](https://forum.weaviate.io/u/elie)\
**Post date:** [May 2, 2024, 3:31pm UTC](https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165/4 "2024-05-02T15:31:21Z")

</div>

@DudaNogueira Hello, I’m interested in doing hybrid search like this

> **[Weaviate Hybrid Search | 🦜️🔗 LangChain](https://python.langchain.com/docs/integrations/retrievers/weaviate-hybrid/)**
>
> Weaviate is an open-source

I don’t want to split the text and generate embedings. How to use `WeaviateHybridSearchRetriever` with v4 client?

The example you shared doesn’t use `WeaviateHybridSearchRetriever`

---

<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:** [May 6, 2024, 8:13pm UTC](https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165/5 "2024-05-06T20:13:40Z")

</div>

hi @elie !

With the new langchain integration, the similarity\_search will perform, under the hood, a hybrid search:

> <https://github.com/langchain-ai/langchain-weaviate/blob/0585715d029b06a107f97adcff1cac1dd1a674ca/libs/weaviate/langchain_weaviate/vectorstores.py#L279>

So with that, you can simply call the [similarity\_search method](https://python.langchain.com/docs/integrations/vectorstores/weaviate/#search-mechanism)

```auto
docs = db.similarity_search(query, alpha=0)

```

you can instantiate your db, like so:

```auto
db = WeaviateVectorStore.from_documents([], embeddings, client=weaviate_client)

```

If you want an end to end example, I have recently updated our langchain integration recipe here:

> **[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

Let me know if this helps.

Thanks!

---

<div class="post-metadata">

**Author:** ![elie](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/elie/32/1421_2.png) [@elie](https://forum.weaviate.io/u/elie)\
**Post date:** [May 6, 2024, 8:36pm UTC](https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165/6 "2024-05-06T20:36:56Z")

</div>

Fine but I don’t want to do the chunking and embedding myself, I want to avoid this code

```auto
loader = TextLoader("state_of_the_union.txt")
documents = loader.load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
docs = text_splitter.split_documents(documents)

```

because this way you’d have to waste so much time finding the correct chunk size and so on, and I can’t guarantee that I’d get the correct answers I want, I want an answer with a reference (source), If I do the chunking, some chunk would be messed up, I might get the same bad quality like chroma or faiss

the old way of loading data is much better [Weaviate Hybrid Search | 🦜️🔗 LangChain](https://python.langchain.com/docs/integrations/retrievers/weaviate-hybrid/)

```auto
docs = [
    Document(
        metadata={
            "title": "Embracing The Future: AI Unveiled",
            "author": "Dr. Rebecca Simmons",
        },
        page_content="A comprehensive analysis of the evolution of artificial intelligence, from its inception to its future prospects. Dr. Simmons covers ethical considerations, potentials, and threats posed by AI.",
    ),
    Document(
        metadata={
            "title": "Symbiosis: Harmonizing Humans and AI",
            "author": "Prof. Jonathan K. Sterling",
        },
        page_content="Prof. Sterling explores the potential for harmonious coexistence between humans and artificial intelligence. The book discusses how AI can be integrated into society in a beneficial and non-disruptive manner.",
    ),
    Document(
        metadata={"title": "AI: The Ethical Quandary", "author": "Dr. Rebecca Simmons"},
        page_content="In her second book, Dr. Simmons delves deeper into the ethical considerations surrounding AI development and deployment. It is an eye-opening examination of the dilemmas faced by developers, policymakers, and society at large.",
    ),
    Document(
        metadata={
            "title": "Conscious Constructs: The Search for AI Sentience",
            "author": "Dr. Samuel Cortez",
        },
        page_content="Dr. Cortez takes readers on a journey exploring the controversial topic of AI consciousness. The book provides compelling arguments for and against the possibility of true AI sentience.",
    ),
    Document(
        metadata={
            "title": "Invisible Routines: Hidden AI in Everyday Life",
            "author": "Prof. Jonathan K. Sterling",
        },
        page_content="In his follow-up to 'Symbiosis', Prof. Sterling takes a look at the subtle, unnoticed presence and influence of AI in our everyday lives. It reveals how AI has become woven into our routines, often without our explicit realization.",
    ),
]
retriever.add_documents(docs)

```

I get to enforce the structure I want to use. Is there anyway of doing this in the new client? I just don’t want to waste my time testing different chunk sizes.

---

<div class="post-metadata">

**Author:** ![hsm207](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/hsm207/32/19_2.png) [@hsm207](https://forum.weaviate.io/u/hsm207)\
**Post date:** [May 7, 2024, 2:08am UTC](https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165/7 "2024-05-07T02:08:50Z")

</div>

@elie if you already have the texts in the form you want, then you can use the `from_texts` method to ingest your data into weaviate. Here is an end-to-end code snippet to show how to use it:

> <https://github.com/langchain-ai/langchain-weaviate/blob/0585715d029b06a107f97adcff1cac1dd1a674ca/libs/weaviate/tests/unit_tests/test_vectorstores_integration.py#L92-L103>

---

<div class="post-metadata">

**Author:** ![hsm207](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/hsm207/32/19_2.png) [@hsm207](https://forum.weaviate.io/u/hsm207)\
**Post date:** [May 7, 2024, 6:52am UTC](https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165/8 "2024-05-07T06:52:42Z")

</div>

@elie You can disable that specific warning with this:

```auto
import warnings

warnings.filterwarnings(
    "ignore",
    """Dep016: You are using the Weaviate v3 client, which is deprecated.
            Consider upgrading to the new and improved v4 client instead!
            See here for usage: https://weaviate.io/developers/weaviate/client-libraries/python
            """,
    category=DeprecationWarning,
)

```

---

<div class="post-metadata">

**Author:** ![elie](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/elie/32/1421_2.png) [@elie](https://forum.weaviate.io/u/elie)\
**Post date:** [May 7, 2024, 11:58am UTC](https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165/9 "2024-05-07T11:58:24Z")

</div>

My data is json array not text, from\_texts does not work in this case, and if I were to stringify the json, weaviate would be stuck, I waited 30min to get an answer already, but I have nothing no output, nothing

---

<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:** [May 7, 2024, 9:15pm UTC](https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165/10 "2024-05-07T21:15:02Z")

</div>

Hi @elie !

Considering the dataset you provided, this is how you can accomplish it:

```auto
import weaviate
from langchain.docstore.document import Document
from langchain.embeddings import OpenAIEmbeddings
from langchain_weaviate.vectorstores import WeaviateVectorStore

embeddings = OpenAIEmbeddings()
client = weaviate.connect_to_local()
docs = [
    Document(
        metadata={
            "title": "Embracing The Future: AI Unveiled",
            "author": "Dr. Rebecca Simmons",
        },
        page_content="A comprehensive analysis of the evolution of artificial intelligence, from its inception to its future prospects. Dr. Simmons covers ethical considerations, potentials, and threats posed by AI.",
    ),
    Document(
        metadata={
            "title": "Symbiosis: Harmonizing Humans and AI",
            "author": "Prof. Jonathan K. Sterling",
        },
        page_content="Prof. Sterling explores the potential for harmonious coexistence between humans and artificial intelligence. The book discusses how AI can be integrated into society in a beneficial and non-disruptive manner.",
    ),
    Document(
        metadata={"title": "AI: The Ethical Quandary", "author": "Dr. Rebecca Simmons"},
        page_content="In her second book, Dr. Simmons delves deeper into the ethical considerations surrounding AI development and deployment. It is an eye-opening examination of the dilemmas faced by developers, policymakers, and society at large.",
    ),
    Document(
        metadata={
            "title": "Conscious Constructs: The Search for AI Sentience",
            "author": "Dr. Samuel Cortez",
        },
        page_content="Dr. Cortez takes readers on a journey exploring the controversial topic of AI consciousness. The book provides compelling arguments for and against the possibility of true AI sentience.",
    ),
    Document(
        metadata={
            "title": "Invisible Routines: Hidden AI in Everyday Life",
            "author": "Prof. Jonathan K. Sterling",
        },
        page_content="In his follow-up to 'Symbiosis', Prof. Sterling takes a look at the subtle, unnoticed presence and influence of AI in our everyday lives. It reveals how AI has become woven into our routines, often without our explicit realization.",
    ),
]
db = WeaviateVectorStore.from_documents(docs, embeddings, client=client, index_name="EliePoc")
query = db.similarity_search("polemic topic")

```

this is what I got inside query:

```auto
[Document(page_content='Dr. Cortez takes readers on a journey exploring the controversial topic of AI consciousness. The book provides compelling arguments for and against the possibility of true AI sentience.', metadata={'title': 'Conscious Constructs: The Search for AI Sentience', 'author': 'Dr. Samuel Cortez'}),
 Document(page_content='In her second book, Dr. Simmons delves deeper into the ethical considerations surrounding AI development and deployment. It is an eye-opening examination of the dilemmas faced by developers, policymakers, and society at large.', metadata={'title': 'AI: The Ethical Quandary', 'author': 'Dr. Rebecca Simmons'}),
 Document(page_content='A comprehensive analysis of the evolution of artificial intelligence, from its inception to its future prospects. Dr. Simmons covers ethical considerations, potentials, and threats posed by AI.', metadata={'title': 'Embracing The Future: AI Unveiled', 'author': 'Dr. Rebecca Simmons'}),
 Document(page_content='Prof. Sterling explores the potential for harmonious coexistence between humans and artificial intelligence. The book discusses how AI can be integrated into society in a beneficial and non-disruptive manner.', metadata={'title': 'Symbiosis: Harmonizing Humans and AI', 'author': 'Prof. Jonathan K. Sterling'})]

```

You can also filter by your metadata, like so:

```auto
from weaviate.classes.query import Filter

filter = Filter.by_property("author").equal("Dr. Samuel Cortez")
query = db.similarity_search("polemic topic", filters=filter)
print(query)

```

this will yield, as expected, only the one object from your dataset:

```auto
[Document(page_content='Dr. Cortez takes readers on a journey exploring the controversial topic of AI consciousness. The book provides compelling arguments for and against the possibility of true AI sentience.', metadata={'title': 'Conscious Constructs: The Search for AI Sentience', 'author': 'Dr. Samuel Cortez'})]

```

Let me know if this helps.

Thanks!

---

<div class="post-metadata">

**Author:** ![elie](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/elie/32/1421_2.png) [@elie](https://forum.weaviate.io/u/elie)\
**Post date:** [May 8, 2024, 4:00pm UTC](https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165/11 "2024-05-08T16:00:08Z")

</div>

Ok that works thanks, but now i have 3 issues with the v4 client, exclusively, v3 client was fine

1. is there a way to get `db` without having to add documents to the database? I’m searching for something like `db = client.get_db()` or something similar, because you add data once in the database and you need the `db` all the time, it doesn’t make sense to have to add data everytime you need to use the `db`, I need some getter

2. how to delete data and see the schema? [those](https://weaviate-python-client.readthedocs.io/en/latest/weaviate.schema.html) no longer work

```auto
schema = client.schema.get()
client.schema.delete_all()

```

`client` doesn’t have `schema` anymore

1. if I’m doing multiple queries, say I have a loop and then I do multiple `db.similarity_search` inside that loop I get this error

```auto
sys:1: ResourceWarning: unclosed <socket.socket fd=716, 
family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=0, 
laddr=('::1', 59001, 0, 0), raddr=('::1', 8080, 0, 0)>

```

---

<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:** [May 8, 2024, 7:55pm UTC](https://forum.weaviate.io/t/how-to-hide-the-client-v3-deprecation-warning/2165/12 "2024-05-08T19:55:50Z")

</div>

Nice!

1. This is how you can instantiate the db without passing documents:

```auto
import weaviate
from langchain.embeddings import OpenAIEmbeddings
from langchain_weaviate.vectorstores import WeaviateVectorStore

embeddings = OpenAIEmbeddings()
client = weaviate.connect_to_local()

db = WeaviateVectorStore.from_documents([], embeddings, client=client, index_name="EliePoc")

```

1. This is described in our docs here:  
[Manage collections | Weaviate - Vector Database](https://weaviate.io/developers/weaviate/manage-data/collections#delete-a-collection)

for instance:

```auto
client.collections.delete("EliePoc")

```

1. This seems a connectivity issue between client and server.

How big is this for loop? How does your deployment looks like?

I have ran a simple test (client running locally, and Weaviate running also locally with docker ):

```auto
results = []
for i in range(100):
    query = db.similarity_search("polemic topic")
    results.append(query)

```

and got the expected results, a list with 100 query results, and no error message.
