Apply nest_asyncio to enable asyncio event loop nesting in process.py (#1784)
* Apply nest_asyncio to enable asyncio event loop nesting in process.py * Apply nest_asyncio to enable asyncio event loop nesting in load.py --------- Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@logspace.ai>
This commit is contained in:
parent
082c02ff18
commit
02b68daea1
2 changed files with 10 additions and 0 deletions
|
|
@ -3,6 +3,8 @@ from pathlib import Path
|
|||
from typing import List, Optional, Union
|
||||
|
||||
from dotenv import load_dotenv
|
||||
from loguru import logger
|
||||
|
||||
from langflow.graph import Graph
|
||||
from langflow.graph.schema import RunOutputs
|
||||
from langflow.processing.process import process_tweaks, run_graph
|
||||
|
|
@ -101,6 +103,12 @@ def run_flow_from_json(
|
|||
List[RunOutputs]: A list of RunOutputs objects representing the results of running the flow.
|
||||
"""
|
||||
# Set all streaming to false
|
||||
try:
|
||||
import nest_asyncio
|
||||
|
||||
nest_asyncio.apply()
|
||||
except Exception as e:
|
||||
logger.warning(f"Could not apply nest_asyncio: {e}")
|
||||
if tweaks is None:
|
||||
tweaks = {}
|
||||
tweaks["stream"] = False
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
|
||||
from langchain.agents import AgentExecutor
|
||||
from langchain.schema import AgentAction
|
||||
from loguru import logger
|
||||
|
|
@ -13,6 +14,7 @@ from langflow.schema.graph import InputValue, Tweaks
|
|||
from langflow.schema.schema import INPUT_FIELD_NAME
|
||||
from langflow.services.session.service import SessionService
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langflow.api.v1.schemas import InputValueRequest
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue