Open
Description
The regexp based implementation used here to extract a JSON from the LLM response is not fully satisfying.
In particular it fails when you have a first spurious {
or a [
in the LLM response not-related to the actual JSON that anyway can be present later in the same response, but in this case cannot be correctly recognized.
This can be made more robust and also cover this scenario. The same implementation could be used in the output guardrail used for the same purpose when it will be merged.