Skip to content

Tuning

Models per stage

SurrealDB Agent Memory’s pipeline uses separate LLM stages with different latency and quality needs. A Context can store a model for each stage, but not every stage applies its setting yet: see Which settings are applied. Embeddings are fixed deployment-wide.

For provider keys and Gemini defaults, see Configuration.

Runs on conversational turns and document jobs. Extracts entities, attributes, relations, actions, instructions, and uncertainties, with one structured-output call per window of text. Turn extraction is on the critical path for POST /facts with "infer": "full", so latency matters.

Stored on the Context but not applied. Reconciliation matches entities by exact key and makes no model call, so this setting currently has no effect.

Intended for /chat and /reflect answer generation. The setting is stored but not applied yet: /chat and /reflect use the deployment default model, and /chat also accepts a per-call model that overrides it.

Background “dreaming” work on the worker tier: elaboration and consolidation passes. Not on the user-facing critical path.

Converts text (and multimodal content) into dense vectors for HNSW retrieval and the semantic cache. Fixed to gemini-embedding-2 at 3072 dimensions. Not freely assignable per Context - Context config may only pin that same model id, and any other value is rejected with 400. Vector reads filter by embedding_model_id.

Model assignment is per-Context. Set it in SurrealDB Studio under the Context's Settings → configuration, or through the SurrealDB Cloud API admin routes. Each LLM stage takes {provider, model}, and a change is a partial config, so this one sets two stages and leaves the rest alone:

{
  "models": {
    "extraction": { "provider": "google", "model": "gemini-3.5-flash-lite" },
    "elaboration_consolidation": { "provider": "google", "model": "gemini-3.8-flash" }
  }
}

Omit any stage to leave the current assignment (or deployment default) unchanged. With Google as the provider, the default is gemini-3.5-flash-lite for extraction and reconciliation and gemini-3.8-flash for the other stages. Missing provider keys for a selected provider fail at configuration time rather than silently re-routing. A model id that the provider does not list (for example gemini-2.5-pro) is rejected.

StageApplied
extractionYes for document ingest on the worker. Turn extraction on POST /facts uses the deployment default model.
reconciliationNo. Stored only.
synthesisNo. Stored only. /chat and /reflect use the deployment default, or the per-call model on /chat.
elaboration_consolidationYes, for background elaboration and consolidation on the worker. On-demand POST /elaborate and POST /consolidate calls use the deployment default.
embeddingOnly gemini-embedding-2 is accepted.
ProviderRole
Google (Gemini)LLM stages; required for embeddings
OpenAILLM stages
AnthropicLLM stages
CerebrasLLM stages
OpenRouterLLM stages

Use the provider names google, openai, anthropic, cerebras, and openrouter in the provider field. Model ids for Cerebras and OpenRouter are checked by shape rather than against a fixed list.

Provider keys may be set for the deployment or per Context. Keys are write-only: reads return which providers are configured, not the secrets.

StageTypical pathPrefer
extractionSync on write / ingestFast, inexpensive model
reconciliationNot applied-
synthesisNot applied; /chat and /reflect use the deployment default-
elaboration_consolidationWorker backgroundFast enough for batch work
embeddingIngest + queryFixed: gemini-embedding-2 (3072-dim)

A common pattern is a fast, inexpensive model for extraction. To use a stronger model for chat answers today, pass model on the /chat call.

Embeddings are Gemini-only at 3072 dimensions, and gemini-embedding-2 is the only accepted model. There is currently no reindex endpoint, so stored vectors cannot be re-embedded with a different model through the API.

Was this page helpful?