code: def test_replicate_inference_server(
      force_langchain_evaluate,
      chat_conversation,
      system_prompt,
      prompt="Who are you?",
      stream_output=False,
      max_new_tokens=128,  # limit cost
      base_model="h2oai/h2ogpt-4096-llama2-7b-chat",
      langchain_mode="Disabled",
      langchain_action=LangChainAction.QUERY.value,
      langchain_agents=[],
      user_path=None,
      langchain_modes=["UserData", "MyData", "LLM", "Disabled"],
      docs_ordering_type="reverse_sort",
  ):
      if force_langchain_evaluate:
          langchain_mode = "MyData"
  
      main_kwargs = dict(
          base_model=base_model,
          chat=True,
          stream_output=stream_output,
          gradio=True,
          num_beams=1,
          block_gradio_exit=False,
          max_new_tokens=max_new_tokens,
          langchain_mode=langchain_mode,
          langchain_action=langchain_action,
          langchain_agents=langchain_agents,
          user_path=user_path,
          langchain_modes=langchain_modes,
          docs_ordering_type=docs_ordering_type,
      )
  
      # server that consumes inference server
      from src.gen import main
  
      # https://replicate.com/lucataco/llama-2-7b-chat
      # model_string = "lucataco/llama-2-7b-chat:6ab580ab4eef2c2b440f2441ec0fc0ace5470edaf2cbea50b8550aec0b3fbd38"
      model_string = "meta/llama-2-7b-chat:8e6975e5ed6174911a6ff3d60540dfd4844201974602551e10e9e87ab143d81e"
      main(
          **main_kwargs, inference_server="replicate:%s" % model_string
      )
  
      if chat_conversation:
          prompt = "What did I ask?"
  
      # client test to server that only consumes inference server
      from src.client_test import run_client_chat
  
      res_dict, client = run_client_chat(
          prompt=prompt,
          prompt_type="llama2",
          stream_output=stream_output,
          max_new_tokens=max_new_tokens,
          langchain_mode=langchain_mode,
          langchain_action=langchain_action,
          langchain_agents=langchain_agents,
          chat_conversation=chat_conversation,
          system_prompt=system_prompt,
      )
      assert res_dict["prompt"] == prompt
      assert res_dict["iinput"] == ""
  
      if chat_conversation and system_prompt:
          # TODO: don't check yet, system_prompt ignored if response from LLM is as if no system prompt
          return
  
      if chat_conversation or system_prompt:
          ret6, _ = test_client_basic_api_lean(
              prompt=prompt,
              prompt_type=None,
              chat_conversation=chat_conversation,
              system_prompt=system_prompt,
          )
          if system_prompt:
              assert (
                  "baby cat" in res_dict["response"]
                  and "meow" in res_dict["response"].lower()
              )
              assert (
                  "baby cat" in ret6["response"]
                  and "meow" in ret6["response"].lower()
              )
          else:
              options_response = [
                  'You asked "Who are you?"',
                  """You asked, \"Who are you?\"""",
                  """You asked: \"Who are you?\"""",
              ]
              assert res_dict["response"] in options_response
              assert ret6["response"] in options_response
  
          return
  
      if system_prompt:
          # don't test rest, too many cases
          return
  
      # will use HOST from above
      ret1, ret2, ret3, ret4, ret5, ret6, ret7 = run_client_many(
          prompt_type=None
      )  # client shouldn't have to specify
      who = "an AI assistant"
      who2 = "just an AI"
      assert who in ret1["response"] or who2 in ret1["response"]
      assert (
          "Once upon a time, in a far-off land," in ret2["response"]
          or "Once upon a time" in ret2["response"]
      )
      assert (
          "Once upon a time, in a far-off land," in ret3["response"]
          or "Once upon a time" in ret3["response"]
      )
      assert (
          who in ret4["response"]
          or "I am a helpful assistant designed" in ret4["response"]
          or who2 in ret4["response"]
      )
      assert (
          who in ret5["response"]
          or "I am a helpful assistant designed" in ret5["response"]
          or who2 in ret5["response"]
      )
      assert (
          who in ret6["response"]
          or "I am a helpful assistant designed" in ret6["response"]
          or who2 in ret6["response"]
      )
      assert (
          who in ret7["response"]
          or "I am a helpful assistant designed" in ret7["response"]
          or who2 in ret7["response"]
      )
      print("DONE", flush=True)
  
imports: import os
  import subprocess
  import time
  from datetime import datetime
  import pytest
  from src.utils import get_ngpus_vis, makedirs
  from tests.utils import wrap_test_forked, get_inf_port, get_inf_server
  from tests.test_langchain_units import have_openai_key, have_replicate_key
  from src.client_test import run_client_many, test_client_basic_api_lean
  from src.enums import PromptType, LangChainAction
label_desc: Use image node_id 10 for calling a global function with example usage: test_replicate_inference_server(force_langchain_evaluate, chat_conversation, system_prompt, prompt, stream_output, max_new_tokens, base_model, langchain_mode, langchain_action, langchain_agents, user_path, langchain_modes, docs_ordering_type) without return types