From be2ce59eccbe906e893e3efd386776046c221178 Mon Sep 17 00:00:00 2001 From: Karthi Thyagarajan Date: Fri, 3 Oct 2025 19:50:28 -0500 Subject: [PATCH 1/2] Updated notebook to address core issues --- samples/langchain_quick_start.ipynb | 631 ++++++++++++++++++++++++---- 1 file changed, 545 insertions(+), 86 deletions(-) diff --git a/samples/langchain_quick_start.ipynb b/samples/langchain_quick_start.ipynb index ceeba04..1460062 100644 --- a/samples/langchain_quick_start.ipynb +++ b/samples/langchain_quick_start.ipynb @@ -102,13 +102,233 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: langchain-google-spanner in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (0.8.2)\n", + "Requirement already satisfied: langchain-core<1.0.0,>=0.1.25 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-google-spanner) (0.3.59)\n", + "Requirement already satisfied: langchain-community<1.0.0,>=0.0.18 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-google-spanner) (0.3.23)\n", + "Requirement already satisfied: google-cloud-spanner<4.0.0,>=3.41.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-google-spanner) (3.57.0)\n", + "Requirement already satisfied: pydantic<3.0.0,>=2.9.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-google-spanner) (2.11.4)\n", + "Requirement already satisfied: google-api-core!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (2.24.2)\n", + "Requirement already satisfied: google-cloud-core<3.0.0,>=1.4.4 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (2.4.3)\n", + "Requirement already satisfied: grpc-google-iam-v1<1.0.0,>=0.12.4 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (0.14.2)\n", + "Requirement already satisfied: proto-plus<2.0.0,>=1.22.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (1.26.1)\n", + "Requirement already satisfied: sqlparse>=0.4.4 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (0.5.3)\n", + "Requirement already satisfied: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<7.0.0,>=3.20.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (6.31.0rc2)\n", + "Requirement already satisfied: grpc-interceptor>=0.15.4 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (0.15.4)\n", + "Requirement already satisfied: googleapis-common-protos<2.0.0,>=1.56.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-api-core!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (1.70.0)\n", + "Requirement already satisfied: google-auth<3.0.0,>=2.14.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-api-core!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (2.40.1)\n", + "Requirement already satisfied: requests<3.0.0,>=2.18.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-api-core!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (2.32.4)\n", + "Requirement already satisfied: grpcio<2.0dev,>=1.33.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (1.72.0rc1)\n", + "Requirement already satisfied: grpcio-status<2.0.dev0,>=1.33.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (1.72.0rc1)\n", + "Requirement already satisfied: cachetools<6.0,>=2.0.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-auth<3.0.0,>=2.14.1->google-api-core!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (5.5.2)\n", + "Requirement already satisfied: pyasn1-modules>=0.2.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-auth<3.0.0,>=2.14.1->google-api-core!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (0.4.2)\n", + "Requirement already satisfied: rsa<5,>=3.1.4 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-auth<3.0.0,>=2.14.1->google-api-core!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (4.9.1)\n", + "Collecting langchain<1.0.0,>=0.3.24 (from langchain-community<1.0.0,>=0.0.18->langchain-google-spanner)\n", + " Downloading langchain-0.3.27-py3-none-any.whl.metadata (7.8 kB)\n", + "Requirement already satisfied: SQLAlchemy<3,>=1.4 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (2.0.40)\n", + "Requirement already satisfied: PyYAML>=5.3 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (6.0.2)\n", + "Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (3.11.18)\n", + "Requirement already satisfied: tenacity!=8.4.0,<10,>=8.1.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (8.5.0)\n", + "Requirement already satisfied: dataclasses-json<0.7,>=0.5.7 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (0.6.7)\n", + "Requirement already satisfied: pydantic-settings<3.0.0,>=2.4.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (2.9.1)\n", + "Requirement already satisfied: langsmith<0.4,>=0.1.125 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (0.1.147)\n", + "Requirement already satisfied: httpx-sse<1.0.0,>=0.4.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (0.4.0)\n", + "Requirement already satisfied: numpy>=1.26.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (1.26.4)\n", + "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (2.6.1)\n", + "Requirement already satisfied: aiosignal>=1.1.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (1.3.2)\n", + "Requirement already satisfied: attrs>=17.3.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (25.3.0)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (1.6.0)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (6.4.3)\n", + "Requirement already satisfied: propcache>=0.2.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (0.3.1)\n", + "Requirement already satisfied: yarl<2.0,>=1.17.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (1.20.0)\n", + "Requirement already satisfied: marshmallow<4.0.0,>=3.18.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from dataclasses-json<0.7,>=0.5.7->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (3.26.1)\n", + "Requirement already satisfied: typing-inspect<1,>=0.4.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from dataclasses-json<0.7,>=0.5.7->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (0.9.0)\n", + "Collecting langchain-core<1.0.0,>=0.1.25 (from langchain-google-spanner)\n", + " Downloading langchain_core-0.3.76-py3-none-any.whl.metadata (3.7 kB)\n", + "Collecting langchain-text-splitters<1.0.0,>=0.3.9 (from langchain<1.0.0,>=0.3.24->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner)\n", + " Downloading langchain_text_splitters-0.3.11-py3-none-any.whl.metadata (1.8 kB)\n", + "Collecting langsmith<0.4,>=0.1.125 (from langchain-community<1.0.0,>=0.0.18->langchain-google-spanner)\n", + " Downloading langsmith-0.3.45-py3-none-any.whl.metadata (15 kB)\n", + "Requirement already satisfied: jsonpatch<2.0,>=1.33 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-core<1.0.0,>=0.1.25->langchain-google-spanner) (1.33)\n", + "Requirement already satisfied: typing-extensions>=4.7 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-core<1.0.0,>=0.1.25->langchain-google-spanner) (4.13.2)\n", + "Requirement already satisfied: packaging>=23.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-core<1.0.0,>=0.1.25->langchain-google-spanner) (24.2)\n", + "Requirement already satisfied: jsonpointer>=1.9 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from jsonpatch<2.0,>=1.33->langchain-core<1.0.0,>=0.1.25->langchain-google-spanner) (3.0.0)\n", + "Requirement already satisfied: httpx<1,>=0.23.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langsmith<0.4,>=0.1.125->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (0.28.1)\n", + "Requirement already satisfied: orjson<4.0.0,>=3.9.14 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langsmith<0.4,>=0.1.125->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (3.10.18)\n", + "Requirement already satisfied: requests-toolbelt<2.0.0,>=1.0.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langsmith<0.4,>=0.1.125->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (1.0.0)\n", + "Requirement already satisfied: zstandard<0.24.0,>=0.23.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langsmith<0.4,>=0.1.125->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (0.23.0)\n", + "Requirement already satisfied: anyio in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from httpx<1,>=0.23.0->langsmith<0.4,>=0.1.125->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (4.9.0)\n", + "Requirement already satisfied: certifi in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from httpx<1,>=0.23.0->langsmith<0.4,>=0.1.125->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (2025.4.26)\n", + "Requirement already satisfied: httpcore==1.* in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from httpx<1,>=0.23.0->langsmith<0.4,>=0.1.125->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (1.0.9)\n", + "Requirement already satisfied: idna in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from httpx<1,>=0.23.0->langsmith<0.4,>=0.1.125->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (3.10)\n", + "Requirement already satisfied: h11>=0.16 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->langsmith<0.4,>=0.1.125->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (0.16.0)\n", + "Requirement already satisfied: annotated-types>=0.6.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.9.1->langchain-google-spanner) (0.7.0)\n", + "Requirement already satisfied: pydantic-core==2.33.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.9.1->langchain-google-spanner) (2.33.2)\n", + "Requirement already satisfied: typing-inspection>=0.4.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.9.1->langchain-google-spanner) (0.4.0)\n", + "Requirement already satisfied: python-dotenv>=0.21.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from pydantic-settings<3.0.0,>=2.4.0->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (1.1.0)\n", + "Requirement already satisfied: charset_normalizer<4,>=2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from requests<3.0.0,>=2.18.0->google-api-core!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (3.4.2)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from requests<3.0.0,>=2.18.0->google-api-core!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (2.4.0)\n", + "Requirement already satisfied: pyasn1>=0.1.3 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from rsa<5,>=3.1.4->google-auth<3.0.0,>=2.14.1->google-api-core!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0->google-cloud-spanner<4.0.0,>=3.41.0->langchain-google-spanner) (0.6.1)\n", + "Requirement already satisfied: mypy-extensions>=0.3.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from typing-inspect<1,>=0.4.0->dataclasses-json<0.7,>=0.5.7->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (1.1.0)\n", + "Requirement already satisfied: sniffio>=1.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from anyio->httpx<1,>=0.23.0->langsmith<0.4,>=0.1.125->langchain-community<1.0.0,>=0.0.18->langchain-google-spanner) (1.3.1)\n", + "Downloading langchain-0.3.27-py3-none-any.whl (1.0 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m9.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", + "\u001b[?25hDownloading langchain_core-0.3.76-py3-none-any.whl (447 kB)\n", + "Downloading langchain_text_splitters-0.3.11-py3-none-any.whl (33 kB)\n", + "Downloading langsmith-0.3.45-py3-none-any.whl (363 kB)\n", + "Installing collected packages: langsmith, langchain-core, langchain-text-splitters, langchain\n", + "\u001b[2K Attempting uninstall: langsmith\n", + "\u001b[2K Found existing installation: langsmith 0.1.147\n", + "\u001b[2K Uninstalling langsmith-0.1.147:\n", + "\u001b[2K Successfully uninstalled langsmith-0.1.147\n", + "\u001b[2K Attempting uninstall: langchain-core\n", + "\u001b[2K Found existing installation: langchain-core 0.3.59\n", + "\u001b[2K Uninstalling langchain-core-0.3.59:\n", + "\u001b[2K Successfully uninstalled langchain-core-0.3.59━━━━━━━━━━━━━━\u001b[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Attempting uninstall: langchain-text-splitters━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Found existing installation: langchain-text-splitters 0.3.8[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Uninstalling langchain-text-splitters-0.3.8:━━━━━━━━━━━━━━\u001b[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Successfully uninstalled langchain-text-splitters-0.3.8━\u001b[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Attempting uninstall: langchain━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Found existing installation: langchain 0.3.0━━━━━━━━━━━━━━\u001b[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Uninstalling langchain-0.3.0:━━━━━\u001b[0m\u001b[90m╺\u001b[0m\u001b[90m━━━━━━━━━\u001b[0m \u001b[32m3/4\u001b[0m [langchain]]\n", + "\u001b[2K Successfully uninstalled langchain-0.3.00m\u001b[90m━━━━━━━━━\u001b[0m \u001b[32m3/4\u001b[0m [langchain]\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m4/4\u001b[0m [langchain]/4\u001b[0m [langchain]\n", + "\u001b[1A\u001b[2KSuccessfully installed langchain-0.3.27 langchain-core-0.3.76 langchain-text-splitters-0.3.11 langsmith-0.3.45\n", + "Note: you may need to restart the kernel to use updated packages.\n", + "Collecting langchain==0.3\n", + " Using cached langchain-0.3.0-py3-none-any.whl.metadata (7.1 kB)\n", + "Requirement already satisfied: langchain-google-vertexai in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (2.0.24)\n", + "Requirement already satisfied: PyYAML>=5.3 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain==0.3) (6.0.2)\n", + "Requirement already satisfied: SQLAlchemy<3,>=1.4 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain==0.3) (2.0.40)\n", + "Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain==0.3) (3.11.18)\n", + "Requirement already satisfied: langchain-core<0.4.0,>=0.3.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain==0.3) (0.3.76)\n", + "Requirement already satisfied: langchain-text-splitters<0.4.0,>=0.3.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain==0.3) (0.3.11)\n", + "Collecting langsmith<0.2.0,>=0.1.17 (from langchain==0.3)\n", + " Using cached langsmith-0.1.147-py3-none-any.whl.metadata (14 kB)\n", + "Requirement already satisfied: numpy<2,>=1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain==0.3) (1.26.4)\n", + "Requirement already satisfied: pydantic<3.0.0,>=2.7.4 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain==0.3) (2.11.4)\n", + "Requirement already satisfied: requests<3,>=2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain==0.3) (2.32.4)\n", + "Requirement already satisfied: tenacity!=8.4.0,<9.0.0,>=8.1.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain==0.3) (8.5.0)\n", + "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain==0.3) (2.6.1)\n", + "Requirement already satisfied: aiosignal>=1.1.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain==0.3) (1.3.2)\n", + "Requirement already satisfied: attrs>=17.3.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain==0.3) (25.3.0)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain==0.3) (1.6.0)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain==0.3) (6.4.3)\n", + "Requirement already satisfied: propcache>=0.2.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain==0.3) (0.3.1)\n", + "Requirement already satisfied: yarl<2.0,>=1.17.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain==0.3) (1.20.0)\n", + "INFO: pip is looking at multiple versions of langchain-core to determine which version is compatible with other requirements. This could take a while.\n", + "Collecting langchain-core<0.4.0,>=0.3.0 (from langchain==0.3)\n", + " Downloading langchain_core-0.3.75-py3-none-any.whl.metadata (5.7 kB)\n", + " Downloading langchain_core-0.3.74-py3-none-any.whl.metadata (5.8 kB)\n", + " Downloading langchain_core-0.3.73-py3-none-any.whl.metadata (5.8 kB)\n", + " Downloading langchain_core-0.3.72-py3-none-any.whl.metadata (5.8 kB)\n", + " Downloading langchain_core-0.3.71-py3-none-any.whl.metadata (5.8 kB)\n", + " Downloading langchain_core-0.3.70-py3-none-any.whl.metadata (5.8 kB)\n", + " Downloading langchain_core-0.3.69-py3-none-any.whl.metadata (5.8 kB)\n", + "INFO: pip is still looking at multiple versions of langchain-core to determine which version is compatible with other requirements. This could take a while.\n", + " Downloading langchain_core-0.3.68-py3-none-any.whl.metadata (5.8 kB)\n", + " Downloading langchain_core-0.3.67-py3-none-any.whl.metadata (5.8 kB)\n", + " Downloading langchain_core-0.3.66-py3-none-any.whl.metadata (5.8 kB)\n", + " Downloading langchain_core-0.3.65-py3-none-any.whl.metadata (5.8 kB)\n", + " Downloading langchain_core-0.3.64-py3-none-any.whl.metadata (5.8 kB)\n", + "INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.\n", + " Downloading langchain_core-0.3.63-py3-none-any.whl.metadata (5.8 kB)\n", + "Requirement already satisfied: jsonpatch<2.0,>=1.33 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-core<0.4.0,>=0.3.0->langchain==0.3) (1.33)\n", + "Requirement already satisfied: packaging<25,>=23.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-core<0.4.0,>=0.3.0->langchain==0.3) (24.2)\n", + "Requirement already satisfied: typing-extensions>=4.7 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-core<0.4.0,>=0.3.0->langchain==0.3) (4.13.2)\n", + "Requirement already satisfied: jsonpointer>=1.9 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from jsonpatch<2.0,>=1.33->langchain-core<0.4.0,>=0.3.0->langchain==0.3) (3.0.0)\n", + "Collecting langchain-text-splitters<0.4.0,>=0.3.0 (from langchain==0.3)\n", + " Using cached langchain_text_splitters-0.3.11-py3-none-any.whl.metadata (1.8 kB)\n", + "Requirement already satisfied: httpx<1,>=0.23.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langsmith<0.2.0,>=0.1.17->langchain==0.3) (0.28.1)\n", + "Requirement already satisfied: orjson<4.0.0,>=3.9.14 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langsmith<0.2.0,>=0.1.17->langchain==0.3) (3.10.18)\n", + "Requirement already satisfied: requests-toolbelt<2.0.0,>=1.0.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langsmith<0.2.0,>=0.1.17->langchain==0.3) (1.0.0)\n", + "Requirement already satisfied: anyio in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.17->langchain==0.3) (4.9.0)\n", + "Requirement already satisfied: certifi in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.17->langchain==0.3) (2025.4.26)\n", + "Requirement already satisfied: httpcore==1.* in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.17->langchain==0.3) (1.0.9)\n", + "Requirement already satisfied: idna in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.17->langchain==0.3) (3.10)\n", + "Requirement already satisfied: h11>=0.16 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.17->langchain==0.3) (0.16.0)\n", + " Downloading langchain_text_splitters-0.3.10-py3-none-any.whl.metadata (1.9 kB)\n", + "Collecting pip>=25.2 (from langchain-text-splitters<0.4.0,>=0.3.0->langchain==0.3)\n", + " Downloading pip-25.2-py3-none-any.whl.metadata (4.7 kB)\n", + "Collecting langchain-text-splitters<0.4.0,>=0.3.0 (from langchain==0.3)\n", + " Downloading langchain_text_splitters-0.3.9-py3-none-any.whl.metadata (1.9 kB)\n", + " Downloading langchain_text_splitters-0.3.8-py3-none-any.whl.metadata (1.9 kB)\n", + "Requirement already satisfied: annotated-types>=0.6.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.7.4->langchain==0.3) (0.7.0)\n", + "Requirement already satisfied: pydantic-core==2.33.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.7.4->langchain==0.3) (2.33.2)\n", + "Requirement already satisfied: typing-inspection>=0.4.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.7.4->langchain==0.3) (0.4.0)\n", + "Requirement already satisfied: charset_normalizer<4,>=2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from requests<3,>=2->langchain==0.3) (3.4.2)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from requests<3,>=2->langchain==0.3) (2.4.0)\n", + "Requirement already satisfied: bottleneck<2.0.0,>=1.4.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-google-vertexai) (1.4.2)\n", + "Requirement already satisfied: google-cloud-aiplatform<2.0.0,>=1.92.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-google-vertexai) (1.109.0)\n", + "Requirement already satisfied: google-cloud-storage<3.0.0,>=2.18.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-google-vertexai) (2.19.0)\n", + "Requirement already satisfied: httpx-sse<0.5.0,>=0.4.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-google-vertexai) (0.4.0)\n", + "Requirement already satisfied: numexpr<3.0.0,>=2.8.6 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-google-vertexai) (2.10.2)\n", + "Requirement already satisfied: pyarrow<20.0.0,>=19.0.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-google-vertexai) (19.0.1)\n", + "Requirement already satisfied: validators<1,>=0.22.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from langchain-google-vertexai) (0.35.0)\n", + "Requirement already satisfied: google-api-core!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,<3.0.0,>=1.34.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,<3.0.0,>=1.34.1->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (2.24.2)\n", + "Requirement already satisfied: google-auth<3.0.0,>=2.14.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (2.40.1)\n", + "Requirement already satisfied: proto-plus<2.0.0,>=1.22.3 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (1.26.1)\n", + "Requirement already satisfied: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<7.0.0,>=3.20.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (6.31.0rc2)\n", + "Requirement already satisfied: google-cloud-bigquery!=3.20.0,<4.0.0,>=1.15.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (3.31.0)\n", + "Requirement already satisfied: google-cloud-resource-manager<3.0.0,>=1.3.3 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (1.14.2)\n", + "Requirement already satisfied: shapely<3.0.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (2.1.0)\n", + "Requirement already satisfied: google-genai<2.0.0,>=1.0.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (1.30.0)\n", + "Requirement already satisfied: docstring_parser<1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (0.16)\n", + "Requirement already satisfied: googleapis-common-protos<2.0.0,>=1.56.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-api-core!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,<3.0.0,>=1.34.1->google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,<3.0.0,>=1.34.1->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (1.70.0)\n", + "Requirement already satisfied: grpcio<2.0dev,>=1.33.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,<3.0.0,>=1.34.1->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (1.72.0rc1)\n", + "Requirement already satisfied: grpcio-status<2.0.dev0,>=1.33.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,<3.0.0,>=1.34.1->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (1.72.0rc1)\n", + "Requirement already satisfied: cachetools<6.0,>=2.0.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-auth<3.0.0,>=2.14.1->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (5.5.2)\n", + "Requirement already satisfied: pyasn1-modules>=0.2.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-auth<3.0.0,>=2.14.1->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (0.4.2)\n", + "Requirement already satisfied: rsa<5,>=3.1.4 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-auth<3.0.0,>=2.14.1->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (4.9.1)\n", + "Requirement already satisfied: google-cloud-core<3.0.0,>=2.4.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-bigquery!=3.20.0,<4.0.0,>=1.15.0->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (2.4.3)\n", + "Requirement already satisfied: google-resumable-media<3.0.0,>=2.0.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-bigquery!=3.20.0,<4.0.0,>=1.15.0->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (2.7.2)\n", + "Requirement already satisfied: python-dateutil<3.0.0,>=2.8.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-bigquery!=3.20.0,<4.0.0,>=1.15.0->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (2.9.0.post0)\n", + "Requirement already satisfied: grpc-google-iam-v1<1.0.0,>=0.14.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-resource-manager<3.0.0,>=1.3.3->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (0.14.2)\n", + "Requirement already satisfied: google-crc32c<2.0dev,>=1.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-storage<3.0.0,>=2.18.0->langchain-google-vertexai) (1.7.1)\n", + "Requirement already satisfied: websockets<15.1.0,>=13.0.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-genai<2.0.0,>=1.0.0->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (15.0.1)\n", + "Requirement already satisfied: sniffio>=1.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from anyio->httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.17->langchain==0.3) (1.3.1)\n", + "Requirement already satisfied: six>=1.5 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from python-dateutil<3.0.0,>=2.8.2->google-cloud-bigquery!=3.20.0,<4.0.0,>=1.15.0->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (1.17.0)\n", + "Requirement already satisfied: pyasn1>=0.1.3 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from rsa<5,>=3.1.4->google-auth<3.0.0,>=2.14.1->google-cloud-aiplatform<2.0.0,>=1.92.0->langchain-google-vertexai) (0.6.1)\n", + "Using cached langchain-0.3.0-py3-none-any.whl (1.0 MB)\n", + "Downloading langchain_core-0.3.63-py3-none-any.whl (438 kB)\n", + "Using cached langsmith-0.1.147-py3-none-any.whl (311 kB)\n", + "Downloading langchain_text_splitters-0.3.8-py3-none-any.whl (32 kB)\n", + "Installing collected packages: langsmith, langchain-core, langchain-text-splitters, langchain\n", + "\u001b[2K Attempting uninstall: langsmith\n", + "\u001b[2K Found existing installation: langsmith 0.3.45\n", + "\u001b[2K Uninstalling langsmith-0.3.45:\n", + "\u001b[2K Successfully uninstalled langsmith-0.3.45\n", + "\u001b[2K Attempting uninstall: langchain-core\n", + "\u001b[2K Found existing installation: langchain-core 0.3.76\n", + "\u001b[2K Uninstalling langchain-core-0.3.76:\n", + "\u001b[2K Successfully uninstalled langchain-core-0.3.76\n", + "\u001b[2K Attempting uninstall: langchain-text-splitters━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Found existing installation: langchain-text-splitters 0.3.110m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Uninstalling langchain-text-splitters-0.3.11:━━━━━━━━━━━━━\u001b[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Successfully uninstalled langchain-text-splitters-0.3.11\u001b[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Attempting uninstall: langchain━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Found existing installation: langchain 0.3.27━━━━━━━━━━━━━\u001b[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Uninstalling langchain-0.3.27:━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K Successfully uninstalled langchain-0.3.27━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1/4\u001b[0m [langchain-core]\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m4/4\u001b[0m [langchain]/4\u001b[0m [langchain]]\n", + "\u001b[1A\u001b[2K\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n", + "langchain-community 0.3.23 requires langchain<1.0.0,>=0.3.24, but you have langchain 0.3.0 which is incompatible.\u001b[0m\u001b[31m\n", + "\u001b[0mSuccessfully installed langchain-0.3.0 langchain-core-0.3.63 langchain-text-splitters-0.3.8 langsmith-0.1.147\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], "source": [ "%pip install langchain-google-spanner\n", "# Install additional dependencies\n", - "%pip install langchain langchain-google-vertexai" + "%pip install langchain==0.3 langchain-google-vertexai" ] }, { @@ -125,7 +345,18 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Your browser has been opened to visit:\n", + "\n", + " https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=32555940559.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&scope=openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fsqlservice.login+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Faccounts.reauth&state=5KFl73uDcsf3WdVAMc0I1ff20UC3uO&access_type=offline&code_challenge=HYXwT0TEemP5gzZIXIz2lXEojp0TFvRI47_2jEa92Zo&code_challenge_method=S256\n", + "\n" + ] + } + ], "source": [ "!gcloud auth login" ] @@ -305,9 +536,35 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: google-cloud-storage in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (2.19.0)\n", + "Requirement already satisfied: google-auth<3.0dev,>=2.26.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-storage) (2.40.1)\n", + "Requirement already satisfied: google-api-core<3.0.0dev,>=2.15.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-storage) (2.24.2)\n", + "Requirement already satisfied: google-cloud-core<3.0dev,>=2.3.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-storage) (2.4.3)\n", + "Requirement already satisfied: google-resumable-media>=2.7.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-storage) (2.7.2)\n", + "Requirement already satisfied: requests<3.0.0dev,>=2.18.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-storage) (2.32.4)\n", + "Requirement already satisfied: google-crc32c<2.0dev,>=1.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-cloud-storage) (1.7.1)\n", + "Requirement already satisfied: googleapis-common-protos<2.0.0,>=1.56.2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-api-core<3.0.0dev,>=2.15.0->google-cloud-storage) (1.70.0)\n", + "Requirement already satisfied: protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<7.0.0,>=3.19.5 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-api-core<3.0.0dev,>=2.15.0->google-cloud-storage) (6.31.0rc2)\n", + "Requirement already satisfied: proto-plus<2.0.0,>=1.22.3 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-api-core<3.0.0dev,>=2.15.0->google-cloud-storage) (1.26.1)\n", + "Requirement already satisfied: cachetools<6.0,>=2.0.0 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-auth<3.0dev,>=2.26.1->google-cloud-storage) (5.5.2)\n", + "Requirement already satisfied: pyasn1-modules>=0.2.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-auth<3.0dev,>=2.26.1->google-cloud-storage) (0.4.2)\n", + "Requirement already satisfied: rsa<5,>=3.1.4 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from google-auth<3.0dev,>=2.26.1->google-cloud-storage) (4.9.1)\n", + "Requirement already satisfied: charset_normalizer<4,>=2 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from requests<3.0.0dev,>=2.18.0->google-cloud-storage) (3.4.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from requests<3.0.0dev,>=2.18.0->google-cloud-storage) (3.10)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from requests<3.0.0dev,>=2.18.0->google-cloud-storage) (2.4.0)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from requests<3.0.0dev,>=2.18.0->google-cloud-storage) (2025.4.26)\n", + "Requirement already satisfied: pyasn1>=0.1.3 in /Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages (from rsa<5,>=3.1.4->google-auth<3.0dev,>=2.26.1->google-cloud-storage) (0.6.1)\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], "source": [ "%pip install google-cloud-storage" ] @@ -323,7 +580,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -357,9 +614,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Waiting for operation to complete...\n", + "Table created.\n" + ] + } + ], "source": [ "from google.cloud import spanner\n", "\n", @@ -397,9 +663,17 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Created multiplexed session.\n" + ] + } + ], "source": [ "rows = read_csv_from_gcs(\n", " \"cloud-samples-data\", \"langchain/netflix_titles_compute_embeddings.csv\"\n", @@ -452,7 +726,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 6, "metadata": { "id": "2SdFJT6Vece1" }, @@ -480,7 +754,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 7, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -489,12 +763,20 @@ "outputId": "da7239e4-710d-43ce-c004-520a0af9c79f" }, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Created multiplexed session.\n", + "Created multiplexed session.\n" + ] + }, { "name": "stdout", "output_type": "stream", "text": [ "Loaded 8802 from the database. 5 Examples:\n", - "page_content=\"The Starling Theodore Melfi Melissa McCarthy, Chris O'Dowd, Kevin Kline, Timothy Olyphant, Daveed Diggs, Skyler Gisondo, Laura Harrier, Rosalind Chao, Kimberly Quinn, Loretta Devine, Ravi Kapoor A woman adjusting to life after a loss contends with a feisty bird that's taken over her garden — and a husband who's struggling to find a way forward.\" metadata={'show_id': 's10', 'type': 'Movie', 'country': 'United States', 'date_added': 'September 24, 2021', 'release_year': 2021, 'rating': 'PG-13', 'duration': '104 min', 'listed_in': 'Comedies, Dramas'}\n", + "page_content='The Starling Theodore Melfi Melissa McCarthy, Chris O'Dowd, Kevin Kline, Timothy Olyphant, Daveed Diggs, Skyler Gisondo, Laura Harrier, Rosalind Chao, Kimberly Quinn, Loretta Devine, Ravi Kapoor A woman adjusting to life after a loss contends with a feisty bird that's taken over her garden — and a husband who's struggling to find a way forward.' metadata={'show_id': 's10', 'type': 'Movie', 'country': 'United States', 'date_added': 'September 24, 2021', 'release_year': 2021, 'rating': 'PG-13', 'duration': '104 min', 'listed_in': 'Comedies, Dramas'}\n", "page_content='On the Verge Julie Delpy, Elisabeth Shue, Sarah Jones, Alexia Landeau, Mathieu Demy, Troy Garity, Timm Sharp, Giovanni Ribisi Four women — a chef, a single mom, an heiress and a job seeker — dig into love and work, with a generous side of midlife crises, in pre-pandemic LA.' metadata={'show_id': 's100', 'type': 'TV Show', 'country': 'France, United States', 'date_added': 'September 7, 2021', 'release_year': 2021, 'rating': 'TV-MA', 'duration': '1 Season', 'listed_in': 'TV Comedies, TV Dramas'}\n", "page_content='Stowaway Joe Penna Anna Kendrick, Toni Collette, Daniel Dae Kim, Shamier Anderson A three-person crew on a mission to Mars faces an impossible choice when an unplanned passenger jeopardizes the lives of everyone on board.' metadata={'show_id': 's1000', 'type': 'Movie', 'country': 'Germany, United States', 'date_added': 'April 22, 2021', 'release_year': 2021, 'rating': 'TV-MA', 'duration': '116 min', 'listed_in': 'Dramas, International Movies, Thrillers'}\n", "page_content='Wild Dog Ahishor Solomon Nagarjuna Akkineni, Dia Mirza, Saiyami Kher, Atul Kulakarni, Bilal Hussain, Ali Reza, Mayank Parakh A brash but brilliant Indian intelligence agent leads a covert operation to nab the mastermind behind a series of attacks threatening national security.' metadata={'show_id': 's1001', 'type': 'Movie', 'country': '', 'date_added': 'April 22, 2021', 'release_year': 2020, 'rating': 'TV-MA', 'duration': '126 min', 'listed_in': 'Action & Adventure, International Movies'}\n", @@ -538,9 +820,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Waiting for operation to complete...\n" + ] + }, + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "from langchain_google_spanner import SpannerVectorStore, TableColumn\n", "\n", @@ -578,17 +878,29 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 11, "metadata": { "id": "Wo4-7EYCIFF9" }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages/vertexai/_model_garden/_model_garden_models.py:278: UserWarning: This feature is deprecated as of June 24, 2025 and will be removed on June 24, 2026. For details, see https://cloud.google.com/vertex-ai/generative-ai/docs/deprecations/genai-vertexai-sdk.\n", + " warning_logs.show_deprecation_warning()\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n" + ] + } + ], "source": [ "from langchain_google_vertexai.embeddings import VertexAIEmbeddings\n", "\n", - "# Initialize the embedding service. In this case we are using version 003 of Vertex AI's textembedding-gecko model. In general, it is good practice to specify the model version used.\n", + "# Initialize the embedding service. In this case we are using version 005 of Vertex AI's textembedding model. In general, it is good practice to specify the model version used.\n", "embeddings_service = VertexAIEmbeddings(\n", - " model_name=\"textembedding-gecko@003\", project=project_id\n", + " model_name=\"text-embedding-005\", project=project_id\n", ")\n", "\n", "\n", @@ -621,11 +933,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": { "id": "CTks8Cy--93B" }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['5bbfe073-f577-4b8b-8378-1801ef00f42a',\n", + " 'd7a5e63e-e244-4b64-9d70-536371af9c4f',\n", + " 'da924eb2-de47-49eb-9f86-58cb25b6ec46',\n", + " '1a8e8b84-e8f4-43bb-b85d-9d7bf8a964fa',\n", + " '13631552-0b79-4ab1-8183-89419a51901b']" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import uuid\n", "\n", @@ -651,7 +978,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 13, "metadata": { "id": "FEe9El7QMjHi" }, @@ -668,7 +995,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -706,7 +1033,7 @@ "### Approximate Nearest Neighbors (ANN) based vector store\n", "For this task, we shall pull in documents from a popular HackerNews post, insert them into our ANN based vector store and then use ANN to find the most relevent comments/content\n", "\n", - "To create vector embeddings, we shall be using Google's Vertex AI gecko-003 model and then for all related queries, vectorize the query using our embedding service to then perform the search.\n", + "To create vector embeddings, we shall be using Google's Vertex AI text-embedding-005 model and then for all related queries, vectorize the query using our embedding service to then perform the search.\n", "\n", "Cloud Spanner allows for 3 different algorithms to be created with the vector search index and correspondingly used for the search:\n", "* APPROX_COSINE\n", @@ -739,14 +1066,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages/vertexai/_model_garden/_model_garden_models.py:278: UserWarning: This feature is deprecated as of June 24, 2025 and will be removed on June 24, 2026. For details, see https://cloud.google.com/vertex-ai/generative-ai/docs/deprecations/genai-vertexai-sdk.\n", + " warning_logs.show_deprecation_warning()\n" + ] + } + ], "source": [ "from langchain_google_vertexai.embeddings import VertexAIEmbeddings\n", "\n", "embeddings_service = VertexAIEmbeddings(\n", - " model_name=\"textembedding-gecko@003\", project=project_id\n", + " model_name=\"text-embedding-005\", project=project_id\n", ")\n", "embedding_vector_size = 768\n", "vector_index_name = \"titles_index\"\n", @@ -767,9 +1103,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Waiting for operation to complete...\n" + ] + }, + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "from langchain_google_spanner.vector_store import (\n", " DistanceStrategy,\n", @@ -779,6 +1133,8 @@ " VectorSearchIndex,\n", ")\n", "\n", + "table_name_ANN=\"movie_vector_table_samples_ANN\"\n", + "\n", "SpannerVectorStore.init_vector_store_table(\n", " instance_id=instance_id,\n", " database_id=database_id,\n", @@ -816,13 +1172,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n" + ] + } + ], "source": [ "db = SpannerVectorStore(\n", " instance_id=instance_id,\n", - " database_id=google_database,\n", + " database_id=database_id,\n", " table_name=table_name_ANN,\n", " id_column=\"row_id\",\n", " ignore_metadata_columns=[],\n", @@ -849,18 +1216,41 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 55, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "n_docs 3\n" + ] + } + ], "source": [ "import uuid\n", + "from langchain_core.documents import Document\n", + "from langchain_community.document_loaders import TextLoader\n", + "from langchain_text_splitters import CharacterTextSplitter\n", + "\n", + "fruit_docs = [\n", + " Document(\n", + " page_content=\"Apple Granny Smith 150 0.99 1\",\n", + " metadata={\"title\": \"apple\"},\n", + " ),\n", + " Document(\n", + " page_content=\"Banana Cavendish 200 0.59 0\",\n", + " metadata={\"title\": \"banana\"},\n", + " ),\n", + " Document(\n", + " page_content=\"Orange Navel 80 1.29 1\",\n", + " metadata={\"title\": \"orange\"},\n", + " ),\n", + "]\n", "\n", - "loader = HNLoader(\"https://news.ycombinator.com/item?id=42797260\")\n", - "inserted_docs = loader.load()\n", - "docs = inserted_docs.copy()\n", - "ids = [str(uuid.uuid4()) for _ in range(len(docs))]\n", - "db.add_documents(documents=docs, ids=ids)\n", - "print(\"n_docs\", len(docs))" + "ids = [str(uuid.uuid4()) for _ in range(len(fruit_docs))]\n", + "db.add_documents(documents=fruit_docs, ids=ids)\n", + "print(\"n_docs\", len(fruit_docs))" ] }, { @@ -882,12 +1272,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 56, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "by similarity_search [Document(metadata={'title': 'orange'}, page_content='Orange Navel 80 1.29 1'), Document(metadata={'title': 'banana'}, page_content='Banana Cavendish 200 0.59 0')]\n" + ] + } + ], "source": [ "docs = db.similarity_search(\n", - " \"Open source software\",\n", + " \"orange\",\n", " k=2,\n", ")\n", "print(\"by similarity_search\", docs)" @@ -902,12 +1300,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 57, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "by direct vector_search [Document(metadata={'title': 'orange'}, page_content='Orange Navel 80 1.29 1'), Document(metadata={'title': 'banana'}, page_content='Banana Cavendish 200 0.59 0'), Document(metadata={'title': 'apple'}, page_content='Apple Granny Smith 150 0.99 1')]\n" + ] + } + ], "source": [ "embeds = embeddings_service.embed_query(\n", - " \"Open source software\",\n", + " \"orange\",\n", ")\n", "docs = db.similarity_search_by_vector(\n", " embeds,\n", @@ -925,9 +1331,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 58, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "by max_marginal_relevance_search [(Document(metadata={'title': 'orange'}, page_content='Orange Navel 80 1.29 1'), 0.3597469567919436), (Document(metadata={'title': 'apple'}, page_content='Apple Granny Smith 150 0.99 1'), 0.46334450128966564), (Document(metadata={'title': 'banana'}, page_content='Banana Cavendish 200 0.59 0'), 0.46136322919171247)]\n" + ] + } + ], "source": [ "docs = db.max_marginal_relevance_search_with_score_by_vector(\n", " embeds,\n", @@ -947,11 +1361,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 59, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "deleted True\n" + ] + } + ], "source": [ - "deleted = db.delete(documents=inserted_docs)\n", + "deleted = db.delete(documents=fruit_docs)\n", "print(\"deleted\", deleted)" ] }, @@ -975,9 +1397,21 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 32, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n" + ] + } + ], "source": [ "from langchain_google_spanner import (\n", " SpannerChatMessageHistory,\n", @@ -1008,7 +1442,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 33, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -1020,11 +1454,11 @@ { "data": { "text/plain": [ - "[HumanMessage(content='Hi!'),\n", - " AIMessage(content=\"Hello there. I'm a model and am happy to help!\")]" + "[HumanMessage(content='Hi!', additional_kwargs={}, response_metadata={}),\n", + " AIMessage(content=\"Hello there. I'm a model and am happy to help!\", additional_kwargs={}, response_metadata={})]" ] }, - "execution_count": 35, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -1058,11 +1492,37 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 40, "metadata": { "id": "9ukjOO-sNQ8_" }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/karthit/miniforge3/envs/langchain-spanner/lib/python3.11/site-packages/vertexai/_model_garden/_model_garden_models.py:278: UserWarning: This feature is deprecated as of June 24, 2025 and will be removed on June 24, 2026. For details, see https://cloud.google.com/vertex-ai/generative-ai/docs/deprecations/genai-vertexai-sdk.\n", + " warning_logs.show_deprecation_warning()\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n", + "Created multiplexed session.\n" + ] + } + ], "source": [ "from langchain_google_vertexai import VertexAI\n", "from langchain_google_vertexai.embeddings import VertexAIEmbeddings\n", @@ -1078,7 +1538,7 @@ "\n", "# Intialize the embedding service\n", "embeddings_service = VertexAIEmbeddings(\n", - " model_name=\"textembedding-gecko@003\", project=project_id\n", + " model_name=\"text-embedding-005\", project=project_id\n", ")\n", "\n", "# Intialize the Vector Store\n", @@ -1120,7 +1580,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 41, "metadata": { "id": "LoAHNdrWmW9W" }, @@ -1165,7 +1625,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 42, "metadata": { "id": "1nI0xkJamvXt" }, @@ -1188,13 +1648,13 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 44, "metadata": { "id": "VBWhg-ihnnxF" }, "outputs": [], "source": [ - "llm = VertexAI(model_name=\"gemini-pro\", project=project_id)" + "llm = VertexAI(model_name=\"gemini-2.5-pro\", project=project_id)" ] }, { @@ -1208,7 +1668,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 45, "metadata": { "id": "1UkPcEpJno5Y" }, @@ -1236,7 +1696,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 60, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -1250,35 +1710,34 @@ "output_type": "stream", "text": [ "Question: What movie was Brad Pitt in?\n", - "Answer: - Inglourious Basterds\n", - "- By the Sea\n", - "- Killing Them Softly\n", - "- Babel\n", - "- War Machine\n", + "Answer: As mentioned in our previous conversation, I didn't find the answer in the given data.\n", "\n", "Question: How about Jonny Depp?\n", - "Answer: - Charlie and the Chocolate Factory\n", - "- The Rum Diary\n", - "- What's Eating Gilbert Grape\n", - "- The Imaginarium of Doctor Parnassus\n", + "Answer: As mentioned in our previous conversation, I didn't find the answer in the given data.\n", "\n", "Question: Are there movies about animals?\n", - "Answer: Yes, there are movies about animals. From the vector search result, here are some examples: \"Open Season,\" \"If I Were an Animal,\" \"The Animal People,\" \"We're No Animals\" and \"Animals on the Loose: A You vs. Wild Movie.\"\n", + "Answer: Yes, as mentioned in our previous conversation, the movie \"The Starling\" is about an animal. Based on the context provided, its description is: \"A woman adjusting to life after a loss contends with a feisty bird that's taken over her garden — and a husband who's struggling to find a way forward.\"\n", "\n" ] }, { "data": { "text/plain": [ - "[HumanMessage(content='What movie was Brad Pitt in?'),\n", - " AIMessage(content='- Inglourious Basterds\\n- By the Sea\\n- Killing Them Softly\\n- Babel\\n- War Machine'),\n", - " HumanMessage(content='How about Jonny Depp?'),\n", - " AIMessage(content=\"- Charlie and the Chocolate Factory\\n- The Rum Diary\\n- What's Eating Gilbert Grape\\n- The Imaginarium of Doctor Parnassus\"),\n", - " HumanMessage(content='Are there movies about animals?'),\n", - " AIMessage(content='Yes, there are movies about animals. From the vector search result, here are some examples: \"Open Season,\" \"If I Were an Animal,\" \"The Animal People,\" \"We\\'re No Animals\" and \"Animals on the Loose: A You vs. Wild Movie.\"')]" + "[HumanMessage(content='What movie was Brad Pitt in?', additional_kwargs={}, response_metadata={}),\n", + " AIMessage(content=\"I didn't find the answer in the given data.\", additional_kwargs={}, response_metadata={}),\n", + " HumanMessage(content='How about Jonny Depp?', additional_kwargs={}, response_metadata={}),\n", + " AIMessage(content=\"I didn't find the answer in the given data.\", additional_kwargs={}, response_metadata={}),\n", + " HumanMessage(content='Are there movies about animals?', additional_kwargs={}, response_metadata={}),\n", + " AIMessage(content='Yes, based on the information provided in the context, the movie \"The Starling\" is about an animal. Its description is: \"A woman adjusting to life after a loss contends with a feisty bird that\\'s taken over her garden — and a husband who\\'s struggling to find a way forward.\"', additional_kwargs={}, response_metadata={}),\n", + " HumanMessage(content='What movie was Brad Pitt in?', additional_kwargs={}, response_metadata={}),\n", + " AIMessage(content=\"As mentioned in our previous conversation, I didn't find the answer in the given data.\", additional_kwargs={}, response_metadata={}),\n", + " HumanMessage(content='How about Jonny Depp?', additional_kwargs={}, response_metadata={}),\n", + " AIMessage(content=\"As mentioned in our previous conversation, I didn't find the answer in the given data.\", additional_kwargs={}, response_metadata={}),\n", + " HumanMessage(content='Are there movies about animals?', additional_kwargs={}, response_metadata={}),\n", + " AIMessage(content='Yes, as mentioned in our previous conversation, the movie \"The Starling\" is about an animal. Based on the context provided, its description is: \"A woman adjusting to life after a loss contends with a feisty bird that\\'s taken over her garden — and a husband who\\'s struggling to find a way forward.\"', additional_kwargs={}, response_metadata={})]" ] }, - "execution_count": 44, + "execution_count": 60, "metadata": {}, "output_type": "execute_result" } @@ -1318,7 +1777,7 @@ "toc_visible": true }, "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "langchain-spanner", "language": "python", "name": "python3" }, @@ -1332,7 +1791,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.11.12" } }, "nbformat": 4, From 1bc9205809dc89f3ad33be5e97ac2bbfec02b0f2 Mon Sep 17 00:00:00 2001 From: Karthi Thyagarajan Date: Fri, 3 Oct 2025 19:54:48 -0500 Subject: [PATCH 2/2] Fix issue #137 --- samples/langchain_quick_start.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/langchain_quick_start.ipynb b/samples/langchain_quick_start.ipynb index 1460062..7920367 100644 --- a/samples/langchain_quick_start.ipynb +++ b/samples/langchain_quick_start.ipynb @@ -1216,7 +1216,7 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -1233,6 +1233,7 @@ "from langchain_community.document_loaders import TextLoader\n", "from langchain_text_splitters import CharacterTextSplitter\n", "\n", + "# showcase loading of custom documents\n", "fruit_docs = [\n", " Document(\n", " page_content=\"Apple Granny Smith 150 0.99 1\",\n",