From ce046daf26aea902611a44c7478936b5c9045647 Mon Sep 17 00:00:00 2001 From: Shukri Date: Mon, 25 Mar 2024 17:40:05 +0100 Subject: [PATCH] Update docs (#143) Signed-off-by: hsm207 Signed-off-by: hsm207 --- docs/vectorstores.ipynb | 154 +++++++++++----------------------------- 1 file changed, 43 insertions(+), 111 deletions(-) diff --git a/docs/vectorstores.ipynb b/docs/vectorstores.ipynb index ff0300f..98ce71b 100644 --- a/docs/vectorstores.ipynb +++ b/docs/vectorstores.ipynb @@ -34,53 +34,7 @@ "execution_count": 1, "id": "d97b55c2", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: langchain-weaviate in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (0.0.1rc1)\n", - "Requirement already satisfied: langchain-core>=0.0.12 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from langchain-weaviate) (0.1.16)\n", - "Requirement already satisfied: numpy<2.0.0,>=1.26.2 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from langchain-weaviate) (1.26.3)\n", - "Requirement already satisfied: simsimd<4.0.0,>=3.6.1 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from langchain-weaviate) (3.7.2)\n", - "Requirement already satisfied: weaviate-client<5.0.0,>=4.0.0b in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from langchain-weaviate) (4.4b9)\n", - "Requirement already satisfied: PyYAML>=5.3 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from langchain-core>=0.0.12->langchain-weaviate) (6.0.1)\n", - "Requirement already satisfied: anyio<5,>=3 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from langchain-core>=0.0.12->langchain-weaviate) (4.2.0)\n", - "Requirement already satisfied: jsonpatch<2.0,>=1.33 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from langchain-core>=0.0.12->langchain-weaviate) (1.33)\n", - "Requirement already satisfied: langsmith<0.1,>=0.0.83 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from langchain-core>=0.0.12->langchain-weaviate) (0.0.84)\n", - "Requirement already satisfied: packaging<24.0,>=23.2 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from langchain-core>=0.0.12->langchain-weaviate) (23.2)\n", - "Requirement already satisfied: pydantic<3,>=1 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from langchain-core>=0.0.12->langchain-weaviate) (2.5.3)\n", - "Requirement already satisfied: requests<3,>=2 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from langchain-core>=0.0.12->langchain-weaviate) (2.31.0)\n", - "Requirement already satisfied: tenacity<9.0.0,>=8.1.0 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from langchain-core>=0.0.12->langchain-weaviate) (8.2.3)\n", - "Requirement already satisfied: httpx==0.26.0 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (0.26.0)\n", - "Requirement already satisfied: validators==0.22.0 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (0.22.0)\n", - "Requirement already satisfied: authlib<2.0.0,>=1.2.1 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (1.3.0)\n", - "Requirement already satisfied: grpcio<2.0.0,>=1.57.0 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (1.60.0)\n", - "Requirement already satisfied: grpcio-tools<2.0.0,>=1.57.0 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (1.60.0)\n", - "Requirement already satisfied: grpcio-health-checking<2.0.0,>=1.57.0 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (1.60.0)\n", - "Requirement already satisfied: certifi in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from httpx==0.26.0->weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (2023.11.17)\n", - "Requirement already satisfied: httpcore==1.* in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from httpx==0.26.0->weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (1.0.2)\n", - "Requirement already satisfied: idna in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from httpx==0.26.0->weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (3.6)\n", - "Requirement already satisfied: sniffio in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from httpx==0.26.0->weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (1.3.0)\n", - "Requirement already satisfied: h11<0.15,>=0.13 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from httpcore==1.*->httpx==0.26.0->weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (0.14.0)\n", - "Requirement already satisfied: cryptography in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from authlib<2.0.0,>=1.2.1->weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (42.0.1)\n", - "Requirement already satisfied: protobuf>=4.21.6 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from grpcio-health-checking<2.0.0,>=1.57.0->weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (4.25.2)\n", - "Requirement already satisfied: setuptools in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from grpcio-tools<2.0.0,>=1.57.0->weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (69.0.3)\n", - "Requirement already satisfied: jsonpointer>=1.9 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from jsonpatch<2.0,>=1.33->langchain-core>=0.0.12->langchain-weaviate) (2.4)\n", - "Requirement already satisfied: annotated-types>=0.4.0 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from pydantic<3,>=1->langchain-core>=0.0.12->langchain-weaviate) (0.6.0)\n", - "Requirement already satisfied: pydantic-core==2.14.6 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from pydantic<3,>=1->langchain-core>=0.0.12->langchain-weaviate) (2.14.6)\n", - "Requirement already satisfied: typing-extensions>=4.6.1 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from pydantic<3,>=1->langchain-core>=0.0.12->langchain-weaviate) (4.9.0)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from requests<3,>=2->langchain-core>=0.0.12->langchain-weaviate) (3.3.2)\n", - "Requirement already satisfied: urllib3<3,>=1.21.1 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from requests<3,>=2->langchain-core>=0.0.12->langchain-weaviate) (2.1.0)\n", - "Requirement already satisfied: cffi>=1.12 in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from cryptography->authlib<2.0.0,>=1.2.1->weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (1.16.0)\n", - "Requirement already satisfied: pycparser in /workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages (from cffi>=1.12->cryptography->authlib<2.0.0,>=1.2.1->weaviate-client<5.0.0,>=4.0.0b->langchain-weaviate) (2.21)\n", - "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.3.2\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", - "Note: you may need to restart the kernel to use updated packages.\n" - ] - } - ], + "outputs": [], "source": [ "# install package\n", "%pip install -U langchain-weaviate" @@ -179,12 +133,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/langchain_community/embeddings/openai.py:500: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " response = response.dict()\n", - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:979: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', DeprecationWarning)\n", - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/weaviate/warnings.py:215: DeprecationWarning: Dep015: You are creating a batch using client.batch or collection.batch, which is deprecated. Use X.batch._batch_mode_().\n", - " warnings.warn(\n" + "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:1024: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/\n", + " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', category=PydanticDeprecatedSince20)\n" ] } ], @@ -219,7 +169,7 @@ "metadata": {}, "outputs": [], "source": [ - "search_filter = weaviate.classes.Filter.by_property(\"source\").equal(\"blah.txt\")\n", + "search_filter = weaviate.classes.query.Filter.by_property(\"source\").equal(\"blah.txt\")\n", "filtered_search_results = db.similarity_search(query, filters=search_filter)\n", "assert len(filtered_search_results) == 0" ] @@ -231,7 +181,7 @@ "metadata": {}, "outputs": [], "source": [ - "search_filter = weaviate.classes.Filter.by_property(\"source\").equal(\n", + "search_filter = weaviate.classes.query.Filter.by_property(\"source\").equal(\n", " \"state_of_the_union.txt\"\n", ")\n", "filtered_search_results = db.similarity_search(query, filters=search_filter, k=3)\n", @@ -289,7 +239,7 @@ "data": { "text/plain": [ "(Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \\n\\nTonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service. \\n\\nOne of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. \\n\\nAnd I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence.', metadata={'source': 'state_of_the_union.txt'}),\n", - " 0.016393441706895828)" + " 1.0)" ] }, "execution_count": 8, @@ -332,8 +282,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "/tmp/ipykernel_82492/2919976745.py:7: ResourceWarning: unclosed \n", - " db = WeaviateVectorStore.from_documents(docs, embeddings, client = weaviate_client)\n", + "/tmp/ipykernel_5645/1667841775.py:7: ResourceWarning: unclosed \n", + " db = WeaviateVectorStore.from_documents(docs, embeddings, client=weaviate_client)\n", "ResourceWarning: Enable tracemalloc to get the object allocation traceback\n" ] }, @@ -361,6 +311,20 @@ "docs[0]" ] }, + { + "cell_type": "markdown", + "id": "5457d8e1", + "metadata": {}, + "source": [ + "`db.similarity_search(query, alpha=1)` will do a vector search where the vector is calculated from the `query`.\n", + "\n", + "If you prefer to provide the vector yourself, you can do so by using:\n", + "\n", + "```python\n", + "db.similarity_search(query=None, vector=[1, 2, 3], alpha=1)\n", + "```" + ] + }, { "cell_type": "markdown", "id": "a2b75761", @@ -403,7 +367,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "2024-Jan-30 09:51 AM - langchain_weaviate.vectorstores - INFO - Tenant Foo does not exist in index LangChain_a1b81358def44ba9b0f167698e09ca2c. Creating tenant.\n" + "2024-Mar-25 04:34 PM - langchain_weaviate.vectorstores - INFO - Tenant Foo does not exist in index LangChain_cf75b6e0e7e346f388ca829b4d2c4898. Creating tenant.\n" ] } ], @@ -424,8 +388,8 @@ "text/plain": [ "[Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \\n\\nTonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service. \\n\\nOne of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. \\n\\nAnd I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence.', metadata={'source': 'state_of_the_union.txt'}),\n", " Document(page_content='And so many families are living paycheck to paycheck, struggling to keep up with the rising cost of food, gas, housing, and so much more. \\n\\nI understand. \\n\\nI remember when my Dad had to leave our home in Scranton, Pennsylvania to find work. I grew up in a family where if the price of food went up, you felt it. \\n\\nThat’s why one of the first things I did as President was fight to pass the American Rescue Plan. \\n\\nBecause people were hurting. We needed to act, and we did. \\n\\nFew pieces of legislation have done more in a critical moment in our history to lift us out of crisis. \\n\\nIt fueled our efforts to vaccinate the nation and combat COVID-19. It delivered immediate economic relief for tens of millions of Americans. \\n\\nHelped put food on their table, keep a roof over their heads, and cut the cost of health insurance. \\n\\nAnd as my Dad used to say, it gave people a little breathing room.', metadata={'source': 'state_of_the_union.txt'}),\n", - " Document(page_content='Putin’s latest attack on Ukraine was premeditated and unprovoked. \\n\\nHe rejected repeated efforts at diplomacy. \\n\\nHe thought the West and NATO wouldn’t respond. And he thought he could divide us at home. Putin was wrong. We were ready. Here is what we did. \\n\\nWe prepared extensively and carefully. \\n\\nWe spent months building a coalition of other freedom-loving nations from Europe and the Americas to Asia and Africa to confront Putin. \\n\\nI spent countless hours unifying our European allies. We shared with the world in advance what we knew Putin was planning and precisely how he would try to falsely justify his aggression. \\n\\nWe countered Russia’s lies with truth. \\n\\nAnd now that he has acted the free world is holding him accountable. \\n\\nAlong with twenty-seven members of the European Union including France, Germany, Italy, as well as countries like the United Kingdom, Canada, Japan, Korea, Australia, New Zealand, and many others, even Switzerland.', metadata={'source': 'state_of_the_union.txt'}),\n", - " Document(page_content='He and his Dad both have Type 1 diabetes, which means they need insulin every day. Insulin costs about $10 a vial to make. \\n\\nBut drug companies charge families like Joshua and his Dad up to 30 times more. I spoke with Joshua’s mom. \\n\\nImagine what it’s like to look at your child who needs insulin and have no idea how you’re going to pay for it. \\n\\nWhat it does to your dignity, your ability to look your child in the eye, to be the parent you expect to be. \\n\\nJoshua is here with us tonight. Yesterday was his birthday. Happy birthday, buddy. \\n\\nFor Joshua, and for the 200,000 other young people with Type 1 diabetes, let’s cap the cost of insulin at $35 a month so everyone can afford it. \\n\\nDrug companies will still do very well. And while we’re at it let Medicare negotiate lower prices for prescription drugs, like the VA already does.', metadata={'source': 'state_of_the_union.txt'})]" + " Document(page_content='He and his Dad both have Type 1 diabetes, which means they need insulin every day. Insulin costs about $10 a vial to make. \\n\\nBut drug companies charge families like Joshua and his Dad up to 30 times more. I spoke with Joshua’s mom. \\n\\nImagine what it’s like to look at your child who needs insulin and have no idea how you’re going to pay for it. \\n\\nWhat it does to your dignity, your ability to look your child in the eye, to be the parent you expect to be. \\n\\nJoshua is here with us tonight. Yesterday was his birthday. Happy birthday, buddy. \\n\\nFor Joshua, and for the 200,000 other young people with Type 1 diabetes, let’s cap the cost of insulin at $35 a month so everyone can afford it. \\n\\nDrug companies will still do very well. And while we’re at it let Medicare negotiate lower prices for prescription drugs, like the VA already does.', metadata={'source': 'state_of_the_union.txt'}),\n", + " Document(page_content='Putin’s latest attack on Ukraine was premeditated and unprovoked. \\n\\nHe rejected repeated efforts at diplomacy. \\n\\nHe thought the West and NATO wouldn’t respond. And he thought he could divide us at home. Putin was wrong. We were ready. Here is what we did. \\n\\nWe prepared extensively and carefully. \\n\\nWe spent months building a coalition of other freedom-loving nations from Europe and the Americas to Asia and Africa to confront Putin. \\n\\nI spent countless hours unifying our European allies. We shared with the world in advance what we knew Putin was planning and precisely how he would try to falsely justify his aggression. \\n\\nWe countered Russia’s lies with truth. \\n\\nAnd now that he has acted the free world is holding him accountable. \\n\\nAlong with twenty-seven members of the European Union including France, Germany, Italy, as well as countries like the United Kingdom, Canada, Japan, Korea, Australia, New Zealand, and many others, even Switzerland.', metadata={'source': 'state_of_the_union.txt'})]" ] }, "execution_count": 11, @@ -479,10 +443,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/langchain_community/embeddings/openai.py:500: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " response = response.dict()\n", - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:979: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', DeprecationWarning)\n" + "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:1024: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/\n", + " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', category=PydanticDeprecatedSince20)\n" ] }, { @@ -531,16 +493,14 @@ " warn_deprecated(\n", "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/langchain_core/_api/deprecation.py:117: LangChainDeprecationWarning: The function `predict` was deprecated in LangChain 0.1.7 and will be removed in 0.2.0. Use invoke instead.\n", " warn_deprecated(\n", - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/langchain_community/chat_models/openai.py:458: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " response = response.dict()\n", - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:979: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', DeprecationWarning)\n" + "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:1024: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/\n", + " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', category=PydanticDeprecatedSince20)\n" ] }, { "data": { "text/plain": [ - "\"As an AI language model, I don't have real-time information or the ability to browse the internet. Therefore, I cannot provide you with the most recent statements made by the president about Justice Breyer. However, it's worth noting that the president's opinions on Justice Breyer may vary depending on the specific context and time period you are referring to.\"" + "\"I'm sorry, but I cannot provide real-time information as my responses are generated based on a mixture of licensed data, data created by human trainers, and publicly available data.\"" ] }, "execution_count": 13, @@ -600,18 +560,7 @@ "execution_count": 16, "id": "b0e106ab", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/langchain_community/embeddings/openai.py:500: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " response = response.dict()\n", - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/weaviate/warnings.py:215: DeprecationWarning: Dep015: You are creating a batch using client.batch or collection.batch, which is deprecated. Use X.batch._batch_mode_().\n", - " warnings.warn(\n" - ] - } - ], + "outputs": [], "source": [ "docsearch = WeaviateVectorStore.from_texts(\n", " texts,\n", @@ -652,14 +601,12 @@ "name": "stderr", "output_type": "stream", "text": [ - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/langchain_community/embeddings/openai.py:500: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " response = response.dict()\n", - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:979: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', DeprecationWarning)\n", - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/langchain_community/llms/openai.py:466: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " response = response.dict()\n", - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:979: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', DeprecationWarning)\n" + "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/langchain_core/_api/deprecation.py:117: LangChainDeprecationWarning: The function `__call__` was deprecated in LangChain 0.1.0 and will be removed in 0.2.0. Use invoke instead.\n", + " warn_deprecated(\n", + "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:1024: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/\n", + " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', category=PydanticDeprecatedSince20)\n", + "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:1024: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/\n", + " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', category=PydanticDeprecatedSince20)\n" ] }, { @@ -707,18 +654,7 @@ "execution_count": 20, "id": "d2ade6ae", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/langchain_community/embeddings/openai.py:500: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " response = response.dict()\n", - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/weaviate/warnings.py:215: DeprecationWarning: Dep015: You are creating a batch using client.batch or collection.batch, which is deprecated. Use X.batch._batch_mode_().\n", - " warnings.warn(\n" - ] - } - ], + "outputs": [], "source": [ "docsearch = WeaviateVectorStore.from_texts(\n", " texts,\n", @@ -779,20 +715,16 @@ "name": "stderr", "output_type": "stream", "text": [ - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/langchain_community/embeddings/openai.py:500: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " response = response.dict()\n", - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:979: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', DeprecationWarning)\n", - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/langchain_community/chat_models/openai.py:458: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " response = response.dict()\n", - "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:979: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/\n", - " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', DeprecationWarning)\n" + "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:1024: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/\n", + " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', category=PydanticDeprecatedSince20)\n", + "/workspaces/langchain-weaviate/.venv/lib/python3.12/site-packages/pydantic/main.py:1024: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/\n", + " warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', category=PydanticDeprecatedSince20)\n" ] }, { "data": { "text/plain": [ - "'The president thanked Justice Breyer for his service and referred to him as an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court.\\n'" + "\"The president honored Justice Breyer for his service to the country as an Army veteran and retiring Justice of the United States Supreme Court. The president also mentioned nominating Judge Ketanji Brown Jackson to continue Justice Breyer's legacy of excellence. The president highlighted the importance of nominating someone to serve on the United States Supreme Court as one of the most serious constitutional responsibilities.\"" ] }, "execution_count": 23,