@@ -395,25 +395,19 @@ class SummariserNode(BaseNode):
395
395
"Here is the team's task:"
396
396
"\n \n {team_task}\n \n "
397
397
"These are the responses from your team members:"
398
- "\n \n {team_responses}\n "
399
- "Your role is to interpret all the responses and give the final answer to the team's task.\n "
400
398
),
401
399
),
402
- ("human" , "?" ),
400
+ MessagesPlaceholder (variable_name = "messages" ),
401
+ (
402
+ "human" ,
403
+ "Your role is to interpret all the responses and give the final answer to the team's task.\n " ,
404
+ ),
403
405
]
404
406
)
405
407
406
- def get_team_responses (self , messages : list [AnyMessage ]) -> str :
407
- """Create a string containing the team's responses."""
408
- result = ""
409
- for message in messages :
410
- result += f"{ message .name } : { message .content } \n "
411
- return result
412
-
413
408
async def summarise (self , state : TeamState ) -> dict [str , list [AnyMessage ]]:
414
409
team = state ["team" ]
415
410
team_members_name = self .get_team_members_name (team .members )
416
- team_responses = self .get_team_responses (state ["messages" ])
417
411
# TODO: optimise looking for task
418
412
team_task = state ["main_task" ][0 ].content
419
413
@@ -422,7 +416,6 @@ async def summarise(self, state: TeamState) -> dict[str, list[AnyMessage]]:
422
416
team_name = team .name ,
423
417
team_members_name = team_members_name ,
424
418
team_task = team_task ,
425
- team_responses = team_responses ,
426
419
)
427
420
| self .final_answer_model
428
421
| RunnableLambda (self .tag_with_name ).bind (name = f"{ team .name } _answer" ) # type: ignore[arg-type]
0 commit comments