| 30 | } |
| 31 | |
| 32 | ai::JsonValue lookup_user(const ai::JsonValue& args, |
| 33 | const ai::ToolExecutionContext&) { |
| 34 | static const std::map<std::string, ai::JsonValue> users = { |
| 35 | {"alice", {{"name", "Alice"}, {"city", "San Francisco"}}}, |
| 36 | {"bob", {{"name", "Bob"}, {"city", "New York"}}}, |
| 37 | }; |
| 38 | auto id = args.value("user_id", std::string{}); |
| 39 | auto it = users.find(id); |
| 40 | if (it != users.end()) |
| 41 | return it->second; |
| 42 | return ai::JsonValue{{"error", "user not found"}}; |
| 43 | } |
| 44 | |
| 45 | ai::JsonValue get_weather(const ai::JsonValue& args, |
| 46 | const ai::ToolExecutionContext&) { |