We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Docs: `template_engine` documented but not actually used
### Summary

In the `Template` response, there's a `template_engine` parameter that is taken as per the docstrings as seen [here](https://github.com/litestar-org/litestar/blob/2385b32b52a786634bcef6059900165123f31705/litestar/response/template.py#L59) (it's also there in the reference documentation). Was this meant to be removed or should support for giving a custom engine class on instantiation of the response be allowed?

<!-- POLAR PLEDGE BADGE START -->
---
> [!NOTE]  
> While we are open for sponsoring on [GitHub Sponsors](https://github.com/sponsors/litestar-org/) and 
> [OpenCollective](https://opencollective.com/litestar), we also utilize [Polar.sh](https://polar.sh/) to engage in pledge-based sponsorship.
>
> Check out all issues funded or available for funding [on our Polar.sh Litestar dashboard](https://polar.sh/litestar-org)
> * If you would like to see an issue prioritized, make a pledge towards it!
> * We receive the pledge once the issue is completed & verified
> * This, along with engagement in the community, helps us know which features are a priority to our users.

<a href="https://polar.sh/litestar-org/litestar/issues/2454">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/litestar-org/litestar/issues/2454/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/litestar-org/litestar/issues/2454/pledge.svg">
</picture>
</a>
<!-- POLAR PLEDGE BADGE END -->


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `litestar/response/template.py`
Content:
```
1 from __future__ import annotations
2 
3 import itertools
4 from mimetypes import guess_type
5 from pathlib import PurePath
6 from typing import TYPE_CHECKING, Any, Iterable
7 
8 from litestar.enums import MediaType
9 from litestar.exceptions import ImproperlyConfiguredException
10 from litestar.response.base import ASGIResponse, Response
11 from litestar.status_codes import HTTP_200_OK
12 from litestar.utils.deprecation import warn_deprecation
13 
14 if TYPE_CHECKING:
15     from litestar.app import Litestar
16     from litestar.background_tasks import BackgroundTask, BackgroundTasks
17     from litestar.connection import Request
18     from litestar.datastructures import Cookie
19     from litestar.types import ResponseCookies, TypeEncodersMap
20 
21 __all__ = ("Template",)
22 
23 
24 class Template(Response[bytes]):
25     """Template-based response, rendering a given template into a bytes string."""
26 
27     __slots__ = (
28         "template_name",
29         "context",
30     )
31 
32     def __init__(
33         self,
34         template_name: str,
35         *,
36         background: BackgroundTask | BackgroundTasks | None = None,
37         context: dict[str, Any] | None = None,
38         cookies: ResponseCookies | None = None,
39         encoding: str = "utf-8",
40         headers: dict[str, Any] | None = None,
41         media_type: MediaType | str | None = None,
42         status_code: int = HTTP_200_OK,
43     ) -> None:
44         """Handle the rendering of a given template into a bytes string.
45 
46         Args:
47             template_name: Path-like name for the template to be rendered, e.g. ``index.html``.
48             background: A :class:`BackgroundTask <.background_tasks.BackgroundTask>` instance or
49                 :class:`BackgroundTasks <.background_tasks.BackgroundTasks>` to execute after the response is finished.
50                 Defaults to ``None``.
51             context: A dictionary of key/value pairs to be passed to the temple engine's render method.
52             cookies: A list of :class:`Cookie <.datastructures.Cookie>` instances to be set under the response
53                 ``Set-Cookie`` header.
54             encoding: Content encoding
55             headers: A string keyed dictionary of response headers. Header keys are insensitive.
56             media_type: A string or member of the :class:`MediaType <.enums.MediaType>` enum. If not set, try to infer
57                 the media type based on the template name. If this fails, fall back to ``text/plain``.
58             status_code: A value for the response HTTP status code.
59             template_engine: The template engine class to use to render the response.
60         """
61         super().__init__(
62             background=background,
63             content=b"",
64             cookies=cookies,
65             encoding=encoding,
66             headers=headers,
67             media_type=media_type,
68             status_code=status_code,
69         )
70         self.context = context or {}
71         self.template_name = template_name
72 
73     def create_template_context(self, request: Request) -> dict[str, Any]:
74         """Create a context object for the template.
75 
76         Args:
77             request: A :class:`Request <.connection.Request>` instance.
78 
79         Returns:
80             A dictionary holding the template context
81         """
82         csrf_token = request.scope.get("_csrf_token", "")
83         return {
84             **self.context,
85             "request": request,
86             "csrf_input": f'<input type="hidden" name="_csrf_token" value="{csrf_token}" />',
87         }
88 
89     def to_asgi_response(
90         self,
91         app: Litestar | None,
92         request: Request,
93         *,
94         background: BackgroundTask | BackgroundTasks | None = None,
95         cookies: Iterable[Cookie] | None = None,
96         encoded_headers: Iterable[tuple[bytes, bytes]] | None = None,
97         headers: dict[str, str] | None = None,
98         is_head_response: bool = False,
99         media_type: MediaType | str | None = None,
100         status_code: int | None = None,
101         type_encoders: TypeEncodersMap | None = None,
102     ) -> ASGIResponse:
103         if app is not None:
104             warn_deprecation(
105                 version="2.1",
106                 deprecated_name="app",
107                 kind="parameter",
108                 removal_in="3.0.0",
109                 alternative="request.app",
110             )
111 
112         if not request.app.template_engine:
113             raise ImproperlyConfiguredException("Template engine is not configured")
114 
115         headers = {**headers, **self.headers} if headers is not None else self.headers
116         cookies = self.cookies if cookies is None else itertools.chain(self.cookies, cookies)
117 
118         media_type = self.media_type or media_type
119         if not media_type:
120             suffixes = PurePath(self.template_name).suffixes
121             for suffix in suffixes:
122                 if _type := guess_type(f"name{suffix}")[0]:
123                     media_type = _type
124                     break
125             else:
126                 media_type = MediaType.TEXT
127 
128         template = request.app.template_engine.get_template(self.template_name)
129         context = self.create_template_context(request)
130         body = template.render(**context).encode(self.encoding)
131 
132         return ASGIResponse(
133             background=self.background or background,
134             body=body,
135             content_length=None,
136             cookies=cookies,
137             encoded_headers=encoded_headers,
138             encoding=self.encoding,
139             headers=headers,
140             is_head_response=is_head_response,
141             media_type=media_type,
142             status_code=self.status_code or status_code,
143         )
144
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/litestar/response/template.py b/litestar/response/template.py
--- a/litestar/response/template.py
+++ b/litestar/response/template.py
@@ -56,7 +56,6 @@
             media_type: A string or member of the :class:`MediaType <.enums.MediaType>` enum. If not set, try to infer
                 the media type based on the template name. If this fails, fall back to ``text/plain``.
             status_code: A value for the response HTTP status code.
-            template_engine: The template engine class to use to render the response.
         """
         super().__init__(
             background=background,

{"golden_diff": "diff --git a/litestar/response/template.py b/litestar/response/template.py\n--- a/litestar/response/template.py\n+++ b/litestar/response/template.py\n@@ -56,7 +56,6 @@\n             media_type: A string or member of the :class:`MediaType <.enums.MediaType>` enum. If not set, try to infer\n                 the media type based on the template name. If this fails, fall back to ``text/plain``.\n             status_code: A value for the response HTTP status code.\n-            template_engine: The template engine class to use to render the response.\n         \"\"\"\n         super().__init__(\n             background=background,\n", "issue": "Docs: `template_engine` documented but not actually used\n### Summary\n\nIn the `Template` response, there's a `template_engine` parameter that is taken as per the docstrings as seen [here](https://github.com/litestar-org/litestar/blob/2385b32b52a786634bcef6059900165123f31705/litestar/response/template.py#L59) (it's also there in the reference documentation). Was this meant to be removed or should support for giving a custom engine class on instantiation of the response be allowed?\n\n<!-- POLAR PLEDGE BADGE START -->\n---\n> [!NOTE]  \n> While we are open for sponsoring on [GitHub Sponsors](https://github.com/sponsors/litestar-org/) and \n> [OpenCollective](https://opencollective.com/litestar), we also utilize [Polar.sh](https://polar.sh/) to engage in pledge-based sponsorship.\n>\n> Check out all issues funded or available for funding [on our Polar.sh Litestar dashboard](https://polar.sh/litestar-org)\n> * If you would like to see an issue prioritized, make a pledge towards it!\n> * We receive the pledge once the issue is completed & verified\n> * This, along with engagement in the community, helps us know which features are a priority to our users.\n\n<a href=\"https://polar.sh/litestar-org/litestar/issues/2454\">\n<picture>\n  <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://polar.sh/api/github/litestar-org/litestar/issues/2454/pledge.svg?darkmode=1\">\n  <img alt=\"Fund with Polar\" src=\"https://polar.sh/api/github/litestar-org/litestar/issues/2454/pledge.svg\">\n</picture>\n</a>\n<!-- POLAR PLEDGE BADGE END -->\n\n", "before_files": [{"content": "from __future__ import annotations\n\nimport itertools\nfrom mimetypes import guess_type\nfrom pathlib import PurePath\nfrom typing import TYPE_CHECKING, Any, Iterable\n\nfrom litestar.enums import MediaType\nfrom litestar.exceptions import ImproperlyConfiguredException\nfrom litestar.response.base import ASGIResponse, Response\nfrom litestar.status_codes import HTTP_200_OK\nfrom litestar.utils.deprecation import warn_deprecation\n\nif TYPE_CHECKING:\n    from litestar.app import Litestar\n    from litestar.background_tasks import BackgroundTask, BackgroundTasks\n    from litestar.connection import Request\n    from litestar.datastructures import Cookie\n    from litestar.types import ResponseCookies, TypeEncodersMap\n\n__all__ = (\"Template\",)\n\n\nclass Template(Response[bytes]):\n    \"\"\"Template-based response, rendering a given template into a bytes string.\"\"\"\n\n    __slots__ = (\n        \"template_name\",\n        \"context\",\n    )\n\n    def __init__(\n        self,\n        template_name: str,\n        *,\n        background: BackgroundTask | BackgroundTasks | None = None,\n        context: dict[str, Any] | None = None,\n        cookies: ResponseCookies | None = None,\n        encoding: str = \"utf-8\",\n        headers: dict[str, Any] | None = None,\n        media_type: MediaType | str | None = None,\n        status_code: int = HTTP_200_OK,\n    ) -> None:\n        \"\"\"Handle the rendering of a given template into a bytes string.\n\n        Args:\n            template_name: Path-like name for the template to be rendered, e.g. ``index.html``.\n            background: A :class:`BackgroundTask <.background_tasks.BackgroundTask>` instance or\n                :class:`BackgroundTasks <.background_tasks.BackgroundTasks>` to execute after the response is finished.\n                Defaults to ``None``.\n            context: A dictionary of key/value pairs to be passed to the temple engine's render method.\n            cookies: A list of :class:`Cookie <.datastructures.Cookie>` instances to be set under the response\n                ``Set-Cookie`` header.\n            encoding: Content encoding\n            headers: A string keyed dictionary of response headers. Header keys are insensitive.\n            media_type: A string or member of the :class:`MediaType <.enums.MediaType>` enum. If not set, try to infer\n                the media type based on the template name. If this fails, fall back to ``text/plain``.\n            status_code: A value for the response HTTP status code.\n            template_engine: The template engine class to use to render the response.\n        \"\"\"\n        super().__init__(\n            background=background,\n            content=b\"\",\n            cookies=cookies,\n            encoding=encoding,\n            headers=headers,\n            media_type=media_type,\n            status_code=status_code,\n        )\n        self.context = context or {}\n        self.template_name = template_name\n\n    def create_template_context(self, request: Request) -> dict[str, Any]:\n        \"\"\"Create a context object for the template.\n\n        Args:\n            request: A :class:`Request <.connection.Request>` instance.\n\n        Returns:\n            A dictionary holding the template context\n        \"\"\"\n        csrf_token = request.scope.get(\"_csrf_token\", \"\")\n        return {\n            **self.context,\n            \"request\": request,\n            \"csrf_input\": f'<input type=\"hidden\" name=\"_csrf_token\" value=\"{csrf_token}\" />',\n        }\n\n    def to_asgi_response(\n        self,\n        app: Litestar | None,\n        request: Request,\n        *,\n        background: BackgroundTask | BackgroundTasks | None = None,\n        cookies: Iterable[Cookie] | None = None,\n        encoded_headers: Iterable[tuple[bytes, bytes]] | None = None,\n        headers: dict[str, str] | None = None,\n        is_head_response: bool = False,\n        media_type: MediaType | str | None = None,\n        status_code: int | None = None,\n        type_encoders: TypeEncodersMap | None = None,\n    ) -> ASGIResponse:\n        if app is not None:\n            warn_deprecation(\n                version=\"2.1\",\n                deprecated_name=\"app\",\n                kind=\"parameter\",\n                removal_in=\"3.0.0\",\n                alternative=\"request.app\",\n            )\n\n        if not request.app.template_engine:\n            raise ImproperlyConfiguredException(\"Template engine is not configured\")\n\n        headers = {**headers, **self.headers} if headers is not None else self.headers\n        cookies = self.cookies if cookies is None else itertools.chain(self.cookies, cookies)\n\n        media_type = self.media_type or media_type\n        if not media_type:\n            suffixes = PurePath(self.template_name).suffixes\n            for suffix in suffixes:\n                if _type := guess_type(f\"name{suffix}\")[0]:\n                    media_type = _type\n                    break\n            else:\n                media_type = MediaType.TEXT\n\n        template = request.app.template_engine.get_template(self.template_name)\n        context = self.create_template_context(request)\n        body = template.render(**context).encode(self.encoding)\n\n        return ASGIResponse(\n            background=self.background or background,\n            body=body,\n            content_length=None,\n            cookies=cookies,\n            encoded_headers=encoded_headers,\n            encoding=self.encoding,\n            headers=headers,\n            is_head_response=is_head_response,\n            media_type=media_type,\n            status_code=self.status_code or status_code,\n        )\n", "path": "litestar/response/template.py"}], "after_files": [{"content": "from __future__ import annotations\n\nimport itertools\nfrom mimetypes import guess_type\nfrom pathlib import PurePath\nfrom typing import TYPE_CHECKING, Any, Iterable\n\nfrom litestar.enums import MediaType\nfrom litestar.exceptions import ImproperlyConfiguredException\nfrom litestar.response.base import ASGIResponse, Response\nfrom litestar.status_codes import HTTP_200_OK\nfrom litestar.utils.deprecation import warn_deprecation\n\nif TYPE_CHECKING:\n    from litestar.app import Litestar\n    from litestar.background_tasks import BackgroundTask, BackgroundTasks\n    from litestar.connection import Request\n    from litestar.datastructures import Cookie\n    from litestar.types import ResponseCookies, TypeEncodersMap\n\n__all__ = (\"Template\",)\n\n\nclass Template(Response[bytes]):\n    \"\"\"Template-based response, rendering a given template into a bytes string.\"\"\"\n\n    __slots__ = (\n        \"template_name\",\n        \"context\",\n    )\n\n    def __init__(\n        self,\n        template_name: str,\n        *,\n        background: BackgroundTask | BackgroundTasks | None = None,\n        context: dict[str, Any] | None = None,\n        cookies: ResponseCookies | None = None,\n        encoding: str = \"utf-8\",\n        headers: dict[str, Any] | None = None,\n        media_type: MediaType | str | None = None,\n        status_code: int = HTTP_200_OK,\n    ) -> None:\n        \"\"\"Handle the rendering of a given template into a bytes string.\n\n        Args:\n            template_name: Path-like name for the template to be rendered, e.g. ``index.html``.\n            background: A :class:`BackgroundTask <.background_tasks.BackgroundTask>` instance or\n                :class:`BackgroundTasks <.background_tasks.BackgroundTasks>` to execute after the response is finished.\n                Defaults to ``None``.\n            context: A dictionary of key/value pairs to be passed to the temple engine's render method.\n            cookies: A list of :class:`Cookie <.datastructures.Cookie>` instances to be set under the response\n                ``Set-Cookie`` header.\n            encoding: Content encoding\n            headers: A string keyed dictionary of response headers. Header keys are insensitive.\n            media_type: A string or member of the :class:`MediaType <.enums.MediaType>` enum. If not set, try to infer\n                the media type based on the template name. If this fails, fall back to ``text/plain``.\n            status_code: A value for the response HTTP status code.\n        \"\"\"\n        super().__init__(\n            background=background,\n            content=b\"\",\n            cookies=cookies,\n            encoding=encoding,\n            headers=headers,\n            media_type=media_type,\n            status_code=status_code,\n        )\n        self.context = context or {}\n        self.template_name = template_name\n\n    def create_template_context(self, request: Request) -> dict[str, Any]:\n        \"\"\"Create a context object for the template.\n\n        Args:\n            request: A :class:`Request <.connection.Request>` instance.\n\n        Returns:\n            A dictionary holding the template context\n        \"\"\"\n        csrf_token = request.scope.get(\"_csrf_token\", \"\")\n        return {\n            **self.context,\n            \"request\": request,\n            \"csrf_input\": f'<input type=\"hidden\" name=\"_csrf_token\" value=\"{csrf_token}\" />',\n        }\n\n    def to_asgi_response(\n        self,\n        app: Litestar | None,\n        request: Request,\n        *,\n        background: BackgroundTask | BackgroundTasks | None = None,\n        cookies: Iterable[Cookie] | None = None,\n        encoded_headers: Iterable[tuple[bytes, bytes]] | None = None,\n        headers: dict[str, str] | None = None,\n        is_head_response: bool = False,\n        media_type: MediaType | str | None = None,\n        status_code: int | None = None,\n        type_encoders: TypeEncodersMap | None = None,\n    ) -> ASGIResponse:\n        if app is not None:\n            warn_deprecation(\n                version=\"2.1\",\n                deprecated_name=\"app\",\n                kind=\"parameter\",\n                removal_in=\"3.0.0\",\n                alternative=\"request.app\",\n            )\n\n        if not request.app.template_engine:\n            raise ImproperlyConfiguredException(\"Template engine is not configured\")\n\n        headers = {**headers, **self.headers} if headers is not None else self.headers\n        cookies = self.cookies if cookies is None else itertools.chain(self.cookies, cookies)\n\n        media_type = self.media_type or media_type\n        if not media_type:\n            suffixes = PurePath(self.template_name).suffixes\n            for suffix in suffixes:\n                if _type := guess_type(f\"name{suffix}\")[0]:\n                    media_type = _type\n                    break\n            else:\n                media_type = MediaType.TEXT\n\n        template = request.app.template_engine.get_template(self.template_name)\n        context = self.create_template_context(request)\n        body = template.render(**context).encode(self.encoding)\n\n        return ASGIResponse(\n            background=self.background or background,\n            body=body,\n            content_length=None,\n            cookies=cookies,\n            encoded_headers=encoded_headers,\n            encoding=self.encoding,\n            headers=headers,\n            is_head_response=is_head_response,\n            media_type=media_type,\n            status_code=self.status_code or status_code,\n        )\n", "path": "litestar/response/template.py"}]}