slidedeckai.helpers.text_helper#
Utility functions to help with text processing.
Try and fix the syntax error(s) in a JSON string. |
|
Attempt to clean a JSON response string from the LLM by removing |
|
Verify whether user input satisfies the concerned constraints. |
Utility functions to help with text processing.
- slidedeckai.helpers.text_helper.fix_malformed_json(json_str: str) str[source]#
Try and fix the syntax error(s) in a JSON string.
- Parameters:
json_str – The input JSON string.
- Returns:
The fixed JSON string.
- slidedeckai.helpers.text_helper.get_clean_json(json_str: str) str[source]#
Attempt to clean a JSON response string from the LLM by removing
`json at the beginning and trailing `and any text beyond that. CAUTION: May not be always accurate.- Parameters:
json_str – The input string in JSON format.
- Returns:
The “cleaned” JSON string.