Everything is working

This commit is contained in:
Brandon Hancock
2024-09-12 16:21:12 -04:00
parent 72f0b600b8
commit abfd121f99
5 changed files with 169 additions and 96 deletions

View File

@@ -9,7 +9,7 @@ class ExampleState(BaseModel):
message: str = ""
class StructuredExampleFlow(Flow[ExampleState]):
class StructuredExampleFlow(Flow):
initial_state = ExampleState
@start()
@@ -21,27 +21,22 @@ class StructuredExampleFlow(Flow[ExampleState]):
return "Start result"
@listen(start_method)
async def second_method(self, result):
print(f"Second method, received: {result}")
async def second_method(self):
print(f"State before increment: {self.state}")
self.state.counter += 1
self.state.message += " - updated"
print(f"State after second_method: {self.state}")
return "Second result"
@listen(start_method)
async def third_method(self, result):
print(f"Third method, received: {result}")
print(f"State before increment: {self.state}")
self.state.counter += 1
self.state.message += " - updated"
print(f"State after third_method: {self.state}")
return "Third result"
@listen(start_method and second_method)
async def logger(self):
print("AND METHOD RUNNING")
print("CURRENT STATE FROM OR: ", self.state)
async def main():
flow = StructuredExampleFlow()
await flow.run()
await flow.kickoff()
asyncio.run(main())