How to pass variables to chatflow from chatbot #5992
Replies: 1 comment 1 reply
-
Ciao @fabiofurlano! 👋 I'm here to help you with any bugs, questions, or contributions while waiting for a human maintainer. To efficiently pass multiple variables to workflows in your chatbot, you can follow these steps:
Here is an example of how you might define and pass variables in a workflow: # Define start variables
start_node:
input_variables:
- sys.query
- sys.user_id
# Define a question classifier node
question_classifier_node:
input_variables:
- sys.query
output_variables:
- classified_question
# Define another node that uses the output of the question classifier
response_generator_node:
input_variables:
- classified_question
output_variables:
- response Additionally, you can use the from core.app.app_config.entities import VariableEntity
from models.workflow import Workflow
class WorkflowVariablesConfigManager:
@classmethod
def convert(cls, workflow: Workflow) -> list[VariableEntity]:
"""
Convert workflow start variables to variables
:param workflow: workflow instance
"""
variables = []
# find start node
user_input_form = workflow.user_input_form()
# variables
for variable in user_input_form:
variables.append(VariableEntity(**variable))
return variables By following these steps, you can efficiently pass multiple variables through your workflow, ensuring smooth and complex processing logic [1][2]. |
Beta Was this translation helpful? Give feedback.
-
Hello everyone,
I am trying to pass the variables to the workflows. It's fine when it's one, but when there are more, it's a bit of a mess. I was wondering if there is a better way.
Beta Was this translation helpful? Give feedback.
All reactions