Prompt Decorators.utils.string Utils
# string_utils
String utilities for working with prompt decorators.
This module provides utility functions for extracting and replacing decorators in text.
## Functions
### `extract_decorators_from_text`
Extract decorator annotations from text.
Args:
text: Text containing decorator annotations
Returns:
Tuple of (list of decorator dictionaries, clean text)
**Signature:** `extract_decorators_from_text(text: str) -> Tuple[List[Dict[str, Any]], str]`
**Parameters:**
- `text`: `str`
**Returns:** `Tuple`
### `replace_decorators_in_text`
Replace decorator annotations in text.
Args:
text: Text to modify
decorators: List of decorator dictionaries
Returns:
Text with decorator annotations replaced
**Signature:** `replace_decorators_in_text(text: str, decorators: List[Dict[str, Any]]) -> str`
**Parameters:**
- `text`: `str`
- `decorators`: `List`
**Returns:** `str`when to use it
Community prompt sourced from the open-source GitHub repo synaptiai/prompt-decorators (Apache-2.0). A "Prompt Decorators.utils.string Utils" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
roleplaycommunitygeneral
source
synaptiai/prompt-decorators · Apache-2.0