| 73 | } |
| 74 | |
| 75 | static common_chat_msg normalize(const common_chat_msg & msg) { |
| 76 | common_chat_msg normalized = msg; |
| 77 | for (auto & tool_call : normalized.tool_calls) { |
| 78 | try { |
| 79 | tool_call.arguments = json::parse(tool_call.arguments).dump(); |
| 80 | } catch (const std::exception &) { |
| 81 | } |
| 82 | } |
| 83 | return normalized; |
| 84 | } |
| 85 | |
| 86 | template <> bool equals(const common_chat_msg & expected, const common_chat_msg & actual) { |
| 87 | return normalize(expected) == normalize(actual); |