)
            res = GenerationChunk(text=response.text)
            if run_manager:
                run_manager.on_llm_new_token(res.text)
            # yield text, if any
            yield res
        else:
            pload = {"prompt": prompt, "use_stream_chat": "True", **invocation_params}
            response = requests.post(
                self.eas_service_url, headers=headers, json=pload, stream=True
            )
            for chunk in response.iter_lines(
                chunk_size=8192, decode_unicode=False, delimiter=b"\0"
            ):
                if chunk:
                    data = json.loads(chunk.decode("utf-8"))
                    output = data["response"]
                    # identify stop sequence in generated text, if any
                    stop_seq_found: Optional[str] = None
                    for stop_seq in invocation_params["stop"]:
                        if stop_seq in output:
                            stop_seq_found = stop_seq
                    # identify text to yield
                    text: Optional[str] = None
                    if stop_seq_found:
                        text = output[: output.index(stop_seq_found)]
                    else:
                        text = output
                    # yield text, if any
                    if text:
                        res = GenerationChunk(text=text)
                        yield res
                        if run_manager:
                            run_manager.on_llm_new_token(res.text)
                    # break if stop sequence found
                    if stop_seq_found:
                        break