(string)
| 32 | |
| 33 | # For prediction parsing, into ReACT format |
| 34 | def react_parser(string): |
| 35 | thought = [string[string.find("Thought: ") + len("Thought: "): string.find("\nAction: ")]] |
| 36 | action = [string[string.find("Action: ") + len("Action: "): string.find("\nAction Input: ")]] |
| 37 | action_input = [string[string.find("Action Input: ") + len("Action Input: "):]] |
| 38 | return thought[0], action[0], action_input[0] |
| 39 | |
| 40 | # For toolllama's predictions |
| 41 | def prepare_logits_processor( |