protected function sendRequest($method, $url, $body)
    {
        $options = [
            'headers' => [
                'Accept-Encoding' => 'gzip',
                'Content-Type' => 'application/json',
            ],
            'body' => $body,
        ];

        try {
            $response = $this->client->request($method, $url, $options);
            return json_decode($response->getBody(), true);
        } catch (ClientException $e) {
            throw new PredictionIOAPIError($e->getMessage());
        }
    }