Class ToolArgumentsParser
java.lang.Object
dev.langchain4j.internal.ToolArgumentsParser
Leniently parses the JSON arguments of a tool execution request.
Shared by the tool executor and the tool guardrail requests so both interpret arguments identically.
- Since:
- 1.25.0
-
Method Summary
Modifier and TypeMethodDescriptionargumentsAsMap(@Nullable String arguments) Converts a JSON arguments string to a map.
-
Method Details
-
argumentsAsMap
Converts a JSON arguments string to a map. Null or blank input, and the JSON literalnull, give an empty map. If the first parse fails, the input is normalized (surrounding quotes removed, escaped quotes unescaped, trailing commas removed) and parsed once more; a second failure propagates.- Parameters:
arguments- json string- Returns:
- the parsed map (mutable, unless it is empty), never
null
-