Skip to main content

LLMs

SERMAS talks to one OpenAI-compatible endpoint for chat and for embeddings. That can be OpenAI itself, or anything that serves the same API: a gateway such as LiteLLM (which in turn fronts Anthropic, Gemini, Mistral, Groq and others), or a model server such as vLLM or Ollama.

Configure the API​

In config/api/.env:

# empty means api.openai.com
OPENAI_BASEURL=http://my-gateway:4000/v1
OPENAI_API_KEY=...
# the model used when an application names none
OPENAI_MODEL=gpt-4o
# models offered to applications (the kiosk lists them); empty allows all the endpoint serves
OPENAI_CHAT_MODELS=

Embeddings for the knowledge base use the same endpoint unless they are set apart:

OPENAI_EMBEDDINGS_BASEURL=
OPENAI_EMBEDDINGS_API_KEY=
OPENAI_EMBEDDINGS_MODEL=text-embedding-3-small

Each knowledge-base collection records the embeddings model it was built with. After a model change the API re-indexes it from the stored documents.

Reasoning models think before their first word, which delays the avatar's answer. LLM_REASONING_EFFORT=none turns that off for the dialogue where the model allows it.

LLM_TEMPERATURE and LLM_TOP_P (both 0.3) set the sampling. Every option is in API variables.

Models per task​

The API uses the model for several jobs, each with a label:

  • chat: answer the user
  • tools: pick a tool (function call) from the context
  • sentiment: sentiment analysis of the user's text
  • tasks: follow a structured task
  • intent: pick the user's intent from a list of options
  • translation: translate and rephrase

An application can pick a model per label in its settings (settings.yaml, or the settings section of app.yaml), as openai/<model>:

llm:
chat: openai/gpt-4o
tools: openai/gpt-4o-mini
# a label left out uses the platform's OPENAI_MODEL

The model names are whatever the endpoint serves: with a gateway, its model aliases. Leaving llm out entirely is the usual choice: the application then follows the platform's configuration.

The platform can also set a model per label for every application with LLM_SERVICE_CHAT, LLM_SERVICE_TOOLS, LLM_SERVICE_SENTIMENT, LLM_SERVICE_TASKS, LLM_SERVICE_INTENT and LLM_SERVICE_TRANSLATION, in the same openai/<model> form.

Updating the application​

Save the application again from the CLI (sermas-cli app save ./myapp) and reload the kiosk at http://localhost:8080.