code: def create_dynamic_model_from_function(func: Callable):
      """
      Creates a dynamic Pydantic model from a given function's type hints and adds the function as a 'run' method.
  
      Args:
          func (Callable): A function with type hints from which to create the model.
  
      Returns:
          A dynamic Pydantic model class with the provided function as a 'run' method.
      """
  
      # Get the signature of the function
      sig = inspect.signature(func)
  
      # Parse the docstring
      docstring = parse(func.__doc__)
  
      dynamic_fields = {}
      param_docs = []
      for param in sig.parameters.values():
          # Exclude 'self' parameter
          if param.name == "self":
              continue
  
          # Assert that the parameter has a type annotation
          if param.annotation == inspect.Parameter.empty:
              raise TypeError(
                  f"Parameter '{param.name}' in function '{func.__name__}' lacks a type annotation"
              )
  
          # Find the parameter's description in the docstring
          param_doc = next(
              (d for d in docstring.params if d.arg_name == param.name),
              None,
          )
  
          # Assert that the parameter has a description
          if not param_doc or not param_doc.description:
              raise ValueError(
                  f"Parameter '{param.name}' in function '{func.__name__}' lacks a description in the docstring"
              )
  
          # Add parameter details to the schema
          param_doc = next(
              (d for d in docstring.params if d.arg_name == param.name),
              None,
          )
          param_docs.append((param.name, param_doc))
          if param.default == inspect.Parameter.empty:
              default_value = ...
          else:
              default_value = param.default
          dynamic_fields[param.name] = (
              param.annotation
              if param.annotation != inspect.Parameter.empty
              else str,
              default_value,
          )
      # Creating the dynamic model
      dynamic_model = create_model(f"{func.__name__}", **dynamic_fields)
  
      for param_doc in param_docs:
          dynamic_model.model_fields[
              param_doc[0]
          ].description = param_doc[1].description
  
      dynamic_model.__doc__ = docstring.short_description
  
      def run_method_wrapper(self):
          func_args = {
              name: getattr(self, name)
              for name, _ in dynamic_fields.items()
          }
          return func(**func_args)
  
      # Adding the wrapped function as a 'run' method
      setattr(dynamic_model, "run", run_method_wrapper)
      return dynamic_model
  
imports: import inspect
  import json
  from copy import copy
  from inspect import isclass, getdoc
  from types import NoneType
  from docstring_parser import parse
  from pydantic import BaseModel, create_model, Field
  from typing import Any, Type, List, get_args, get_origin, Tuple, Union, Optional, _GenericAlias
  from enum import Enum
  from typing import get_type_hints, Callable
  import re
  from enum import Enum
label_desc: Use image node_id 23 for calling a global function with example usage: create_dynamic_model_from_function(func) and returns: dynamic_model, func