Repository: litestar-org/litestar

Issue:
Bug: SQLAlchemy 1 Plugin - 'Request' object has no attribute 'dict'
### Description

Changing dependency function from 
```py
async def provide_user(request: Request[User, Token, Any]) -> User:
```
to
```py
async def provide_user(request: Request) -> User:
```
alleviates the error.

### URL to code causing the issue

_No response_

### MCVE

```python
"""Minimal Starlite application."""
from typing import Any

from sqlalchemy import Column, Integer
from sqlalchemy.orm import declarative_base
from starlite import Request, Starlite, get
from starlite.contrib.sqlalchemy_1.plugin import SQLAlchemyPlugin
from starlite.testing import TestClient

Base = declarative_base()


class User(Base):
    __tablename__ = "users"
    id = Column(Integer, primary_key=True)


@get("/")
def hello_world(request: Request[User, Any, Any]) -> dict[str, Any]:
    """Route Handler that outputs hello world."""
    return {"hello": "world"}


app = Starlite(route_handlers=[hello_world], debug=True, plugins=[SQLAlchemyPlugin()])

if __name__ == "__main__":
    with TestClient(app=app) as client:
        client.get("/")
```


### Steps to reproduce

_No response_

### Screenshots

_No response_

### Logs

```bash
Traceback (most recent call last):
  File "/home/oracle/Code/Starlite/starlite-full-stack-example/.venv/lib/python3.11/site-packages/starlite/middleware/exceptions/middleware.py", line 149, in __call__
    await self.app(scope, receive, send)
  File "/home/oracle/Code/Starlite/starlite-full-stack-example/.venv/lib/python3.11/site-packages/starlite/routes/http.py", line 77, in handle
    response = await self._get_response_for_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oracle/Code/Starlite/starlite-full-stack-example/.venv/lib/python3.11/site-packages/starlite/routes/http.py", line 129, in _get_response_for_request
    response = await self._call_handler_function(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oracle/Code/Starlite/starlite-full-stack-example/.venv/lib/python3.11/site-packages/starlite/routes/http.py", line 158, in _call_handler_function
    response_data, cleanup_group = await self._get_response_data(
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oracle/Code/Starlite/starlite-full-stack-example/.venv/lib/python3.11/site-packages/starlite/routes/http.py", line 195, in _get_response_data
    cleanup_group = await parameter_model.resolve_dependencies(request, kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oracle/Code/Starlite/starlite-full-stack-example/.venv/lib/python3.11/site-packages/starlite/_kwargs/kwargs_model.py", line 383, in resolve_dependencies
    await resolve_dependency(next(iter(batch)), connection, kwargs, cleanup_group)
  File "/home/oracle/Code/Starlite/starlite-full-stack-example/.venv/lib/python3.11/site-packages/starlite/_kwargs/dependencies.py", line 63, in resolve_dependency
    signature_model.parse_values_from_connection_kwargs(connection=connection, **kwargs)
  File "/home/oracle/Code/Starlite/starlite-full-stack-example/.venv/lib/python3.11/site-packages/starlite/_signature/models.py", line 268, in parse_values_from_connection_kwargs
    return signature.to_dict()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/oracle/Code/Starlite/starlite-full-stack-example/.venv/lib/python3.11/site-packages/starlite/_signature/models.py", line 290, in to_dict
    return {key: self._resolve_field_value(key) for key in self.__fields__}
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oracle/Code/Starlite/starlite-full-stack-example/.venv/lib/python3.11/site-packages/starlite/_signature/models.py", line 290, in <dictcomp>
    return {key: self._resolve_field_value(key) for key in self.__fields__}
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oracle/Code/Starlite/starlite-full-stack-example/.venv/lib/python3.11/site-packages/starlite/_signature/models.py", line 281, in _resolve_field_value
    return mapping.get_model_instance_for_value(value) if mapping else value
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oracle/Code/Starlite/starlite-full-stack-example/.venv/lib/python3.11/site-packages/starlite/plugins.py", line 241, in get_model_instance_for_value
    return self.plugin.from_data_container_instance(self.model_class, value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oracle/Code/Starlite/starlite-full-stack-example/.venv/lib/python3.11/site-packages/starlite/contrib/sqlalchemy_1/plugin.py", line 423, in from_data_container_instance
    return model_class(**data_container_instance.dict())
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Request' object has no attribute 'dict'
```
```


### Starlite Version

main

### Platform

- [ ] Linux
- [ ] Mac
- [ ] Windows
- [ ] Other (Please specify in the description above)


Discussion:

Resolving patch:
diff --git a/starlite/plugins.py b/starlite/plugins.py
--- a/starlite/plugins.py
+++ b/starlite/plugins.py
@@ -1,3 +1,4 @@
+from collections.abc import Iterable
 from typing import (
     TYPE_CHECKING,
     Any,
@@ -19,6 +20,7 @@
 from typing_extensions import TypeGuard, get_args
 
 from starlite.types.protocols import DataclassProtocol
+from starlite.utils.predicates import is_class_and_subclass
 
 __all__ = (
     "InitPluginProtocol",
@@ -209,8 +211,8 @@ def get_plugin_for_value(
     if plugins:
         if value and isinstance(value, (list, tuple)):
             value = value[0]
-        if get_args(value):
-            value = get_args(value)[0]
+        if is_class_and_subclass(value, Iterable) and (args := get_args(value)):  # type:ignore[type-abstract]
+            value = args[0]
         for plugin in plugins:
             if plugin.is_plugin_supported_type(value):
                 return plugin


Test patch:
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -1,13 +1,17 @@
-from typing import TYPE_CHECKING, Any, Dict, Type
+from typing import TYPE_CHECKING, Any, Dict, List, Type
+from unittest.mock import MagicMock
 
 import pytest
 from pydantic import BaseModel
+from typing_extensions import get_origin
 
 from starlite import MediaType, Starlite, get
+from starlite.connection import Request
 from starlite.plugins import (
     InitPluginProtocol,
     PluginMapping,
     SerializationPluginProtocol,
+    get_plugin_for_value,
 )
 from starlite.testing import create_test_client
 
@@ -89,3 +93,14 @@ def on_app_init(self, app: "Starlite") -> None:
 
         assert tag in client.app.tags
         assert client.app.state.called
+
+
+@pytest.mark.parametrize(("value", "tested_type"), [(List[int], int), (Request[Any, Any, Any], Request)])
+def test_get_plugin_for_value(value: Any, tested_type: Any) -> None:
+    mock_plugin = MagicMock(spec=SerializationPluginProtocol)
+    mock_plugin.is_plugin_supported_type.return_value = False
+    get_plugin_for_value(value, [mock_plugin])
+    assert mock_plugin.is_plugin_supported_type.called_once()
+    call = mock_plugin.is_plugin_supported_type.mock_calls[0]
+    assert len(call.args) == 1
+    assert get_origin(call.args[0]) or call.args[0] is tested_type