> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate Preset String • AI Agent SDK

> validate_preset_string: Raise a helpful error when a string does not name a known preset.

# validate\_preset\_string

Function

> This function is defined in the [**parse\_utils**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/parse_utils.md) 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

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def validate_preset_string(param_name: str, value: Any, presets: Iterable[str]) -> None
```

## Parameters

**param\_name** `str` *required*

Name of the parameter (for the error message)

**value** `Any` *required*

Raw parameter value

**presets** `Iterable[str]` *required*

Valid preset names

### Exceptions

> [accordion] ValueError
>
> If value is a string that is not a known preset

## Uses

* `canonical_preset_key`
* `make_preset_error`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/config/parse_utils.py#L209)
>
> `praisonaiagents/config/parse_utils.py` at line 209


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.