code: def get_parameter_json_schema(
      k: str,
      v: Union[Annotated[Type[Any], str], Type[Any]],
      default_values: Dict[str, Any],
  ) -> JsonSchemaValue:
      """Get a JSON schema for a parameter as defined by the OpenAI API
  
      Args:
          k: The name of the parameter
          v: The type of the parameter
          default_values: The default values of the parameters of the function
  
      Returns:
          A Pydanitc model for the parameter
      """
  
      def type2description(
          k: str, v: Union[Annotated[Type[Any], str], Type[Any]]
      ) -> str:
          # handles Annotated
          if hasattr(v, "__metadata__"):
              retval = v.__metadata__[0]
              if isinstance(retval, str):
                  return retval
              else:
                  raise ValueError(
                      f"Invalid description {retval} for parameter {k}, should be a string."
                  )
          else:
              return k
  
      schema = type2schema(v)
      if k in default_values:
          dv = default_values[k]
          schema["default"] = dv
  
      schema["description"] = type2description(k, v)
  
      return schema
  
imports: import functools
  import inspect
  import json
  from logging import getLogger
  from typing import Any, Callable, Dict, ForwardRef, List, Optional, Set, Tuple, Type, TypeVar, Union
  from pydantic import BaseModel, Field
  from typing_extensions import Annotated, Literal, get_args, get_origin
  from ._pydantic import JsonSchemaValue, evaluate_forwardref, model_dump, model_dump_json, type2schema
label_desc: Use image node_id 5 for calling a global function with example usage: get_parameter_json_schema(k, v, default_values) and returns: schema, k, retval