completion += chunk.text
        else:
            params = self._convert_prompt_msg_params(messages, **kwargs)
            res = self.client.chat(params)
            msg = convert_dict_to_message(res)
            completion = cast(str, msg.content)
        message = AIMessage(content=completion)
        return ChatResult(generations=[ChatGeneration(message=message)])