plutoa386 commited on
Commit
27df780
·
1 Parent(s): 6e92835
Files changed (1) hide show
  1. crew.py +12 -26
crew.py CHANGED
@@ -325,29 +325,19 @@ def gather_news_doctor(count: int = 5) -> dict:
325
  Gathers recent dementia news articles which are relevant doctors. Returns structured dict.
326
  """
327
  from webscraper import search_dementia_news, scrape_article_content
328
- print(f"[DEBUG] Searching for {count} doctor articles...") # ← HF logs will show this
329
  articles = search_dementia_news(audience="doctor", max_results=min(count, 10))
330
- print(f"[DEBUG] Found {len(articles)} raw results") # ← check if 0
331
  clean_articles = []
332
- for i, art in enumerate(articles):
333
- if "error" in art:
334
- print(f"[ERROR] Search error: {art['error']}")
335
- continue
336
- print(f"[DEBUG] {i+1}. Title: {art['title'][:50]} | URL: {art['url']}")
337
- try:
338
- content = scrape_article_content(art["url"])
339
- if "[Content extraction failed" in content:
340
- print(f"[WARN] Content failed for {art['url']}")
 
341
  continue
342
- clean_articles.append({
343
- "title": art["title"],
344
- "url": art["url"],
345
- "content": content[:3000]
346
- })
347
- except Exception as e:
348
- print(f"[EXC] Scraping failed for {art['url']}: {e}")
349
- continue
350
- print(f"[DEBUG] Returning {len(clean_articles)} clean articles")
351
  return {"articles": clean_articles}
352
 
353
  # Load 2 different llms for different purposes.
@@ -379,9 +369,7 @@ patient_news = Agent(
379
  backstory="You find and share clear, trustworthy news about dementia—like new treatments, daily care tips, and support resources—written for patients and caregivers.",
380
  verbose=True,
381
  llm=llm_news,
382
- tools=[gather_news_patient],
383
- function_calling=True,
384
- tool_choice="required"
385
  )
386
 
387
  doctor_news = Agent(
@@ -390,9 +378,7 @@ doctor_news = Agent(
390
  backstory="You find and summarize the latest clinical studies, guidelines, and expert insights on dementia—focused on diagnosis, treatment, and research for healthcare providers.",
391
  verbose=True,
392
  llm=llm_news,
393
- tools=[gather_news_doctor],
394
- function_calling=True,
395
- tool_choice="required"
396
  )
397
 
398
  # Define tasks for agents
 
325
  Gathers recent dementia news articles which are relevant doctors. Returns structured dict.
326
  """
327
  from webscraper import search_dementia_news, scrape_article_content
 
328
  articles = search_dementia_news(audience="doctor", max_results=min(count, 10))
 
329
  clean_articles = []
330
+ for art in articles:
331
+ if "error" not in art:
332
+ try:
333
+ content = scrape_article_content(art["url"])
334
+ clean_articles.append({
335
+ "title": art["title"],
336
+ "url": art["url"],
337
+ "content": content[:3000]
338
+ })
339
+ except Exception:
340
  continue
 
 
 
 
 
 
 
 
 
341
  return {"articles": clean_articles}
342
 
343
  # Load 2 different llms for different purposes.
 
369
  backstory="You find and share clear, trustworthy news about dementia—like new treatments, daily care tips, and support resources—written for patients and caregivers.",
370
  verbose=True,
371
  llm=llm_news,
372
+ tools=[gather_news_patient]
 
 
373
  )
374
 
375
  doctor_news = Agent(
 
378
  backstory="You find and summarize the latest clinical studies, guidelines, and expert insights on dementia—focused on diagnosis, treatment, and research for healthcare providers.",
379
  verbose=True,
380
  llm=llm_news,
381
+ tools=[gather_news_doctor]
 
 
382
  )
383
 
384
  # Define tasks for agents