def stream_chat(
        self, messages: Sequence[ChatMessage], **kwargs: Any
    ) -> ChatResponseGen:
        """
        Request a chat, and the response is returned in a stream.

        :param messages: The chat message list. The last message is the current request,
            and the previous messages are the historical chat information. The number of
            members must be odd, and the role value of the odd-numbered messages must be
            "user", while the role value of the even-numbered messages must be "assistant".
        :return: A ChatResponseGen object, which is a generator of ChatResponse.
        """
        request = build_chat_request(stream=True, messages=messages, **kwargs)

        def gen():
            resp_dict_iter = self._client.post_reply_stream(
                self.endpoint_url, json=request.dict()
            )
            yield from parse_stream_chat_response(resp_dict_iter)

        return gen()

        Request a chat, and the response is returned in a stream.

        :param messages: The chat message list. The last message is the current request,
            and the previous messages are the historical chat information. The number of
            members must be odd, and the role value of the odd-numbered messages must be
            "user", while the role value of the even-numbered messages must be "assistant".
        :return: A ChatResponseGen object, which is a generator of ChatResponse.
        
llama-index-integrations/llms/llama-index-llms-qianfan/llama_index/llms/qianfan/base.py