Additional functions and standalone embedding in aidb

Standalone embedding

Use the generate_single_image_embedding function to get embeddings for the given image. Currently, model_provider can only be openai or huggingface. You can check the list of valid embedding models and model providers from the Encoders Supported AIDB section.

SELECT aidb.generate_single_image_embedding(
    'clip-vit-base-patch32', -- embedding model name
    'openai', -- model provider
    'https://s3.us-south.cloud-object-storage.appdomain.cloud', -- S3 endpoint
    'torsten', -- S3 bucket name
    'foto.jpg' -- img object to generate embeddings
);
Output
 generate_single_image_embedding
--------------------------------
     
(1 row)    

Use the generate_text_embedding function to get embeddings for the given image. Currently, the model_provider can only be openai or huggingface.

SELECT aidb.generate_text_embedding(
'text-embedding-3-small', -- embedding model name
'openai', -- model provider
 0, -- dimensions, setting 0 will replace with the default value in encoder's table
'Veggie Burger' -- text to generate embeddings
);
Output
 generate_text_embedding
------------------------

(1 row)    

Supported encoders

You can check the list of valid embedding models and model providers from aidb.encoders table

SELECT provider, count(*) encoder_model_count FROM aidb.encoders group by (provider);
Output
  provider   | encoder_model_count
-------------+---------------------
 huggingface |                  36
 openai      |                   4
(2 rows)

Available functions

You can find the complete list of currently available functions of the aidb extension by selecting from information_schema.routines any routine_name belonging to the aidb routine schema:

SELECT routine_name from information_schema.routines WHERE routine_schema='aidb';
Output
          routine_name
---------------------------------
 init
 create_pg_retriever
 create_s3_retriever
 _embed_table_update
 refresh_retriever
 retrieve
 retrieve_via_s3
 register_prompt_template
 render_prompt
 generate
 ag
 rag
 generate_text_embedding
 generate_single_image_embedding
(14 rows)

Could this page be better? Report a problem or suggest an addition!