class_docstr: High-level Python wrapper for a llama.cpp model.
docstr: Embed a string.
  
  Args:
      input: The utf-8 encoded string to embed.
  
  Returns:
      An embedding object.
docstr_tok: ["Embed","a","string",".","Args",":","input",":","The","utf-8","encoded","string","to","embed",".","Returns",":","An","embedding","object","."]
code: def create_embedding(
      self, input: Union[str, List[str]], model: Optional[str] = None
  ) -> Embedding:
      """Embed a string.
  
      Args:
          input: The utf-8 encoded string to embed.
  
      Returns:
          An embedding object.
      """
      invalidInputError(
          self.ctx is not None,
          "The attribute `ctx` of `Llama` object is None.",
      )
      model_name: str = model if model is not None else self.model_path
  
      invalidInputError(
          self.params.embedding,
          "Llama model must be created with embedding=True to call this method.",
      )
  
      if self.verbose:
          llama_cpp.llama_reset_timings(self.ctx)
  
      if isinstance(input, str):
          inputs = [input]
      else:
          inputs = input
  
      data: List[EmbeddingData] = []
      total_tokens = 0
      for index, input in enumerate(inputs):
          tokens = self.tokenize(input.encode("utf-8"))
          self.reset()
          self.eval(tokens)
          n_tokens = len(tokens)
          total_tokens += n_tokens
          embedding = llama_cpp.llama_get_embeddings(self.ctx)[
              : llama_cpp.llama_n_embd(self.ctx)
          ]
  
          data.append(
              {
                  "object": "embedding",
                  "embedding": embedding,
                  "index": index,
              }
          )
      if self.verbose:
          llama_cpp.llama_print_timings(self.ctx)
  
      return {
          "object": "list",
          "data": data,
          "model": model_name,
          "usage": {
              "prompt_tokens": total_tokens,
              "total_tokens": total_tokens,
          },
      }
  
imports: import os
  import sys
  import uuid
  import time
  import math
  import multiprocessing
  from typing import List, Optional, Union, Generator, Sequence, Iterator, Deque, Tuple
  from collections import deque, OrderedDict
  from bigdl.llm.utils.common import invalidInputError
  from bigdl.llm.ggml.model.generation import GenerationMixin
  from .None import llama_cpp
  from .llama_types import *
label_desc: Use image node_id 10 for calling the Llama obj's underlying member method code with example usage: obj.create_embedding(input, model) and returns: dict