class_docstr: High-level Python wrapper for a llama.cpp model.
docstr: Generate a chat completion from a list of messages.
  
  Args:
      messages: A list of messages to generate a response for.
      temperature: The temperature to use for sampling.
      top_p: The top-p value to use for sampling.
      top_k: The top-k value to use for sampling.
      stream: Whether to stream the results.
      stop: A list of strings to stop generation when encountered.
      max_tokens: The maximum number of tokens to generate.
      repeat_penalty: The penalty to apply to repeated tokens.
  
  Returns:
      Generated chat completion or a stream of chat completion chunks.
docstr_tok: ["Generate","a","chat","completion","from","a","list","of","messages",".","Args",":","messages",":","A","list","of","messages","to","generate","a","response","for",".","temperature",":","The","temperature","to","use","for","sampling",".","top_p",":","The","top-p","value","to","use","for","sampling",".","top_k",":","The","top-k","value","to","use","for","sampling",".","stream",":","Whether","to","stream","the","results",".","stop",":","A","list","of","strings","to","stop","generation","when","encountered",".","max_tokens",":","The","maximum","number","of","tokens","to","generate",".","repeat_penalty",":","The","penalty","to","apply","to","repeated","tokens",".","Returns",":","Generated","chat","completion","or","a","stream","of","chat","completion","chunks","."]
code: def create_chat_completion(
      self,
      messages: List[ChatCompletionMessage],
      temperature: float = 0.2,
      top_p: float = 0.95,
      top_k: int = 40,
      stream: bool = False,
      stop: Optional[Union[str, List[str]]] = [],
      max_tokens: int = 256,
      presence_penalty: float = 0.0,
      frequency_penalty: float = 0.0,
      repeat_penalty: float = 1.1,
      tfs_z: float = 1.0,
      mirostat_mode: int = 0,
      mirostat_tau: float = 5.0,
      mirostat_eta: float = 0.1,
      model: Optional[str] = None,
  ) -> Union[ChatCompletion, Iterator[ChatCompletionChunk]]:
      """Generate a chat completion from a list of messages.
  
      Args:
          messages: A list of messages to generate a response for.
          temperature: The temperature to use for sampling.
          top_p: The top-p value to use for sampling.
          top_k: The top-k value to use for sampling.
          stream: Whether to stream the results.
          stop: A list of strings to stop generation when encountered.
          max_tokens: The maximum number of tokens to generate.
          repeat_penalty: The penalty to apply to repeated tokens.
  
      Returns:
          Generated chat completion or a stream of chat completion chunks.
      """
      stop = (
          stop
          if isinstance(stop, list)
          else [stop]
          if isinstance(stop, str)
          else []
      )
      chat_history = "".join(
          f'### {"Human" if message["role"] == "user" else "Assistant"}:{message["content"]}'
          for message in messages
      )
      PROMPT = chat_history + "### Assistant:"
      PROMPT_STOP = ["### Assistant:", "### Human:"]
      completion_or_chunks = self(
          prompt=PROMPT,
          stop=PROMPT_STOP + stop,
          temperature=temperature,
          top_p=top_p,
          top_k=top_k,
          stream=stream,
          max_tokens=max_tokens,
          repeat_penalty=repeat_penalty,
          presence_penalty=presence_penalty,
          frequency_penalty=frequency_penalty,
          tfs_z=tfs_z,
          mirostat_mode=mirostat_mode,
          mirostat_tau=mirostat_tau,
          mirostat_eta=mirostat_eta,
          model=model,
      )
      if stream:
          chunks: Iterator[CompletionChunk] = completion_or_chunks  # type: ignore
          return self._convert_text_completion_chunks_to_chat(chunks)
      else:
          completion: Completion = completion_or_chunks  # type: ignore
          return self._convert_text_completion_to_chat(completion)
  
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 17 for calling the Llama obj's underlying member method code with example usage: obj.create_chat_completion(messages, temperature, top_p, top_k, stream, stop, max_tokens, presence_penalty, frequency_penalty, repeat_penalty, tfs_z, mirostat_mode, mirostat_tau, mirostat_eta, model) and returns: self, self