class_docstr: High-level Python wrapper for a bloom.cpp model.
code: def stream(
      self,
      prompt: str,
      max_tokens: int,
      stop: Optional[List[str]] = [],
      echo: bool = False,
      model: Optional[str] = None,
  ):
      completion_id: str = f"cmpl-{str(uuid.uuid4())}"
      created: int = int(time.time())
      if model is None:
          model_name = self.model_path
      else:
          model_name = model
      prompt_tokens: List[int] = self.tokenize(prompt.encode("utf-8"))
      prompt_len = len(prompt_tokens)
      if prompt.endswith("</s>") or max_tokens < 1:
          yield {
              "id": completion_id,
              "object": "text_completion",
              "created": created,
              "model": model_name,
              "choices": [
                  {
                      "text": prompt if echo else "",
                      "index": 0,
                      "logprobs": None,
                      "finish_reason": "length",
                  }
              ],
              "usage": {"prompt_tokens": prompt_len},
          }
      else:
          for i in range(max_tokens):
              token = self.forward(prompt_tokens)
              prompt_tokens.append(token)
              text = self.detokenize([token]).decode(
                  "utf-8", errors="ignore"
              )
              if text.endswith("</s>"):
                  print("\n")
                  break
              yield {
                  "id": completion_id,
                  "object": "text_completion",
                  "created": created,
                  "model": model_name,
                  "choices": [
                      {
                          "text": text,
                          "index": 0,
                          "logprobs": None,
                          "finish_reason": None,
                      }
                  ],
                  "usage": {"prompt_tokens": prompt_len},
              }
  
imports: from .bloom_cpp import bloom_load, bloom_free, bloom_run
  from .bloom_cpp import bloom_tokenize, bloom_detokenize, bloom_forward, bloom_eval, bloom_embed
  from bigdl.llm.utils.common import invalidInputError
  from bigdl.llm.ggml.model.generation import GenerationMixin
  from typing import List, Optional, Generator, Sequence, Union
  import time
  import uuid
  import warnings
label_desc: Use image node_id 5 for calling the Bloom obj's underlying member method code with example usage: obj.stream(prompt, max_tokens, stop, echo, model) without return types