Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions docs/chat_message_history.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
"outputs": [],
"source": [
"%pip install --upgrade --quiet langchain-google-cloud-sql-pg langchain-google-vertexai"
"%pip install --upgrade --quiet langchain-google-cloud-sql-pg langchain-google-vertexai cloud-sql-python-connector[pg8000]"
]
},
{
Expand Down Expand Up @@ -236,7 +236,9 @@
"Optionally, [built-in database authentication](https://cloud.google.com/sql/docs/postgres/built-in-authentication) using a username and password to access the Cloud SQL database can also be used. Just provide the optional `user` and `password` arguments to `PostgresEngine.from_instance()`:\n",
"\n",
"* `user` : Database user to use for built-in database authentication and login\n",
"* `password` : Database password to use for built-in database authentication and login.\n"
"* `password` : Database password to use for built-in database authentication and login.\n",
"\n",
"To connect to your Cloud SQL instance from this notebook, you will need to enable public IP on your instance. Alternatively, you can follow [these instructions](https://cloud.google.com/sql/docs/postgres/connect-to-instance-from-outside-vpc) to connect to an Cloud SQL for PostgreSQL instance with Private IP from outside your VPC. Learn more about [specifying IP types](https://github.com/GoogleCloudPlatform/cloud-sql-python-connector?tab=readme-ov-file#specifying-ip-address-type).\n"
]
},
{
Expand All @@ -256,9 +258,10 @@
"outputs": [],
"source": [
"from langchain_google_cloud_sql_pg import PostgresEngine\n",
"from google.cloud.sql.connector import IPTypes\n",
"\n",
"engine = PostgresEngine.from_instance(\n",
" project_id=PROJECT_ID, region=REGION, instance=INSTANCE, database=DATABASE\n",
" project_id=PROJECT_ID, region=REGION, instance=INSTANCE, database=DATABASE, ip_type=IPTypes.PUBLIC\n",
")"
]
},
Expand Down Expand Up @@ -578,4 +581,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
9 changes: 7 additions & 2 deletions docs/document_loader.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"outputs": [],
"source": [
"%pip install --upgrade --quiet langchain_google_cloud_sql_pg"
"%pip install --upgrade --quiet langchain_google_cloud_sql_pg cloud-sql-python-connector[pg8000]"
]
},
{
Expand Down Expand Up @@ -203,7 +203,10 @@
"Optionally, [built-in database authentication](https://cloud.google.com/sql/docs/postgres/users) using a username and password to access the Cloud SQL database can also be used. Just provide the optional `user` and `password` arguments to `PostgresEngine.from_instance()`:\n",
"\n",
"* `user` : Database user to use for built-in database authentication and login\n",
"* `password` : Database password to use for built-in database authentication and login.\n"
"* `password` : Database password to use for built-in database authentication and login.\n",
"\n",
"\n",
"To connect to your Cloud SQL instance from this notebook, you will need to enable public IP on your instance. Alternatively, you can follow [these instructions](https://cloud.google.com/sql/docs/postgres/connect-to-instance-from-outside-vpc) to connect to an Cloud SQL for PostgreSQL instance with Private IP from outside your VPC. Learn more about [specifying IP types](https://github.com/GoogleCloudPlatform/cloud-sql-python-connector?tab=readme-ov-file#specifying-ip-address-type)."
]
},
{
Expand All @@ -220,12 +223,14 @@
"outputs": [],
"source": [
"from langchain_google_cloud_sql_pg import PostgresEngine\n",
"from google.cloud.sql.connector import IPTypes\n",
"\n",
"engine = await PostgresEngine.afrom_instance(\n",
" project_id=PROJECT_ID,\n",
" region=REGION,\n",
" instance=INSTANCE,\n",
" database=DATABASE,\n",
" ip_type=IPTypes.PUBLIC,\n",
")"
]
},
Expand Down
9 changes: 6 additions & 3 deletions docs/vector_store.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"outputs": [],
"source": [
"%pip install --upgrade --quiet langchain-google-cloud-sql-pg langchain-google-vertexai"
"%pip install --upgrade --quiet langchain-google-cloud-sql-pg langchain-google-vertexai cloud-sql-python-connector[pg8000]"
]
},
{
Expand Down Expand Up @@ -209,7 +209,9 @@
"Optionally, [built-in database authentication](https://cloud.google.com/sql/docs/postgres/built-in-authentication) using a username and password to access the Cloud SQL database can also be used. Just provide the optional `user` and `password` arguments to `PostgresEngine.from_instance()`:\n",
"\n",
"* `user` : Database user to use for built-in database authentication and login\n",
"* `password` : Database password to use for built-in database authentication and login.\n"
"* `password` : Database password to use for built-in database authentication and login.\n",
"\n",
"To connect to your Cloud SQL instance from this notebook, you will need to enable public IP on your instance. Alternatively, you can follow [these instructions](https://cloud.google.com/sql/docs/postgres/connect-to-instance-from-outside-vpc) to connect to an Cloud SQL for PostgreSQL instance with Private IP from outside your VPC. Learn more about [specifying IP types](https://github.com/GoogleCloudPlatform/cloud-sql-python-connector?tab=readme-ov-file#specifying-ip-address-type).\n"
]
},
{
Expand All @@ -226,9 +228,10 @@
"outputs": [],
"source": [
"from langchain_google_cloud_sql_pg import PostgresEngine\n",
"from google.cloud.sql.connector import IPTypes\n",
"\n",
"engine = await PostgresEngine.afrom_instance(\n",
" project_id=PROJECT_ID, region=REGION, instance=INSTANCE, database=DATABASE\n",
" project_id=PROJECT_ID, region=REGION, instance=INSTANCE, database=DATABASE, ip_type=IPTypes.PUBLIC,\n",
")"
]
},
Expand Down
12 changes: 8 additions & 4 deletions samples/langchain_quick_start.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
},
"outputs": [],
"source": [
"%pip install --upgrade --quiet langchain-google-cloud-sql-pg langchain-google-vertexai langchain"
"%pip install --upgrade --quiet langchain-google-cloud-sql-pg langchain-google-vertexai langchain cloud-sql-python-connector[pg8000]"
]
},
{
Expand Down Expand Up @@ -368,18 +368,21 @@
"id": "-CQgPON8dwSK"
},
"source": [
"Next let's connect to our CloudSQL PostgreSQL instance using the PostgresEngine class."
"Next let's connect to our CloudSQL PostgreSQL instance using the PostgresEngine class.\n",
"\n",
"To connect to your Cloud SQL instance from this notebook, you will need to enable public IP on your instance. Alternatively, you can follow [these instructions](https://cloud.google.com/sql/docs/postgres/connect-to-instance-from-outside-vpc) to connect to an Cloud SQL for PostgreSQL instance with Private IP from outside your VPC. Learn more about [specifying IP types](https://github.com/GoogleCloudPlatform/cloud-sql-python-connector?tab=readme-ov-file#specifying-ip-address-type)."
]
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"metadata": {
"id": "zrwTsWHMkQ_v"
},
"outputs": [],
"source": [
"from langchain_google_cloud_sql_pg import PostgresLoader, PostgresEngine, Column\n",
"from google.cloud.sql.connector import IPTypes\n",
"\n",
"pg_engine = PostgresEngine.from_instance(\n",
" project_id=project_id,\n",
Expand All @@ -388,6 +391,7 @@
" database=database_name,\n",
" user=\"postgres\",\n",
" password=password,\n",
" ip_type=IPTypes.PUBLIC\n",
")"
]
},
Expand Down Expand Up @@ -1016,4 +1020,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
Loading