response_payload = self.client.do(**params)
        lc_msg = AIMessage(content=response_payload["result"], additional_kwargs={})
        gen = ChatGeneration(
            message=lc_msg,
            generation_info=dict(finish_reason="stop"),
        )
        token_usage = response_payload.get("usage", {})
        llm_output = {"token_usage": token_usage, "model_name": self.model}
        return ChatResult(generations=[gen], llm_output=llm_output)
    async def _agenerate(
        self,
        messages: List[BaseMessage],
        stop: Optional[List[str]] = None,
        run_manager: Optional[AsyncCallbackManagerForLLMRun] = None,
        **kwargs: Any,
    ) -> ChatResult:
        if self.streaming:
            completion = ""
            token_usage = {}
            async for chunk in self._astream(messages, stop, run_manager, **kwargs):
                completion += chunk.text
            lc_msg = AIMessage(content=completion, additional_kwargs={})
            gen = ChatGeneration(
                message=lc_msg,
                generation_info=dict(finish_reason="stop"),
            )
            return ChatResult(
                generations=[gen],
                llm_output={"token_usage": {}, "model_name": self.model},
            )
        params = self._convert_prompt_msg_params(messages, **kwargs)
        response_payload = await self.client.ado(**params)
        lc_msg = AIMessage(content=response_payload["result"], additional_kwargs={})
        generations = []
        gen = ChatGeneration(
            message=lc_msg,
            generation_info=dict(finish_reason="stop"),
        )
        generations.append(gen)
        token_usage = response_payload.get("usage", {})