Function: resolveModelOption()
resolveModelOption(
opts,task?):ParsedModel
Defined in: packages/agentos/src/api/model.ts:239
Resolves a { providerId, modelId } pair from flexible caller-supplied options.
Resolution priority:
- Explicit
modelstring — if it contains":"it is split directly (backwards-compatibleprovider:modelformat). If it is a plain name andprovideris set, the pair is used as-is. If neither, auto-detection from env vars is attempted. provideronly — default model for the requestedtaskis looked up in PROVIDER_DEFAULTS.- Neither — auto-detect the first provider with a set API key/URL env
var and use its default model for the requested
task.
Parameters
opts
Caller options containing optional provider and/or model.
task?
TaskType = 'text'
Task type used to select the correct default model. Defaults to "text".
Returns
ParsedModel
A ParsedModel with providerId and modelId.
Throws
When no provider can be determined, the provider is unknown, or the provider has no default model for the requested task.