fixed the returned news results object not being a json dict
Browse files
crew.py
CHANGED
|
@@ -736,9 +736,8 @@ def run_crewai_news_patient(count: int = 5) -> dict:
|
|
| 736 |
function_calling=True
|
| 737 |
)
|
| 738 |
result = crew.kickoff(inputs={"count": count})
|
| 739 |
-
# result = gather_news_patient.run(count)
|
| 740 |
-
# CrewAI returns ToolOutput → .raw or str — parse if needed
|
| 741 |
|
|
|
|
| 742 |
try:
|
| 743 |
return parse_json_from_markdown(str(result))
|
| 744 |
except Exception as e:
|
|
@@ -752,11 +751,9 @@ def run_crewai_news_doctor(count: int = 5) -> dict:
|
|
| 752 |
function_calling=False
|
| 753 |
)
|
| 754 |
result = crew.kickoff(inputs={"count": count})
|
| 755 |
-
|
| 756 |
-
|
| 757 |
-
|
| 758 |
-
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
except:
|
| 762 |
-
return {"status": "error", "message": "Failed to parse crew output", "raw": str(result)}
|
|
|
|
| 736 |
function_calling=True
|
| 737 |
)
|
| 738 |
result = crew.kickoff(inputs={"count": count})
|
|
|
|
|
|
|
| 739 |
|
| 740 |
+
# CrewAI returns ToolOutput → .raw or str — parse if needed
|
| 741 |
try:
|
| 742 |
return parse_json_from_markdown(str(result))
|
| 743 |
except Exception as e:
|
|
|
|
| 751 |
function_calling=False
|
| 752 |
)
|
| 753 |
result = crew.kickoff(inputs={"count": count})
|
| 754 |
+
|
| 755 |
+
# CrewAI returns ToolOutput → .raw or str — parse if needed
|
| 756 |
+
try:
|
| 757 |
+
return parse_json_from_markdown(str(result))
|
| 758 |
+
except Exception as e:
|
| 759 |
+
return {"status": "error", "message": f"Failed to parse crew output, <{e}>", "raw": result}
|
|
|
|
|
|