theRealNG commited on
Commit
a4529fb
·
1 Parent(s): e4fabe5

ensure json output

Browse files
tasks/create_article_pitch.py CHANGED
@@ -1,7 +1,7 @@
1
  from crewai import Task
2
  from agents.curiosity_catalyst import curiosity_catalyst
3
  from tools.scrape_website import scrape_tool
4
- from utils.recommended_article import RecommendedArticle
5
 
6
  article_pitch_task = Task(
7
  description=(
@@ -14,7 +14,7 @@ article_pitch_task = Task(
14
  expected_output=(
15
  "Json array of all the artilces that have passed evaluation phase. Each article should have the following keys title, article_url, pitch and reason behind the recommedation"
16
  ),
17
- # output_json=RecommendedArticle,
18
  tools=[scrape_tool],
19
  agent=curiosity_catalyst
20
  )
 
1
  from crewai import Task
2
  from agents.curiosity_catalyst import curiosity_catalyst
3
  from tools.scrape_website import scrape_tool
4
+ from utils.recommended_article import RecommendedArticles
5
 
6
  article_pitch_task = Task(
7
  description=(
 
14
  expected_output=(
15
  "Json array of all the artilces that have passed evaluation phase. Each article should have the following keys title, article_url, pitch and reason behind the recommedation"
16
  ),
17
+ output_json=RecommendedArticles,
18
  tools=[scrape_tool],
19
  agent=curiosity_catalyst
20
  )
utils/recommended_article.py CHANGED
@@ -1,7 +1,11 @@
1
  from pydantic import BaseModel
 
2
 
3
  class RecommendedArticle(BaseModel):
4
  title: str
5
  url: str
6
  pitch: str
7
  reason_for_recommendation: str
 
 
 
 
1
  from pydantic import BaseModel
2
+ from typing import List
3
 
4
  class RecommendedArticle(BaseModel):
5
  title: str
6
  url: str
7
  pitch: str
8
  reason_for_recommendation: str
9
+
10
+ class RecommendedArticles(BaseModel):
11
+ articles: List[RecommendedArticle]