Pipelines reference - Models

This section provides reference documentation for EDB Postgres AI AI Accelerator Pipelines Models. It includes information on the functions and views available in the aidb extension for working with Models.

Tables

aidb.model_providers

The aidb.model_providers table stores information about the model providers that have been created in the database.

ColumnTypeDescription
server_namenameName for the model server.
server_optionstext[]Options for the model server.

Functions

aidb.register_model

Registers a a new model in the system by saving its name, provider and optional configuration.

Parameters

ParameterTypeDefaultDescription
nametextUser defined name for the model.
providertextName of the model provider (as found in aidb.model_providers).
configjsonb'{}'::jsonbOptional configuration for the model provider.
credentialsjsonb'{}'::jsonbOptional credentials for the model provider.

Example

SELECT aidb.register_model(
               name => 'my_t5'::text,
               provider => 't5_local'::character varying,
               config => '{"param1": "value1", "param2": "value2"}'::jsonb,
               credentials => '{"token": "abcd"}'::jsonb
           );

or equivalently, using default values:

SELECT aidb.register_model('my_t5', 't5_local');

aidb.list_registered_models

Returns a list of all registered models and their configured options.

Parameters

None

Returns

ColumnTypeDescription
nametextUser defined name for the model.
providertextName of the model provider.
optionsjsonbOptional configuration for the model provider.

Example

SELECT * FROM aidb.list_registered_models();
Output
 name  |  provider  |    options
-------+------------+---------------
 bert  | bert_local | {"config={}"}
 clip  | clip_local | {"config={}"}
 t5    | t5_local   | {"config={}"}

aidb.get_registered_model

Returns the configuration for a registered model.

Parameters

ParameterTypeDefaultDescription
model_nametextName of the model.

Returns

ColumnTypeDescription
nametextUser defined name for the model.
providertextName of the model provider.
optionsjsonbOptional configuration for the model provider.

Example

SELECT * FROM aidb.get_registered_model('t5');
Output
 name | provider |    options
------+----------+---------------
 t5   | t5_local | {"config={}"}
(1 row)

aidb.delete_registered_model

Deletes a registered model.

Parameters

ParameterTypeDefaultDescription
model_nametextName of the model.

Example

SELECT aidb.delete_registered_model('t5');
Output
     delete_registered_model
---------------------------------
 (t5,t5_local,"{""config={}""}")
(1 row)

Returns

ColumnTypeDescription
delete_registered_modeljsonbThe name, provider and options of the now deleted model.

aidb.encode_text

Encodes text using a registered model, generating a vector representation of a given text input.

Parameters

ParameterTypeDefaultDescription
model_nametextName of the model to encode with.
texttextText to encode.

aidb.encode_text_batch

Encodes a batch of text using a registered model, generating a vector representation of a given text inputs.

Parameters

ParameterTypeDefaultDescription
model_nametextName of the model to encode with.
texttext[]Array of text to encode.

aidb.decode_text

Decodes text using a registered model, generating a vector representation of a given text input.

Parameters

ParameterTypeDefaultDescription
model_nametextName of the model to decode with.
texttextText to decode.

Returns

ColumnTypeDescription
decode_texttextThe decoded text.

aidb.decode_text_batch

Decodes a batch of text using a registered model, generating a representation of a given text input.

Parameters

ParameterTypeDefaultDescription
model_nametextName of the model to decode with.
texttext[]Array of text to decode.

Returns

ColumnTypeDescription
decode_texttextThe decoded text.

aidb.encode_image

Encodes an image using a registered model, generating a vector representation of a given image input.

Parameters

ParameterTypeDefaultDescription
model_nametextName of the model to encode with.
imagebyteaImage to encode.

Returns

ColumnTypeDescription
encode_imagebyteaThe encoded image.

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