Skip to main content

validate_preset_string

Function
This function is defined in the parse_utils module.
Raise a helpful error when a string does not name a known preset. Non-string values pass through untouched, so callers can hand this the raw parameter without pre-checking the type. Matching is case-insensitive, ignores surrounding whitespace, and treats -/_ as interchangeable, mirroring the preset lookups performed by the parameter resolvers (e.g. PermissionMode.resolve accepts both accept_edits and accept-edits). This keeps the guard from rejecting spellings the downstream resolver would happily accept.

Signature

Parameters

str
required
Name of the parameter (for the error message)
Any
required
Raw parameter value
Iterable[str]
required
Valid preset names

Exceptions

If value is a string that is not a known preset

Uses

  • canonical_preset_key
  • make_preset_error

Source

View on GitHub

praisonaiagents/config/parse_utils.py at line 209