Skip to content

Commit ec417bc

Browse files
committed
feat(4-3): add pgai example
1 parent 5ac388c commit ec417bc

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

04-what_db_to_choose/3-pgai/compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
postgres_pgvector:
3-
image: pgvector/pgvector:0.7.4-pg16
3+
image: timescale/timescaledb-ha:pg16
44
restart: always
55

66
environment:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE EXTENSION IF NOT EXISTS ai CASCADE;

04-what_db_to_choose/3-pgai/databases/0-enable-pgvector.sql

Lines changed: 0 additions & 1 deletion
This file was deleted.

04-what_db_to_choose/3-pgai/databases/1-mooc.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ CREATE TABLE mooc.courses (
44
id CHAR(4) PRIMARY KEY NOT NULL,
55
name VARCHAR(255) NOT NULL,
66
summary TEXT,
7-
categories jsonb NOT NULL,
8-
embedding vector(768)
7+
categories jsonb NOT NULL
98
);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SELECT ai.create_vectorizer(
2+
mooc.courses::regclass,
3+
destination => <embedding_table_name>,
4+
embedding => ai.embedding_openai(<model_name>, <dimensions>),
5+
chunking => ai.chunking_recursive_character_text_splitter(<column_name>)
6+
);

0 commit comments

Comments
 (0)