UntilDot commited on
Commit
fb07cb8
·
verified ·
1 Parent(s): a84172d

Update llm/aggregator.py

Browse files
Files changed (1) hide show
  1. llm/aggregator.py +6 -3
llm/aggregator.py CHANGED
@@ -2,6 +2,9 @@ def aggregate_responses(responses: list) -> str:
2
  if not responses:
3
  return "No responses received."
4
 
5
- combined = "\n".join(responses)
6
- # In real use, you’d prompt another LLM to summarize/combine them
7
- return f"Final synthesized response based on multiple agents:\n{combined}"
 
 
 
 
2
  if not responses:
3
  return "No responses received."
4
 
5
+ # Sanitize: only join valid strings
6
+ safe_responses = [r if isinstance(r, str) else str(r) for r in responses]
7
+
8
+ combined = "\n".join(safe_responses)
9
+
10
+ return f"Final synthesized response based on multiple agents:\n{combined}"