)
        params = {**self._get_parameters(stop), **kwargs}
        url = f"{self.model_url}/api/v1/stream"
        request = params.copy()
        request["prompt"] = prompt
        websocket_client = websocket.WebSocket()
        websocket_client.connect(url)
        websocket_client.send(json.dumps(request))
        while True:
            result = websocket_client.recv()
            result = json.loads(result)
            if result["event"] == "text_stream":
                chunk = GenerationChunk(
                    text=result["text"],
                    generation_info=None,
                )
                yield chunk
            elif result["event"] == "stream_end":
                websocket_client.close()
                return
            if run_manager:
                await run_manager.on_llm_new_token(token=chunk.text)