Parse full response to get final text.
(raw: str)
| 180 | |
| 181 | |
| 182 | def extract_response_text(raw: str) -> str: |
| 183 | """Parse full response to get final text.""" |
| 184 | last_text = "" |
| 185 | for line in raw.split("\n"): |
| 186 | for t in _extract_texts_from_line(line): |
| 187 | if len(t) > len(last_text): |
| 188 | last_text = t |
| 189 | return clean_text(last_text) |
| 190 | |
| 191 | |
| 192 | def generate(prompt: str, model_id: int, think_mode: int, file_refs: list = None, extra_fields: dict = None) -> str: |
no test coverage detected