-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more information in log to help troubleshooting. #1847
Conversation
Signed-off-by: xluo-aws <[email protected]>
log.info("Fetching tool for type: " + toolType); | ||
|
||
if (toolFactories.get(toolType) == null) { | ||
log.error(toolType + " can't be found, please use ListTool API to check if it's deployed."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need suggestions how we should exit gracefully if the tool suggested by LLM is not available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arjunkumargiri do you have any suggestion here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arjunkumargiri, please take a look at here, it's important one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to logging, agent should respond back to LLM that the suggested tool is not available and to either use a different tool from the available list of tool or to generate response from the available data.
@jngz-es please let me know if you have any concerns.
@@ -149,7 +149,7 @@ public static String extractModelResponseJson(String text) { | |||
if (matcher.find()) { | |||
return matcher.group(1); | |||
} else { | |||
throw new IllegalArgumentException("Model output is invalid"); | |||
throw new IllegalArgumentException("Model output is invalid:" + text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about: throw new IllegalArgumentException("Invalid model output: '" + text + "' does not meet the required criteria.");
@@ -145,7 +145,7 @@ public void run(MLAgent mlAgent, Map<String, String> params, ActionListener<Obje | |||
|
|||
runAgent(mlAgent, params, listener, memory, memory.getConversationId()); | |||
}, e -> { | |||
log.error("Failed to get chat history", e); | |||
log.error("Failed to runAgent " + mlAgent.getName(), e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run agent?
log.info("Fetching tool for type: " + toolType); | ||
|
||
if (toolFactories.get(toolType) == null) { | ||
log.error(toolType + " can't be found, please use ListTool API to check if it's deployed."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arjunkumargiri do you have any suggestion here?
Signed-off-by: xluo-aws <[email protected]> Signed-off-by: Xuesong Luo <[email protected]>
Signed-off-by: Xuesong Luo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use of {}
placeholder pattern is the standard in Java to avoid unnecessary String concatenation.
@@ -145,7 +145,7 @@ public void run(MLAgent mlAgent, Map<String, String> params, ActionListener<Obje | |||
|
|||
runAgent(mlAgent, params, listener, memory, memory.getConversationId()); | |||
}, e -> { | |||
log.error("Failed to get chat history", e); | |||
log.error("Failed to run agent " + mlAgent.getName(), e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proper use of log facility needs to use placeholders pattern instead of concatenation or manual interpolation: log.error("Failed to run agent: {} ", mlAgent.getName(), e)
log.info("Fetching tool for type: " + toolSpec.getType()); | ||
Tool tool = toolFactories.get(toolSpec.getType()).create(executeParams); | ||
String toolType = toolSpec.getType(); | ||
log.info("Fetching tool for type: " + toolType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here. Please use pattern instead of manual concatenation of text in log message:
log.info("Fetching tool for type: {}", toolType);
log.info("Fetching tool for type: " + toolType); | ||
|
||
if (toolFactories.get(toolType) == null) { | ||
log.error(toolType + " can't be found, please use ListTool API to check if it's deployed."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here, Please use pattern instead of manual concatenation of text in log message:
log.error("{} can't be found, please use ListTool API to check if it's deployed.", toolType);
@xluo-aws Hi can you rebase with the main branch first and make the CI pass before we merge? |
Waiting for instruction on one of the exceptional case handling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xluo-aws can you please address my comments regarding proper usage of Log4J facility with place holders? I would like to see these comments addressed before this PR gets merged.
For reference in case the earlier comments weren't clear this is what I am talking about:
https://stackoverflow.com/questions/30975026/log4j-implicit-string-formatting
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1847 +/- ##
============================================
- Coverage 82.94% 82.92% -0.03%
+ Complexity 5414 5412 -2
============================================
Files 521 521
Lines 21709 21712 +3
Branches 2213 2214 +1
============================================
- Hits 18007 18005 -2
- Misses 2807 2811 +4
- Partials 895 896 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@xluo-aws are you working on this issue? |
Description
[Describe what this change achieves]
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.