Suggest Similar • AI Agent SDK
suggest_similar: Find the most similar string from candidates using Levenshtein distance.
suggest_similar
Function
</div>
This function is defined in the parse_utils module.
Find the most similar string from candidates using Levenshtein distance.
This function is ONLY called on error paths, never on happy paths.
Signature
def suggest_similar(value: str, candidates: Iterable[str], max_distance: int) -> Optional[str]Parameters
ParamField
strThe invalid value
ParamField
Iterable[str]Valid options to compare against
ParamField
intMaximum edit distance to consider a match
Returns
ResponseField
Optional[str]Most similar candidate if within max_distance, None otherwise
Used By
Source
View on GitHubpraisonaiagents/config/parse_utils.py at line 103