bstraehle commited on
Commit
2c58bbf
·
verified ·
1 Parent(s): 23b92b8

Update agents.py

Browse files
Files changed (1) hide show
  1. agents.py +33 -1
agents.py CHANGED
@@ -14,6 +14,12 @@ from smolagents import (
14
  )
15
  from tools import VisitWebpageTool
16
 
 
 
 
 
 
 
17
  MODEL_ID_1 = "gpt-4o-mini"
18
  MODEL_ID_2 = "gpt-4o"
19
  MODEL_ID_3 = "o4-mini"
@@ -96,4 +102,30 @@ def get_final_answer(question, answer):
96
  print(f"Answer: {answer}")
97
  print(f"Final answer: {final_answer}")
98
 
99
- return final_answer
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  )
15
  from tools import VisitWebpageTool
16
 
17
+ ###
18
+ from crewai import Agent
19
+ from langchain_openai import ChatOpenAI
20
+ from tools import scrape_tool, search_tool, today_tool
21
+ ###
22
+
23
  MODEL_ID_1 = "gpt-4o-mini"
24
  MODEL_ID_2 = "gpt-4o"
25
  MODEL_ID_3 = "o4-mini"
 
102
  print(f"Answer: {answer}")
103
  print(f"Final answer: {final_answer}")
104
 
105
+ return final_answer
106
+
107
+ ###
108
+ def get_researcher_agent(model, verbose):
109
+ return Agent(
110
+ role="Researcher",
111
+ goal="Research content on topic: {topic}.",
112
+ backstory="You're working on researching content on topic: {topic}. "
113
+ "Your work is the basis for the Writer to write on this topic.",
114
+ llm=ChatOpenAI(model=model),
115
+ tools = [search_tool(), scrape_tool()],
116
+ allow_delegation=False,
117
+ verbose=verbose
118
+ )
119
+
120
+ def get_writer_agent(model, verbose):
121
+ return Agent(
122
+ role="Writer",
123
+ goal="Write an article on topic: {topic}.",
124
+ backstory="You're working on writing an article on topic: {topic}. "
125
+ "You base your writing on the work of the Researcher, who provides context on this topic.",
126
+ llm=ChatOpenAI(model=model),
127
+ tools = [today_tool()],
128
+ allow_delegation=False,
129
+ verbose=verbose
130
+ )
131
+ ###