def response_model(self) -> ResponseModel:
        """Subclass of pydantic ``BaseModel`` specifying HTTP response body schema.

        Notes
        -----
        * Because pydantic does not allow you to define two models with
          the same `model name`, even when they are assigned to different
          python variables and contain different fields:

          >>> image_1 = create_model('Image', ...)  # doctest: +SKIP
          >>> image_2 = create_model('Image', ...)  # doctest: +SKIP
          >>> payload = create_model("Payload_1", **{"payload": image_1})  # doctest: +SKIP
          ERROR: Exception in ASGI application
          Traceback (most recent call last):
            ...
            model_name = model_name_map[model]
          KeyError: <class 'Image'>

          We prepend the name of the endpoint (which must be unique since
          endpoints are stored as a dict mapping names -> definitions within
          the composition) to the model class title. While this means that there
          are a lot of models defined within the OpenAPI scheam, this does not
          impact the field names of each models.

          As an examples: a model is created which will be a subfield of a
          "payload" model. The endpoint is named "classify_endpoint". The
          model we are defined will contains an encoded image string field.
          The model's name in the OpenAPI definition will be listed as
          "Classify_Endpoint_Image", but the field name "image" is untouched.
          Any POST to that endpoint just needs to send a json struct with
          the key "image" -> the raw data... The field names are NOT altered,
          and therefore this workaround should pose very little issue for
          our end users).

        """
        attrib_dict = {}
        outputs = self._endpoint.outputs
        for payload_name, component_and_output_key in outputs.items():
            component, _, key = component_and_output_key.split(".")
            param = self._component[component].outputs[key]
            hints = param.datatype.type_hints["output_args"]
            if isinstance(param.datatype, Repeated):
                attrib_dict[payload_name] = (
                    Tuple[hints, ...],
                    ...,
                )
            else:
                attrib_dict[payload_name] = (hints, ...)

        results_model = create_model(f"{self.name.title()}_Results", **attrib_dict)
        ResponseModel = create_model(
            f"{self.name.title()}_Response",
            __module__=self.__class__.__module__,
            **{"session": (Optional[str], None), "result": (results_model, ...)},
        )
        ResponseModel.update_forward_refs()
        return ResponseModel
Subclass of pydantic ``BaseModel`` specifying HTTP response body schema.

        Notes
        -----
        * Because pydantic does not allow you to define two models with
          the same `model name`, even when they are assigned to different
          python variables and contain different fields:

          >>> image_1 = create_model('Image', ...)  # doctest: +SKIP
          >>> image_2 = create_model('Image', ...)  # doctest: +SKIP
          >>> payload = create_model("Payload_1", **{"payload": image_1})  # doctest: +SKIP
          ERROR: Exception in ASGI application
          Traceback (most recent call last):
            ...
            model_name = model_name_map[model]
          KeyError: <class 'Image'>

          We prepend the name of the endpoint (which must be unique since
          endpoints are stored as a dict mapping names -> definitions within
          the composition) to the model class title. While this means that there
          are a lot of models defined within the OpenAPI scheam, this does not
          impact the field names of each models.

          As an examples: a model is created which will be a subfield of a
          "payload" model. The endpoint is named "classify_endpoint". The
          model we are defined will contains an encoded image string field.
          The model's name in the OpenAPI definition will be listed as
          "Classify_Endpoint_Image", but the field name "image" is untouched.
          Any POST to that endpoint just needs to send a json struct with
          the key "image" -> the raw data... The field names are NOT altered,
          and therefore this workaround should pose very little issue for
          our end users).

        
src/flash/core/serve/interfaces/models.py