Spaces:
Paused
Paused
Download app/utils/output_parser.py from Gaykar/Neuroassist: direct link, hf CLI and curl.
- Browser
- Download file 328 Bytes
-
https://huggingface.co/spaces/Gaykar/Neuroassist/resolve/main/app/utils/output_parser.py
- Command line
-
hf download hf://spaces/Gaykar/Neuroassist/app/utils/output_parser.py
-
curl -L -o output_parser.py https://huggingface.co/spaces/Gaykar/Neuroassist/resolve/main/app/utils/output_parser.py
328 Bytes
| import re | |
| from langchain_core.output_parsers import BaseOutputParser | |
| class CleanQueryParser(BaseOutputParser[str]): | |
| def parse(self, text: str) -> str: | |
| # Erase everything inside <think>...</think> blocks safely | |
| cleaned = re.sub(r'<think>.*?</think>', '', text, flags=re.DOTALL) | |
| return cleaned.strip() |