Skip to content

resolveModelIdentity

resolveModelIdentity(config): ResolvedModelIdentity | undefined

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/dist/utils/systemPromptNotes.d.ts:124

GS2-34: resolve the active model identity from the effective config, for injection into the system prompt by appendModelContextNote.

Both halves are read the SAME way the rest of gsloth already surfaces the active model:

  • MODEL: config.modelDisplayName (the string the status line renders — set by the loader from llm.model), falling back to the live model’s own model field.
  • PROVIDER: the configured config.modelProviderType (the raw llm.type the loader stashed — openrouter/deepseek/xai/anthropic/…) when present, otherwise the live LangChain model’s _llmType() (the source the AG-UI /info endpoint reports). GS2-53 — preferring the configured type fixes the OpenAI-compatible shims (openrouter/deepseek/xai all extend ChatOpenAI, so their _llmType() reports openai): a type: openrouter config now injects openrouter:<model>, not openai:<model>. The type is absent for module configs (which hand us an already-built LLM), where we fall back to _llmType() unchanged. The MODEL half is always exact.

Returns { identity: 'provider:model', hasProvider: true } when both resolve, { identity: 'model', hasProvider: false } when only the model resolves, and undefined when the model is unknown (a provider with no model is not a usable identity) — in which case appendModelContextNote injects nothing, leaving the prompt exactly as before. hasProvider is the authoritative provider-present flag (GS2-53), so a bare model whose NAME contains a colon (e.g. gemma3:27b) is correctly reported as hasProvider: false. _llmType() is called defensively (guarded) so a provider whose accessor throws can never break prompt assembly (and is skipped entirely when a configured type is present).

{ llm?: { _llmType?: () => string; model?: string; }; modelDisplayName?: string; modelProviderType?: string; } | null | undefined

ResolvedModelIdentity | undefined