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
pg_vectorize powers the [VectorDB Stack](https://tembo.io/docs/tembo-stacks/vector-db) on [Tembo Cloud](https://cloud.tembo.io/) and is available in all hobby tier instances.
"A pencil is an item that is commonly used for writing and is known to be most effective on paper."
202
206
```
203
207
204
-
## Trigger based updates
208
+
## Updating Embeddings
209
+
210
+
When the source text data is updated, how and when the embeddings are updated is determined by the value set to the `schedule` parameter in `vectorize.table` and `vectorize.init_rag`.
211
+
212
+
The default behavior is `schedule => '* * * * *'`, which means the background worker process checks for changes every minute, and updates the embeddings accordingly. This method requires setting the `updated_at_col` value to point to a colum on the table indicating the time that the input text columns were last changed. `schedule` can be set to any cron-like value.
205
213
206
-
When vectorize job is set up as `realtime` (the default behavior, via `vectorize.table(..., schedule => 'realtime')`), vectorize will create triggers on your table that will keep your embeddings up to date. When the text inputs are updated or if new rows are inserted, the triggers handle creating a background job that updates the embeddings. Since the transformation is executed in a background job and the transformer model is invoked in a separate container, there is minimal impact on the performance of the update or insert statement.
214
+
Alternatively, `schedule => 'realtime` creates triggers on the source table and updates embeddings anytime new records are inserted to the source table or existing records are updated.
215
+
216
+
Statements below would will result in new embeddings being generated either immediately (`schedule => 'realtime'`) or within the cron schedule set in the `schedule` parameter.
207
217
208
218
```sql
209
219
INSERT INTO products (product_id, product_name, description)
@@ -213,7 +223,3 @@ UPDATE products
213
223
SET description ='sling made of fabric, rope, or netting, suspended between two or more points, used for swinging, sleeping, or resting'
214
224
WHERE product_name ='Hammock';
215
225
```
216
-
217
-
## Try it on Tembo Cloud
218
-
219
-
Try it for yourself! Install with a single click on a Vector DB Stack (or any other instance) in [Tembo Cloud](https://cloud.tembo.io/) today.
| update_col | text | Column specifying the last time the record was updated. Required for cron-like schedule. Defaults to `last_updated_at`|
34
34
| transformer | text | The name of the transformer to use for the embeddings. Defaults to 'text-embedding-ada-002'. |
35
35
| search_alg | SimilarityAlg | The name of the search algorithm to use. Defaults to 'pgv_cosine_similarity'. |
36
-
| table_method | TableMethod |The method to use for the table. Defaults to 'append', which adds a column to the existing table. |
37
-
| schedule | text |'realtime' by default for trigger based updates. accepts a cron-like input for a cron based updates. |
36
+
| table_method | TableMethod |`join`to store embeddings in a new table in the vectorize schema. `append` to create columns for embeddings on the source table. Defaults to `join`. |
37
+
| schedule | text |Accepts a cron-like input for a cron based updates. Or `realtime` to set up a trigger. |
When the source text data is updated, how and when the embeddings are updated is determined by the value set to the `schedule` parameter in `vectorize.table` and `vectorize.init_rag`.
4
+
5
+
The default behavior is `schedule => '* * * * *'`, which means the background worker process checks for changes every minute, and updates the embeddings accordingly. This method requires setting the `updated_at_col` value to point to a colum on the table indicating the time that the input text columns were last changed. `schedule` can be set to any cron-like value.
6
+
7
+
Alternatively, `schedule => 'realtime` creates triggers on the source table and updates embeddings anytime new records are inserted to the source table or existing records are updated.
8
+
9
+
Statements below would will result in new embeddings being generated either immediately (`schedule => 'realtime'`) or within the cron schedule set in the `schedule` parameter.
10
+
11
+
```sql
12
+
INSERT INTO products (product_id, product_name, description)
13
+
VALUES (12345, 'pizza', 'dish of Italian origin consisting of a flattened disk of bread');
14
+
15
+
UPDATE products
16
+
SET description ='sling made of fabric, rope, or netting, suspended between two or more points, used for swinging, sleeping, or resting'
0 commit comments