Pipelines models reference

This reference documentation for EDB Postgres AI - AI Accelerator Pipelines models 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 are available.

ColumnTypeDescription
server_namenameName for the model server
server_descriptiontextDescription of the model server
server_optionstext[]Options for the model server

aidb.models

Returns a list of all models in the registry and their configured options, including predefined models and user-created models.

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

Example

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

Functions

aidb.create_model

Creates 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. May include model-specific parameters such as model, url, and TLS options (e.g., tls_config).
credentialsjsonb'{}'::jsonbOptional credentials for the model provider.
replace_credentialsbooleanfalseIf true, replaces the credentials for the model provider. If false, the credentials aren't overwritten.

Example

SELECT aidb.create_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.create_model('my_t5', 't5_local');

or if updating the credentials of a model's provider, which has already been created.

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

TLS Configuration (optional)

To securely connect to HTTPS-based model endpoints, the config object can include a tls_config field:

"tls_config": {
  "insecure_skip_verify": true,  // (optional) disables certificate validation
  "ca_path": "/etc/aidb/myCA.pem"  // (optional) path to a trusted CA certificate
}

aidb.get_model

Returns the configuration for a model in the registry.

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_model('t5');
Output
 name | provider |    options
------+----------+---------------
 t5   | t5_local | {"config={}"}
(1 row)

aidb.delete_model

Deletes a model from the registry.

Parameters

ParameterTypeDefaultDescription
model_nametextName of the model

Example

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

Returns

ColumnTypeDescription
delete_modeljsonbThe name, provider, and options of the deleted model

aidb.get_hcp_models

Gets models running on the hybrid control plane.

Returns

ColumnTypeDescription
nametextThe name of the model instance running on the HCP
urltextThe API URL of the model running on the HCP
modeltextThe name the model running on the HCP

Example

SELECT * FROM  aidb.get_hcp_models();
                 name                  |                                       url                                        |               model                
---------------------------------------+----------------------------------------------------------------------------------+------------------------------------
 llama-3-1-8b-instruct-1xgpu-g6        | http://llama-3-1-8b-instruct-1xgpu-g6-predictor.default.svc.cluster.local        | meta/llama-3.1-8b-instruct
 llama-3-2-nv-embedqa-1b-v2            | http://llama-3-2-nv-embedqa-1b-v2-predictor.default.svc.cluster.local            | nvidia/llama-3.2-nv-embedqa-1b-v2
 meta-nim-llama3-70b-instruct-8xgpu-g5 | http://meta-nim-llama3-70b-instruct-8xgpu-g5-predictor.default.svc.cluster.local | meta/llama3-70b-instruct
(3 rows)

aidb.create_hcp_model

Creates a new model in the system by referencing a running instance in the HCP

Parameters

ParameterTypeDefaultDescription
nametextUser-defined name of the model
hcp_model_nametextName of the model instance running on HCP

aidb.encode_text

Encodes text using a 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 model, generating a vector representation of a given text input.

Parameters

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

aidb.decode_text

Decodes text using a 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 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 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

aidb.rerank_text

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

Parameters

ParameterTypeDefaultDescription
model_nametextName of the model to rerank with
querytextQuery based on which the input will be ranked
inputtext[][]Inputs to be ranked

Returns

ColumnTypeDescription
texttextThe text from "input"
logit_scoredouble precisionScore/rank of this text
idintindex that the text had in the input array

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