code: def streaming_format_tests(idx, chunk):
      extracted_chunk = ""
      finished = False
      print(f"chunk: {chunk}")
      if idx == 0:  # ensure role assistant is set
          validate_first_format(chunk=chunk)
          role = chunk["choices"][0]["delta"]["role"]
          assert role == "assistant"
      elif idx == 1:  # second chunk
          validate_second_format(chunk=chunk)
      if idx != 0:  # ensure no role
          if "role" in chunk["choices"][0]["delta"]:
              pass  # openai v1.0.0+ passes role = None
      if chunk["choices"][0][
          "finish_reason"
      ]:  # ensure finish reason is only in last chunk
          validate_last_format(chunk=chunk)
          finished = True
      if (
          "content" in chunk["choices"][0]["delta"]
          and chunk["choices"][0]["delta"]["content"] is not None
      ):
          extracted_chunk = chunk["choices"][0]["delta"]["content"]
      print(f"extracted chunk: {extracted_chunk}")
      return extracted_chunk, finished
  
imports: import sys, os, asyncio
  import traceback
  import time, pytest
  from dotenv import load_dotenv
  import litellm
  from litellm import completion, acompletion, AuthenticationError, BadRequestError, RateLimitError, ModelResponse
label_desc: Use image node_id 5 for calling a global function with example usage: streaming_format_tests(idx, chunk) and returns: extracted_chunk,  finished