Skip to content

Commit

Permalink
fix: save embedding batch table and schema to vectorizer config
Browse files Browse the repository at this point in the history
  • Loading branch information
kolaente committed Dec 9, 2024
1 parent e922de1 commit a7c0a2c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions projects/extension/sql/ai--0.6.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,13 @@ begin
scheduling = pg_catalog.jsonb_insert(scheduling, array['job_id'], to_jsonb(_job_id));
end if;

embedding_batch_schema = coalesce(embedding_batch_schema, 'ai');
embedding_batch_table = coalesce(embedding_batch_table, pg_catalog.concat('_vectorizer_embedding_batches_', _vectorizer_id));
embedding_batch_chunks_table = coalesce(embedding_batch_chunks_table, pg_catalog.concat('_vectorizer_embedding_batch_chunks_', _vectorizer_id));

-- create batch embedding tables
select (embedding operator (pg_catalog.->> 'implementation'))::text into _implementation;
if _implementation = 'openai' then
embedding_batch_schema = coalesce(embedding_batch_schema, 'ai');
embedding_batch_table = coalesce(embedding_batch_table, pg_catalog.concat('_vectorizer_embedding_batches_', _vectorizer_id));
embedding_batch_chunks_table = coalesce(embedding_batch_chunks_table, pg_catalog.concat('_vectorizer_embedding_batch_chunks_', _vectorizer_id));

-- make sure embedding batch table name is available
if pg_catalog.to_regclass(pg_catalog.format('%I.%I', embedding_batch_schema, embedding_batch_table)) is not null then
raise exception 'an object named %.% already exists. specify an alternate embedding_batch_table explicitly', queue_schema, queue_table;
Expand Down Expand Up @@ -360,6 +360,9 @@ begin
, 'formatting', formatting
, 'scheduling', scheduling
, 'processing', processing
, 'embedding_batch_schema', embedding_batch_schema
, 'embedding_batch_table', embedding_batch_table
, 'embedding_batch_chunks_table', embedding_batch_chunks_table
)
);

Expand Down

0 comments on commit a7c0a2c

Please sign in to comment.