feat(tool-calling): enhance campus assistant tools - #466
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18ce483050
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| int preparationMinutes = Math.min(10, Math.max(5, durationMinutes / 6)); | ||
| int wrapUpMinutes = Math.min(10, Math.max(5, durationMinutes / 8)); | ||
| int mainActivityMinutes = Math.max(1, durationMinutes - preparationMinutes - wrapUpMinutes); |
There was a problem hiding this comment.
Keep schedule phases within requested duration
When the request is for a short session, such as 5 or 10 minutes, the fixed lower bounds allocate preparation=5 and wrapUp=5 while mainActivityMinutes is forced to at least 1, so the returned plan totals 11 minutes even though it still reports the original durationMinutes. Because this tool accepts any positive duration from the assistant, short campus plans become internally inconsistent; rebalance or cap the phases so their sum never exceeds the requested duration.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in dd92548. Short schedules now proportionally rebalance preparation and wrap-up within the available transition time while reserving at least one minute for the main activity, so all phases always sum to the requested duration. Added a 5-minute regression test. The module test suite now passes with 11 tests.
| if (durationMinutes > 120 && !"HIGH".equals(riskLevel)) { | ||
| riskLevel = "MEDIUM"; | ||
| suggestion = "Long activity duration detected. Add breaks and hydration reminders."; |
There was a problem hiding this comment.
Preserve weather-specific advice for long activities
When weatherSummary first triggers MEDIUM risk and the duration is over 120 minutes, this branch overwrites the weather-related suggestion with only the long-duration advice. For example, light rain plus 180 minutes returns no protection or indoor-backup guidance even though the weather caused the risk, so append the duration advice or only replace the LOW-risk suggestion.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in dd92548. Weather-specific guidance is now preserved and the long-duration reminder is appended when weather already caused MEDIUM risk. For LOW-risk weather, the long-duration advice remains the primary suggestion. Added a light rain plus 180-minute regression test. All 11 module tests pass.
Summary
CampusScheduleTools#createCampusScheduleto return a staged campus plan with preparation, main activity, and wrap-up steps.estimateCampusActivityRiskas a second local tool for weather-aware outdoor activity decisions.Why
The merged campus assistant example demonstrates basic multi-tool composition. This follow-up makes it a stronger tutorial by showing multiple local
@Toolmethods, tool parameter validation, weather-aware risk estimation, and local tests that do not require external API keys.Tests
Related