code: def chatglm_forward(
      ctx: ChatGLMContext,
      input_ids: List[int],
      do_sample: bool = True,
      top_k: int = 0,
      top_p: float = 0.7,
      temperature: float = 0.95,
  ) -> int:
      ctx.config.do_sample = do_sample
      ctx.config.top_k = top_k
      ctx.config.top_p = top_p
      ctx.config.temperature = temperature
      return ctx.pipeline.forward(input_ids, ctx.config)
  
file_path: BigDL/python/llm/src/bigdl/llm/ggml/model/chatglm/chatglm_cpp.py
imports: from typing import List
  from pathlib import Path
  from bigdl.llm.libs.chatglm_C import Pipeline, GenerationConfig
label_desc: Use image node_id 4 for calling a global function with example usage: chatglm_forward(ctx, input_ids, do_sample, top_k, top_p, temperature) and returns: ctx