Skip to content

Commit 17a3766

Browse files
committed
fix: resolve mypy type error
1 parent 968a2c4 commit 17a3766

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/backend/base/langflow/graph/graph/base.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@
4444
from langflow.utils.async_helpers import run_until_complete
4545

4646
if TYPE_CHECKING:
47-
from collections.abc import Callable, Generator, Iterable, AsyncGenerator
48-
49-
from sqlmodel.ext.asyncio.session import AsyncSession
47+
from collections.abc import Callable, Generator, Iterable
48+
from contextlib import AbstractAsyncContextManager
5049

5150
from langflow.api.v1.schemas import InputValueRequest
5251
from langflow.custom.custom_component.component import Component
@@ -653,7 +652,7 @@ def set_run_id(self, run_id: uuid.UUID | None = None) -> None:
653652

654653
self._run_id = str(run_id)
655654

656-
async def initialize_run(self, session_scope: AsyncGenerator[AsyncSession, None] | None) -> None:
655+
async def initialize_run(self, session_scope: Callable[[], AbstractAsyncContextManager[Any]] | None = None) -> None:
657656
if not self._run_id:
658657
self.set_run_id()
659658

src/backend/base/langflow/services/tracing/service.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
from langflow.services.deps import get_variable_service
1515

1616
if TYPE_CHECKING:
17-
from collections.abc import AsyncGenerator
17+
from collections.abc import Callable
18+
from contextlib import AbstractAsyncContextManager
1819

1920
from langchain.callbacks.base import BaseCallbackHandler
20-
from sqlmodel.ext.asyncio.session import AsyncSession
2121

2222
from langflow.custom.custom_component.component import Component
2323
from langflow.graph.vertex.base import Vertex
@@ -222,7 +222,7 @@ async def get_varaibles_from_db(self, session_scope, user_id, variable_names) ->
222222

223223
async def start_tracers(
224224
self,
225-
session_scope: AsyncGenerator[AsyncSession, None],
225+
session_scope: Callable[[], AbstractAsyncContextManager[Any]],
226226
run_id: UUID,
227227
run_name: str,
228228
user_id: str | None,

0 commit comments

Comments
 (0)