class_docstr: High-level Python wrapper for a bloom.cpp model.
code: def _eval(
      self,
      prompt: str,
      max_tokens: int,
      match_str: bool,
      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_len = len(self.tokenize(prompt))
      if prompt.endswith("</s>") or max_tokens < 1:
          return {
              "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,
                  "completion_tokens": 0,
                  "total_tokens": prompt_len,
              },
          }
      # use `buf` to store prompt and generated string,
      # assume the average length of words is less than 20 bytes
      buf = bytes((prompt_len + max_tokens) * 20)
      ret = bloom_run(
          ctx=self.ctx,
          seed=self.seed,
          n_threads=self.n_threads,
          n_batch=self.n_batch,
          n_predict=max_tokens,
          match_str=match_str,
          prompt=bytes(prompt, encoding="utf-8"),
          buf=buf,
      )
      s = str(buf, encoding="utf-8").rstrip("\x00")
  
      text = s.split(prompt)[1]
      split_text = text
      if stop != []:
          for stop_word in stop:
              split_text = split_text.split(stop_word)[0]
      if split_text != text:
          finish_reason = "stop"
      else:
          finish_reason = None
      completion_len = len(self.tokenize(split_text))
      return {
          "id": completion_id,
          "object": "text_completion",
          "created": created,
          "model": model_name,
          "choices": [
              {
                  "text": prompt + split_text if echo else split_text,
                  "index": 0,
                  "logprobs": None,
                  "finish_reason": finish_reason,
              }
          ],
          "usage": {
              "prompt_tokens": prompt_len,
              "completion_tokens": completion_len,
              "total_tokens": prompt_len + completion_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 4 for calling the Bloom obj's underlying member method code with example usage: obj._eval(prompt, max_tokens, match_str, stop, echo, model) and returns: dict, dict