Skip to main content
Version: Next

Manage Models

This guide covers the custom model lifecycle via CLI: list available models, create a custom model, configure defaults, and export or import model definitions.

List Models​

lhc models list

Filter by type:

lhc models list --type chat
lhc models list --type embedding
lhc models list --type custom

--type takes Chat, Embedding, Text-to-Speech, Speech-to-Text (case-insensitive) or custom for Custom Models only.

Get a Model​

lhc models get <model-id>

Create a Custom Model​

A custom model combines a provider base model with your datasources. To create one:

lhc models create \
--id my-sales-model \
--name "Sales Assistant" \
--base-model-id azure-chat-azure-openai-chat-dev \
--type chat
FlagRequiredDescription
--idyesUnique model identifier (no spaces)
--nameyesDisplay name shown in the UI
--base-model-idyesID of the provider base model to use
--typenoModel type: chat (default), embedding, text-to-speech, speech-to-text

To find available base model IDs:

lhc models list --output json

Update a Model​

Rename a custom model:

lhc models update <model-id> --name "Sales Assistant v2"

Activate Semantic Extraction for a Model​

After linking datasources to a custom model, trigger semantic extraction to build the model's knowledge base. Pass the model's ID — the same string you used when creating the model:

lhc semantic create model <model-id>

Example:

# Link datasources first
lhc models update my-sales-model --datasource-id 1220 --datasource-id 1223

# Then start extraction
lhc semantic create model my-sales-model

Extraction runs asynchronously and typically takes 10–20 minutes depending on the number and size of linked datasources. The CLI prints a task ID on success:

Semantic extraction started (task: semantic_extraction_0_abc123).

To re-run extraction after updating linked datasources:

lhc semantic update model <model-id>

Delete a Model​

lhc models delete <model-id>

Set Default Model​

Mark a model as the default for its type. This controls which model is pre-selected in new sessions:

lhc models set-default <model-id> --type chat

Valid --type values: chat, embedding, text-to-speech, speech-to-text.

Export a Model​

Export a custom model definition to a portable .lhc.json file. The export includes all embedded datasource references:

# Print to stdout
lhc models export <model-id>

# Write to file
lhc models export <model-id> -f model.lhc.json

Import a Model​

lhc models import model.lhc.json

If a model with the same name or ID already exists, the import is aborted:

Error: HTTP 409: {"detail": "... already exists"}

A model with this name or ID already exists.
Option A: delete it first: lhc models delete <model-id>
Option B: import with a different name: lhc models import <file> --name <new-name>

To import under a different name:

lhc models import model.lhc.json --name "Sales Assistant (Staging)"

Exports never contain credentials, so what happens to embedded datasources depends on your role:

  • Admin: datasources are re-created without credentials; set the connection string afterwards.
  • Builder: database datasources (PostgreSQL, MySQL, MariaDB, …) are not re-created. The model is created without them, every skipped datasource is printed to stderr as warning: …, and the command exits with status 1:
warning: Datasource 'sales_db' could not be re-created (likely missing credentials — exports never include them): 400: …
Error: model sales_model was imported incomplete (1 warning(s)); the model exists but parts of the export were not restored

Complete it by importing the datasource with its connection string and linking it to the model:

lhc datasources import sales_db.lhc.json --connection-string "postgresql://…"
lhc models update sales_model --datasource-id <new-datasource-id>

Migration Example​

Export a model from one instance and import it into another:

# Export from production
lhc --profile prod models export my-sales-model -f sales-model.lhc.json

# Import into staging
lhc --profile staging models import sales-model.lhc.json --name "Sales Model (from prod)"