From a7c0a2c879a57b090e41440fcc3a84b4ffb05d68 Mon Sep 17 00:00:00 2001 From: kolaente Date: Mon, 9 Dec 2024 14:10:08 +0100 Subject: [PATCH] fix: save embedding batch table and schema to vectorizer config --- projects/extension/sql/ai--0.6.0.sql | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/projects/extension/sql/ai--0.6.0.sql b/projects/extension/sql/ai--0.6.0.sql index 3c68dccb..db6d817b 100644 --- a/projects/extension/sql/ai--0.6.0.sql +++ b/projects/extension/sql/ai--0.6.0.sql @@ -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; @@ -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 ) );