| 262 | } |
| 263 | |
| 264 | std::string generate_tool_call_id() { |
| 265 | // Generate a unique ID for tool calls |
| 266 | static std::random_device rd; |
| 267 | static std::mt19937 gen(rd()); |
| 268 | static std::uniform_int_distribution<> dis(0, 15); |
| 269 | |
| 270 | std::string id = "call_"; |
| 271 | for (int i = 0; i < 24; ++i) { |
| 272 | int val = dis(gen); |
| 273 | if (val < 10) { |
| 274 | id += static_cast<char>('0' + val); |
| 275 | } else { |
| 276 | id += static_cast<char>('a' + val - 10); |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | return id; |
| 281 | } |
| 282 | |
| 283 | } // namespace ai |