| 65 | } |
| 66 | |
| 67 | static common_chat_msg normalize(const common_chat_msg & msg) { |
| 68 | common_chat_msg normalized = msg; |
| 69 | for (auto & tool_call : normalized.tool_calls) { |
| 70 | try { |
| 71 | tool_call.arguments = json::parse(tool_call.arguments).dump(); |
| 72 | } catch (const std::exception &) { |
| 73 | // Do nothing |
| 74 | } |
| 75 | } |
| 76 | return normalized; |
| 77 | } |
| 78 | |
| 79 | |
| 80 | template <> |