You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Beam uses the [AlloyDB Java Connector](https://github.com/GoogleCloudPlatform/alloydb-java-connector) to establish a connection to your database.\n",
109
+
"\n",
110
+
"AlloyDB Java Connector defaults to connecting via private IP, but can be overridden via the [AlloyDBLanguageConnectorConfig](https://beam.apache.org/releases/pydoc/current/apache_beam.ml.rag.ingestion.alloydb.html#apache_beam.ml.rag.ingestion.alloydb.AlloyDBLanguageConnectorConfig) to connect via public IP or PSC\n",
111
+
"\n",
112
+
"## Running on Dataflow\n",
113
+
"To connect from Dataflow workers to an AlloyDB instance using private IP:\n",
114
+
"- [Set up AlloyDB with Private Services Access](https://cloud.google.com/alloydb/docs/about-private-services-access)\n",
115
+
"- [Run on Dataflow](#scrollTo=Quick_Start_Run_on_Dataflow) on the same VPC network as the AlloyDB instance\n",
116
+
"\n",
117
+
"Alternatively, dataflow can also connect to an AlloyDB instance that is set up with [Private Service Connect](https://cloud.google.com/alloydb/docs/about-private-service-connect)\n",
118
+
"\n",
119
+
"## Running on DirectRunner (for Development/Testing)\n",
120
+
"For faster iteration during development, it's often convenient to use the DirectRunner. The connection method depends on your setup:\n",
121
+
"\n",
122
+
"- For simplicity and quick setup (with Public IP): If you are developing on a machine (like a local laptop or a VM) that is not on the same VPC network as your AlloyDB instance, the easiest way to connect is to enable public IP on a sandbox AlloyDB instance.\n",
123
+
"- For a more secure setup (with Private IP): The recommended approach is to use a development VM that is on the same subnetwork as your AlloyDB cluster. In this scenario, you can connect using the instance's private IP, and a public IP is not needed.\n",
124
+
"\n",
106
125
"# Setup and Prerequisites\n",
107
126
"\n",
108
127
"This example requires:\n",
109
-
"1. An AlloyDB instance with pgvector extension and PUBLIC IP enabled\n",
110
-
"2. Apache Beam 2.64.0 or later"
128
+
"1. An AlloyDB instance with pgvector extension\n",
129
+
"2. An AlloyDB instance PUBLIC IP enabled if running on DirectRunner (Local Execution) or PRIVATE IP if running on Dataflow\n",
"# Huggingface sentence-transformers for embedding models\n",
135
156
"!pip install sentence-transformers --quiet"
136
157
]
137
158
},
159
+
{
160
+
"cell_type": "code",
161
+
"source": [
162
+
"!pip show apache-beam"
163
+
],
164
+
"metadata": {
165
+
"id": "2FlMPmA0IUuv"
166
+
},
167
+
"execution_count": null,
168
+
"outputs": []
169
+
},
138
170
{
139
171
"cell_type": "markdown",
140
172
"metadata": {
@@ -165,9 +197,10 @@
165
197
"\n",
166
198
"To connect to AlloyDB, you'll need:\n",
167
199
"1. GCP project ID where the AlloyDB instance is located\n",
168
-
"2. The AlloyDB instance URI\n",
169
-
"3. Database credentials\n",
170
-
"4. The pgvector extension enabled in your database\n",
200
+
"2. The AlloyDB instance URI. This is the fully qualified name of the AlloyDB instance found in the google cloud console under AlloyDB Cluster > Connectivity > Connection URI.\n",
201
+
"3. Database name. This is the name of the postgres database within your AlloyDB instance. The default database name is postgres.\n",
202
+
"4. Database credentials\n",
203
+
"5. The pgvector extension enabled in your database\n",
171
204
"\n",
172
205
"Replace these placeholder values with your actual AlloyDB connection details:"
"We import the following for configuring our embedding ingestion pipeline:\n",
537
-
"- `Chunk`, the structured input for generating and ingesting embeddings\n",
538
-
"- `AlloyDBConnectionConfig` for configuring database connection information\n",
539
-
"- `AlloyDBVectorWriterConfig` for configuring write behavior like schema mapping and conflict resolution\n",
540
-
"- `AlloyDBLanguageConnectorConfig` to connect using the [AlloyDB language connector](https://cloud.google.com/alloydb/docs/connect-language-connectors)"
569
+
"- `apache_beam.ml.rag.types.Chunk`, the structured input for generating and ingesting embeddings\n",
570
+
"- `apache_beam.ml.rag.ingestion.alloydb.AlloyDBVectorWriterConfig` for configuring write behavior like schema mapping and conflict resolution\n",
571
+
"- `apache_beam.ml.rag.ingestion.alloydb.AlloyDBLanguageConnectorConfig` to connect using the [AlloyDB language connector](https://cloud.google.com/alloydb/docs/connect-language-connectors)\n",
572
+
"- `apache_beam.ml.rag.ingestion.base import VectorDatabaseWriteTransform` to perform the write step using AlloyDB configs"
0 commit comments