(output)
| 3 | |
| 4 | |
| 5 | def parse_tool_output(output): |
| 6 | |
| 7 | tool_pattern = r"<action>\{(.*?)\}</action>" |
| 8 | matches = re.findall(tool_pattern, output, re.DOTALL) |
| 9 | parsed_tools = [] |
| 10 | for match in matches: |
| 11 | try: |
| 12 | # tool_data = json.loads("{" + match.strip() + "}") |
| 13 | tool_data = json.loads(match.strip()) |
| 14 | parsed_tools.append(tool_data) |
| 15 | except json.JSONDecodeError as e: |
| 16 | print(f"Error decoding JSON: {e}") |
| 17 | return parsed_tools |
| 18 | |
| 19 | def extract_json(select_response): |
| 20 | select_response = select_response.replace('```json', '').replace('```', '') |
nothing calls this directly
no outgoing calls
no test coverage detected