def __init__(
        self,
        path: str,
        endpoint: Callable[..., Any],
        *,
        name: Optional[str] = None,
        **kwargs: dict[str, Any],
    ) -> None:
        """Constructor method.

        Args:
            path: The path for the route.
            endpoint: The endpoint to call when the route is requested.
            name: The name of the route.
            **kwargs: Keyword arguments to pass to the parent constructor.
        """
        super().__init__(path, endpoint, name=name, **kwargs)
        # NOTE: OpenAIAPIRoute is initialised again when
        # router is included in app. This is a hack to
        # build the factory endpoint only once.
        if not inspect.iscoroutinefunction(endpoint):
            factory_endpoint = build_factory_websocket_endpoint(path, endpoint)
            super().__init__(path, factory_endpoint, name=name, **kwargs)
        else:
            super().__init__(path, endpoint, name=name, **kwargs)
Constructor method.

        Args:
            path: The path for the route.
            endpoint: The endpoint to call when the route is requested.
            name: The name of the route.
            **kwargs: Keyword arguments to pass to the parent constructor.
        
lanarky/adapters/openai/routing.py