diff --git a/libs/kotaemon/kotaemon/indices/qa/utils.py b/libs/kotaemon/kotaemon/indices/qa/utils.py index c961f4ff..ec426f0f 100644 --- a/libs/kotaemon/kotaemon/indices/qa/utils.py +++ b/libs/kotaemon/kotaemon/indices/qa/utils.py @@ -80,3 +80,18 @@ def find_start_end_phrase( final_match = None return final_match, matched_length + + +def replace_think_tag_with_details(text): + text = text.replace( + "", + '
Thought
', # noqa + ) + text = text.replace("", "
") + return text + + +def strip_think_tag(text): + if "
" in text: + text = text.split("")[1] + return text