code: def _make_generate_text_request(
      *,
      model: model_types.AnyModelNameOptions = DEFAULT_TEXT_MODEL,
      prompt: str | None = None,
      temperature: float | None = None,
      candidate_count: int | None = None,
      max_output_tokens: int | None = None,
      top_p: int | None = None,
      top_k: int | None = None,
      safety_settings: safety_types.SafetySettingOptions | None = None,
      stop_sequences: str | Iterable[str] | None = None,
  ) -> glm.GenerateTextRequest:
      """
      Creates a `glm.GenerateTextRequest` object based on the provided parameters.
  
      This function generates a `glm.GenerateTextRequest` object with the specified
      parameters. It prepares the input parameters and creates a request that can be
      used for generating text using the chosen model.
  
      Args:
          model: The model to use for text generation.
          prompt: The prompt for text generation. Defaults to None.
          temperature: The temperature for randomness in generation. Defaults to None.
          candidate_count: The number of candidates to consider. Defaults to None.
          max_output_tokens: The maximum number of output tokens. Defaults to None.
          top_p: The nucleus sampling probability threshold. Defaults to None.
          top_k: The top-k sampling parameter. Defaults to None.
          safety_settings: Safety settings for generated text. Defaults to None.
          stop_sequences: Stop sequences to halt text generation. Can be a string
               or iterable of strings. Defaults to None.
  
      Returns:
          `glm.GenerateTextRequest`: A `GenerateTextRequest` object configured with the specified parameters.
      """
      model = model_types.make_model_name(model)
      prompt = _make_text_prompt(prompt=prompt)
      safety_settings = safety_types.normalize_safety_settings(
          safety_settings, harm_category_set="old"
      )
      if isinstance(stop_sequences, str):
          stop_sequences = [stop_sequences]
      if stop_sequences:
          stop_sequences = list(stop_sequences)
  
      return glm.GenerateTextRequest(
          model=model,
          prompt=prompt,
          temperature=temperature,
          candidate_count=candidate_count,
          max_output_tokens=max_output_tokens,
          top_p=top_p,
          top_k=top_k,
          safety_settings=safety_settings,
          stop_sequences=stop_sequences,
      )
  
imports: from __future__ import annotations
  import dataclasses
  from collections.abc import Iterable, Sequence
  import itertools
  from typing import Iterable, overload, TypeVar
  import google.ai.generativelanguage
  from google.generativeai.client import get_default_text_client
  from google.generativeai import string_utils
  from google.generativeai.types import text_types
  from google.generativeai.types import model_types
  from google.generativeai import models
  from google.generativeai.types import safety_types
label_desc: Use image node_id 2 for calling a global function with example usage: _make_generate_text_request() and returns: glm