arguments As Json Or Null
Parses FunctionCallItem.arguments into a JsonObject, or returns null when the model produced malformed JSON or a JSON value that is not an object.
Example:
val call = response.functionCalls.firstOrNull()
val city = call?.argumentsAsJsonOrNull()?.get("city")?.jsonPrimitive?.contentContent copied to clipboard
Return
The parsed arguments, or null if they are not a valid JSON object.
Parameters
json
Json instance used for parsing; the default is sufficient for plain argument objects.