-
Notifications
You must be signed in to change notification settings - Fork 136
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 action input as parameters for tool execution in conversational agent #3200
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -472,6 +472,11 @@ public static Map<String, String> constructToolParams( | |||||||||||||||||||||
if (toolSpecConfigMap != null) { | ||||||||||||||||||||||
toolParams.putAll(toolSpecConfigMap); | ||||||||||||||||||||||
} | ||||||||||||||||||||||
toolParams.put("action_input", actionInput); | ||||||||||||||||||||||
if (isJson(actionInput)) { | ||||||||||||||||||||||
Comment on lines
+475
to
+476
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will it be a problem if we put There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, @pyek-bot looking at ml-commons/common/src/main/java/org/opensearch/ml/common/utils/StringUtils.java Lines 109 to 118 in 5cfdc3c
and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks good, thanks for validating! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jngz-es Can you add a test case for |
||||||||||||||||||||||
Map<String, String> params = getParameterMap(gson.fromJson(actionInput, Map.class)); | ||||||||||||||||||||||
toolParams.putAll(params); | ||||||||||||||||||||||
} | ||||||||||||||||||||||
if (tools.get(action).useOriginalInput()) { | ||||||||||||||||||||||
toolParams.put("input", question); | ||||||||||||||||||||||
lastActionInput.set(question); | ||||||||||||||||||||||
|
@@ -486,10 +491,6 @@ public static Map<String, String> constructToolParams( | |||||||||||||||||||||
} | ||||||||||||||||||||||
} else { | ||||||||||||||||||||||
toolParams.put("input", actionInput); | ||||||||||||||||||||||
if (isJson(actionInput)) { | ||||||||||||||||||||||
Map<String, String> params = getParameterMap(gson.fromJson(actionInput, Map.class)); | ||||||||||||||||||||||
toolParams.putAll(params); | ||||||||||||||||||||||
} | ||||||||||||||||||||||
} | ||||||||||||||||||||||
return toolParams; | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
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.
action_input
looks like coupled with code logic. Change to more readable name ?