File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/agent Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 6464import java .util .regex .Pattern ;
6565import java .util .stream .Collectors ;
6666
67+ import org .apache .commons .text .StringEscapeUtils ;
6768import org .apache .commons .text .StringSubstitutor ;
6869import org .opensearch .ExceptionsHelper ;
6970import org .opensearch .OpenSearchException ;
@@ -236,8 +237,8 @@ public static String addToolsToFunctionCalling(
236237 }
237238 Tool tool = tools .get (toolName );
238239 Map <String , Object > toolParams = new HashMap <>();
239- toolParams .put (NAME , tool .getName ());
240- toolParams .put (DESCRIPTION , tool .getDescription ());
240+ toolParams .put (NAME , StringEscapeUtils . escapeJson ( tool .getName () ));
241+ toolParams .put (DESCRIPTION , StringEscapeUtils . escapeJson ( tool .getDescription () ));
241242 Map <String , ?> attributes = tool .getAttributes ();
242243 if (attributes != null ) {
243244 for (String key : attributes .keySet ()) {
You can’t perform that action at this time.
0 commit comments