import re def wrap_html_code(text): pattern = r"<.*?>" matches = re.findall(pattern, text) if len(matches) > 0: return f"```{text}```" else: return text def get_full_text(response): output = "" for resp in response: if resp.token.special: continue output += resp.token.text return output