| def extract_relevant_text(text): | |
| """ | |
| ์ฃผ์ด์ง ํ ์คํธ์์ `[/INST]`๋ก ์์ํ๊ณ ์ข ๋ฃ ํ๊ทธ `</>` ์ด์ ๊น์ง์ ํ ์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์. | |
| """ | |
| pattern = r"\[/INST\](.*?</)" # [/INST]๋ก ์์ํ๊ณ </> ์ด์ ๊น์ง์ ํ ์คํธ๋ฅผ ์ถ์ถ | |
| match = re.search(pattern, text, re.DOTALL) | |
| if match: | |
| # `[/INST]` ์ดํ `</s>` ์ ๊น์ง์ ํ ์คํธ ๋ฐํ | |
| return match.group(1).strip().replace("</", "") | |
| else: | |
| return "๋งค์นญ๋๋ ํ ์คํธ๊ฐ ์์ต๋๋ค." | |