nbaldwin commited on
Commit
bd514cd
1 Parent(s): 6211d74

changed naming of messaging methods

Browse files
Files changed (2) hide show
  1. ChatHumanFlowModule.py +12 -6
  2. run.py +2 -2
ChatHumanFlowModule.py CHANGED
@@ -82,7 +82,7 @@ class ChatHumanFlowModule(CompositeFlow):
82
 
83
  def generate_reply(self):
84
 
85
- reply = self._package_output_message(
86
  input_message = self.flow_state["input_message"],
87
  response = {
88
  "user_inputs": self.flow_state["user_inputs"],
@@ -91,9 +91,9 @@ class ChatHumanFlowModule(CompositeFlow):
91
  },
92
  )
93
 
94
- self.reply_to_message(
95
- reply = reply,
96
- to = self.flow_state["input_message"]
97
  )
98
 
99
 
@@ -105,7 +105,10 @@ class ChatHumanFlowModule(CompositeFlow):
105
  if self.max_rounds_reached():
106
  self.generate_reply()
107
  else:
108
- self.subflows["User"].send_message_async(input_message,pipe_to=self.flow_config["flow_ref"])
 
 
 
109
  self.flow_state["last_flow_called"] = "User"
110
 
111
  self.flow_state["current_round"] += 1
@@ -126,7 +129,10 @@ class ChatHumanFlowModule(CompositeFlow):
126
  self.generate_reply()
127
 
128
  else:
129
- self.subflows["Assistant"].send_message_async(message,pipe_to=self.flow_config["flow_ref"])
 
 
 
130
  self.flow_state["last_flow_called"] = "Assistant"
131
 
132
  def run(self,input_message: FlowMessage):
 
82
 
83
  def generate_reply(self):
84
 
85
+ reply = self.package_output_message(
86
  input_message = self.flow_state["input_message"],
87
  response = {
88
  "user_inputs": self.flow_state["user_inputs"],
 
91
  },
92
  )
93
 
94
+ self.send_message(
95
+ reply,
96
+ is_reply = True
97
  )
98
 
99
 
 
105
  if self.max_rounds_reached():
106
  self.generate_reply()
107
  else:
108
+ self.subflows["User"].get_reply(
109
+ input_message,
110
+ self.get_instance_id(),
111
+ )
112
  self.flow_state["last_flow_called"] = "User"
113
 
114
  self.flow_state["current_round"] += 1
 
129
  self.generate_reply()
130
 
131
  else:
132
+ self.subflows["Assistant"].get_reply(
133
+ message,
134
+ self.get_instance_id()
135
+ )
136
  self.flow_state["last_flow_called"] = "Assistant"
137
 
138
  def run(self,input_message: FlowMessage):
run.py CHANGED
@@ -88,10 +88,10 @@ if __name__ == "__main__":
88
  )
89
 
90
  #option2: use the proxy_flow
91
- #input_message = proxy_flow._package_input_message(data = data)
92
 
93
  #7. ~~~ Run inference ~~~
94
- future = proxy_flow.send_message_blocking(input_message)
95
 
96
  #uncomment this line if you would like to get the full message back
97
  #reply_message = future.get_message()
 
88
  )
89
 
90
  #option2: use the proxy_flow
91
+ #input_message = proxy_flow.package_input_message(data = data)
92
 
93
  #7. ~~~ Run inference ~~~
94
+ future = proxy_flow.get_reply_future(input_message)
95
 
96
  #uncomment this line if you would like to get the full message back
97
  #reply_message = future.get_message()