PgVectorize enables you to create vector embeddings from any data that you already have stored in PostgreSQL. You can get more background information in the blog post announcing this feature, as well as the "how we built it" post going into the details of the design.
To create vector embeddings, simply attach PgVectorize to any PostgreSQL table to automatically sync that table's data with a set of embeddings stored in Timescale Vector. For example, say you have a blog table defined in the following way:
You can insert some data as follows:
Now, say you want to embed these blogs in Timescale Vector. First, you
need to define an
embed_and_write function that takes a set of blog
posts, creates the embeddings, and writes them into TimescaleVector. For
example, if using LangChain, it could look something like the following.
Then, all you have to do is run the following code in a scheduled job (cron job, Lambda job, etc):
Every time that job runs, it syncs the table with your embeddings. It
syncs all inserts, updates, and deletes to an embeddings table called
Now, you can simply search the embeddings as follows (again, using LangChain in the example):
Found an issue on this page?Report an issue!