nbaldwin commited on
Commit
ab4316b
1 Parent(s): df4c47c

Slight bug fix

Browse files
AutoGPTFlow.py CHANGED
@@ -95,7 +95,7 @@ class AutoGPTFlow(ControllerExecutorFlow):
95
  keys_to_select = ["human_feedback"],
96
  )
97
 
98
- self.next_flow_to_call = {
99
  None: "MemoryRead",
100
  "MemoryRead": "Controller",
101
  "Controller": "Executor",
@@ -111,6 +111,8 @@ class AutoGPTFlow(ControllerExecutorFlow):
111
 
112
  def prepare_memory_read_output(self,data_dict: Dict[str, Any],**kwargs):
113
  """ This method prepares the output of the Memory Flow to be used by the Controller Flow."""
 
 
114
  retrieved_memories = data_dict["retrieved"][0][1:]
115
  return {"memory": "\n".join(retrieved_memories)}
116
 
@@ -228,16 +230,16 @@ class AutoGPTFlow(ControllerExecutorFlow):
228
  # either programmatically or using the _state_update_dict and
229
  # input and ouput interface methods
230
 
231
- last_called = self.flow_state["last_called"]
232
 
233
- if last_called is None:
234
  self.flow_state["input_message"] = input_message
235
  self.flow_state["goal"] = input_message.data["goal"]
236
 
237
- elif last_called == "Executor":
238
  self.flow_state["observation"] = input_message.data
239
 
240
- elif last_called == "Controller":
241
  self._state_update_dict(
242
  {
243
  "command": input_message.data["command"],
@@ -258,12 +260,12 @@ class AutoGPTFlow(ControllerExecutorFlow):
258
  self.flow_state["early_exit_flag"] = True
259
 
260
 
261
- elif last_called == "MemoryRead":
262
  self._state_update_dict(
263
  self.memory_read_ouput_interface(input_message).data
264
  )
265
 
266
- elif last_called == "HumanFeedback":
267
  self._state_update_dict(
268
  self.human_feedback_ouput_interface(input_message).data
269
  )
@@ -289,24 +291,24 @@ class AutoGPTFlow(ControllerExecutorFlow):
289
  """
290
  self.register_data_to_state(input_message)
291
 
292
- flow_to_call = self.get_next_flow_to_call()
293
 
294
  if self.flow_state.get("early_exit_flag",False):
295
  self.generate_reply()
296
 
297
- elif flow_to_call == "MemoryRead":
298
  self.call_memory_read()
299
 
300
- elif flow_to_call == "Controller":
301
  self.call_controller()
302
 
303
- elif flow_to_call == "Executor":
304
  self.call_executor()
305
 
306
- elif flow_to_call == "HumanFeedback":
307
  self.call_human_feedback()
308
 
309
- elif flow_to_call == "MemoryWrite":
310
  self.call_memory_write()
311
  self.flow_state["current_round"] += 1
312
 
@@ -314,6 +316,9 @@ class AutoGPTFlow(ControllerExecutorFlow):
314
  self._on_reach_max_round()
315
  self.generate_reply()
316
 
317
- self.flow_state["last_called"] = self.get_next_flow_to_call()
 
 
 
318
 
319
 
 
95
  keys_to_select = ["human_feedback"],
96
  )
97
 
98
+ self.next_state = {
99
  None: "MemoryRead",
100
  "MemoryRead": "Controller",
101
  "Controller": "Executor",
 
111
 
112
  def prepare_memory_read_output(self,data_dict: Dict[str, Any],**kwargs):
113
  """ This method prepares the output of the Memory Flow to be used by the Controller Flow."""
114
+ if len(data_dict["retrieved"]) == 0:
115
+ return {"memory": ""}
116
  retrieved_memories = data_dict["retrieved"][0][1:]
117
  return {"memory": "\n".join(retrieved_memories)}
118
 
 
230
  # either programmatically or using the _state_update_dict and
231
  # input and ouput interface methods
232
 
233
+ last_state = self.flow_state["last_state"]
234
 
235
+ if last_state is None:
236
  self.flow_state["input_message"] = input_message
237
  self.flow_state["goal"] = input_message.data["goal"]
238
 
239
+ elif last_state == "Executor":
240
  self.flow_state["observation"] = input_message.data
241
 
242
+ elif last_state == "Controller":
243
  self._state_update_dict(
244
  {
245
  "command": input_message.data["command"],
 
260
  self.flow_state["early_exit_flag"] = True
261
 
262
 
263
+ elif last_state == "MemoryRead":
264
  self._state_update_dict(
265
  self.memory_read_ouput_interface(input_message).data
266
  )
267
 
268
+ elif last_state == "HumanFeedback":
269
  self._state_update_dict(
270
  self.human_feedback_ouput_interface(input_message).data
271
  )
 
291
  """
292
  self.register_data_to_state(input_message)
293
 
294
+ current_state = self.get_next_state()
295
 
296
  if self.flow_state.get("early_exit_flag",False):
297
  self.generate_reply()
298
 
299
+ elif current_state == "MemoryRead":
300
  self.call_memory_read()
301
 
302
+ elif current_state == "Controller":
303
  self.call_controller()
304
 
305
+ elif current_state == "Executor":
306
  self.call_executor()
307
 
308
+ elif current_state == "HumanFeedback":
309
  self.call_human_feedback()
310
 
311
+ elif current_state == "MemoryWrite":
312
  self.call_memory_write()
313
  self.flow_state["current_round"] += 1
314
 
 
316
  self._on_reach_max_round()
317
  self.generate_reply()
318
 
319
+ if self.flow_state.get("early_exit_flag",False) or current_state is None:
320
+ self.flow_state["last_state"] = None
321
+ else:
322
+ self.flow_state["last_state"] = current_state
323
 
324
 
demo_db_dir/chroma-collections.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dad8d76313bc0a34d32374510832b6b28abe6539ce1b154732e09fa46614a6ee
3
+ size 559
demo_db_dir/chroma-embeddings.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:16e451ee9045b5e317ebfa8856a8478e1b33a9e04caf34f200efaf137b2f5ce1
3
+ size 174
demo_db_dir/index/id_to_uuid_42e9cea0-eda4-4767-bb24-e634530872e5.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0fd682353cb15f94132bc161e4ef161067cf4e618717ec84bc93806116b2cdb4
3
+ size 64
demo_db_dir/index/index_42e9cea0-eda4-4767-bb24-e634530872e5.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3408b2e390cf695ccb65ae29a20526deb32ebb5872d450895ee7b163c50a0936
3
+ size 6384
demo_db_dir/index/index_metadata_42e9cea0-eda4-4767-bb24-e634530872e5.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88eefc0a355ab39a170b7a60b8143a504f312a038e6db539cdffdc80960f2c75
3
+ size 103
demo_db_dir/index/uuid_to_id_42e9cea0-eda4-4767-bb24-e634530872e5.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d76ef92df773960d674a3aa3e0765d99cfee2751597a6227a59ca4e24f9bb973
3
+ size 52
run.py CHANGED
@@ -83,7 +83,7 @@ if __name__ == "__main__":
83
  "goal": "Answer the following question: What is the profession and date of birth of Michael Jordan?",
84
  }
85
 
86
-
87
  #option1: use the FlowMessage class
88
  input_message = FlowMessage(
89
  data=data,
 
83
  "goal": "Answer the following question: What is the profession and date of birth of Michael Jordan?",
84
  }
85
 
86
+
87
  #option1: use the FlowMessage class
88
  input_message = FlowMessage(
89
  data=data,