Model Configs
Model configs define how models interact with the extension. They are used as
parameters for add_model.
ollama_config
Configuration for models that run on Ollama.
Returns
- Type:
JSON - Description: Model configuration.
Capabilities
- Instruct
- Encoding
Parameters
host
- Description: Ollama API host.
- Type:
TEXT - Optional:
true - Default:
localhost:11434
model_name
- Description: Name of model.
- Type:
TEXT - Optional:
false
use_https
- Description: Indicates if the RPC request should use SSL.
- Type:
BOOLEAN - Optional:
true - Default:
false
request_batch_size
- Description: Number of requests that can be sent to the server in parallel.
- Type:
INTEGER - Optional:
true - Default:
64
Example
SELECT sqlgen.add_model(
'ollama_model',
sqlgen.ollama_config(
host => 'localhost:11434',
model_name => 'llama3',
use_https => false,
request_batch_size => 16
)
);
openai_completions_config
Configuration for models that use the OpenAI Completions API.
Returns
- Type:
JSON - Description: Model configuration.
Capabilities
- Instruct
Parameters
url
- Description: Completions API host.
- Type:
TEXT - Optional:
true - Default:
https://api.openai.com/v1/chat/completions
model
- Description: Name of model.
- Type:
TEXT - Optional:
true - Default:
gpt-5.1
authorization_type
- Description: Value to set in
Authorizationheader before the api key. - Type:
TEXT - Optional:
true - Default:
Bearer
api_key
- Description: API key to be used in the
Authorizationheader. Header is omitted if this value is not set. - Type:
TEXT - Optional:
true - Default:
NULL
SELECT sqlgen.add_model(
'openai_chat_model',
sqlgen.openai_completions_config(
url => 'https://api.openai.com/v1/chat/completions',
model => 'gpt-4.1',
authorization_type => 'Bearer',
api_key => 'sk-proj-1234567'
)
);
openai_embeddings_config
Configuration for models that use the OpenAI Embeddings API
Returns
- Type:
JSON - Description: Model configuration.
Capabilities
- Encoding
Parameters
url
- Description: Embeddings API host.
- Type:
TEXT - Optional:
true - Default:
https://api.openai.com/v1/embeddings
model
- Description: Name of model.
- Type:
TEXT - Optional:
true - Default:
text-embedding-3-small
authorization_type
- Description: Value to set in
Authorizationheader before the api key. - Type:
TEXT - Optional:
true - Default:
Bearer
api_key
- Description: API key to be used in the
Authorizationheader. Header is omitted if this value is not set. - Type:
TEXT - Optional:
true - Default:
NULL
SELECT sqlgen.add_model(
'openai_embed_model',
sqlgen.openai_embeddings_config(
url => 'https://api.openai.com/v1/embeddings',
model => 'text-embedding-3-small',
authorization_type => 'Bearer',
api_key => 'sk-proj-1234567'
)
);
stub_config
Outputs exactly what is provided in parameters. Used for testing purposes.
Returns
- Type:
JSON - Description: Model configuration.
Capabilities
- Instruct
- Encoding
Parameters
instruct_output
- Description: Output when used as an instruct model.
- Type:
TEXT - Optional:
true - Default:
stub
encode_output
- Description: Output when used as an encoder model.
- Type:
REAL[] - Optional:
true - Default:
ARRAY[0.0, 0.0, 0.0]::REAL[]
Example
SELECT sqlgen.add_model(
'test_stub',
sqlgen.stub_config(
instruct_output => 'Hello world!',
encode_output => ARRAY[1.0, 2.5, 4.1]::REAL[]
);
);