code: def make_resData_stream(data, chat=False, time_now=0, start=False):
      resData = {
          "id": "chatcmpl" if (chat) else "cmpl",
          "object": "chat.completion.chunk"
          if (chat)
          else "text_completion.chunk",
          "created": time_now,
          "model": "LLaMA_CPP",
          "choices": [{"finish_reason": None, "index": 0}],
      }
      slot_id = data.get("slot_id")
      if chat:
          if start:
              resData["choices"][0]["delta"] = {"role": "assistant"}
          else:
              resData["choices"][0]["delta"] = {
                  "content": data["content"]
              }
              if data["stop"]:
                  resData["choices"][0]["finish_reason"] = (
                      "stop"
                      if (data["stopped_eos"] or data["stopped_word"])
                      else "length"
                  )
      else:
          resData["choices"][0]["text"] = data["content"]
          if data["stop"]:
              resData["choices"][0]["finish_reason"] = (
                  "stop"
                  if (data["stopped_eos"] or data["stopped_word"])
                  else "length"
              )
  
      return resData
  
file_path: llama.cpp/examples/server/api_like_OAI.py
imports: import argparse
  from flask import Flask, jsonify, request, Response
  import urllib.parse
  import requests
  import time
  import json
label_desc: Use image node_id 5 for calling a global function with example usage: make_resData_stream(data, chat, time_now, start) and returns: resData