mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-03 00:02:36 +00:00
Everything is working
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user