🔧 chore(utils.py): reorder imports to group loguru and langflow imports together for better readability

🐛 fix(utils.py): add raw_output parameter to get_result_and_steps function call to fix a bug where raw output was not being returned correctly
 feat(utils.py): add raw_output to the return statement of process_graph function to expose the raw output of get_result_and_steps function
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-11-22 21:14:42 -03:00
commit da5fe77864

View file

@ -1,8 +1,9 @@
from langflow.api.v1.schemas import ChatMessage
from langflow.processing.base import get_result_and_steps
from langflow.interface.utils import try_setting_streaming_options
from loguru import logger
from langflow.api.v1.schemas import ChatMessage
from langflow.interface.utils import try_setting_streaming_options
from langflow.processing.base import get_result_and_steps
async def process_graph(
langchain_object,
@ -24,14 +25,14 @@ async def process_graph(
chat_inputs.message = {}
logger.debug("Generating result and thought")
result, intermediate_steps = await get_result_and_steps(
result, intermediate_steps, raw_output = await get_result_and_steps(
langchain_object,
chat_inputs.message,
client_id=client_id,
session_id=session_id,
)
logger.debug("Generated result and intermediate_steps")
return result, intermediate_steps
return result, intermediate_steps, raw_output
except Exception as e:
# Log stack trace
logger.exception(e)