public JsonNode merge(List<JsonNode> chunks) {
        if (chunks == null || chunks.isEmpty()) {
            return null;
        }
        JsonNode res = chunks.get(0);
        Stack<String> path = new Stack<>();
        for (int i = 1; i < chunks.size(); i++) {
            res = merge(res, chunks.get(i), path);
        }
        removeIndices(res, false);
        return res;
    }
The utility merges chunks received from a streaming response. The original reference implementation is provided
<a href="https://github.com/epam/ai-dial-sdk/blob/0.10.1/aidial_sdk/utils/merge_chunks.py">here</a>.
server/src/main/java/com/epam/aidial/core/server/util/MergeChunks.java