| 459 | |
| 460 | |
| 461 | def make_tool_message(tools: Callable, args: dict, tool_content: str) -> List[Dict]: |
| 462 | tool_calls = [ |
| 463 | { |
| 464 | "type": "function", |
| 465 | "function": { |
| 466 | "name": tools.__name__, |
| 467 | "arguments": json.dumps(args) |
| 468 | }, |
| 469 | "id": str(uuid.uuid4()).replace('-', '')[:9] |
| 470 | } |
| 471 | ] |
| 472 | return [ |
| 473 | {'role': 'assistant', 'tool_calls': tool_calls}, |
| 474 | {'role': 'tool', 'content': tool_content, 'name': tools.__name__, 'tool_call_id': tool_calls[0]['id']} |
| 475 | ] |
| 476 | def make_message(role: str, content: str): |
| 477 | return [ |
| 478 | {'role': role, 'content': content} |