Skip to main content

safe_format

Function
This function is defined in the agents_generator module.
Safe string formatting that preserves JSON/dict literals while substituting variables. This function only substitutes placeholders that look like identifiers (e.g., {topic}) while preserving JSON structures like {“level”: 2}.

Signature

Parameters

Any
required
Template string with placeholders **kwargs: Values to substitute

Returns

Any
Formatted string with safe substitutions

Uses

  • match.group
  • re.sub

Source

View on GitHub

praisonai/agents_generator.py at line 1504