In the original logic the conversion was giving priority for existence of converters when the parameter value was a JsonElement/JsonDocument/JsonNode, this change checks if the argument is one of those types first and use the proper JSON conversion.
This change also bring some resiliency when the JsonElement provided is a string for primitive types like boolean and C# numeric types.
This change improves function calling experience when using local models that send JSON string argument values ("1" or "true") instead of the expected JSON type (1, true) for calling functions.
i.e: Llama 3.1, Llama 3.2
Added Unit Tests covering the added JsonElement arguments support.
Fixes #9711
Extra (Remove of Warning for ONNX connectors SYSLIB1222)
Motivation and Context
In the original logic the conversion was giving priority for existence of converters when the parameter value was a JsonElement/JsonDocument/JsonNode, this change checks if the argument is one of those types first and use the proper JSON conversion.
This change also bring some resiliency when the
JsonElement
provided is astring
for primitive types likeboolean
and C# numeric types.This change improves function calling experience when using local models that send JSON string argument values ("1" or "true") instead of the expected JSON type (1, true) for calling functions. i.e:
Llama 3.1, Llama 3.2
Added Unit Tests covering the added JsonElement arguments support.