bstraehle commited on
Commit
4097826
·
verified ·
1 Parent(s): d0d0aee

Update crew.py

Browse files
Files changed (1) hide show
  1. crew.py +7 -5
crew.py CHANGED
@@ -21,6 +21,8 @@ from utils import read_file_json, is_ext
21
  MANAGER_MODEL = "gpt-4.5-preview"
22
  AGENT_MODEL = "gpt-4.1-mini"
23
 
 
 
24
  FINAL_ANSWER_MODEL = "gemini-2.5-pro-preview-03-25"
25
 
26
  # LLM evaluation
@@ -38,15 +40,15 @@ tracer_provider = register(
38
  CrewAIInstrumentor().instrument(tracer_provider=tracer_provider)
39
 
40
  @CrewBase
41
- class GAIACrew():
42
  agents: List[BaseAgent]
43
  tasks: List[Task]
44
 
45
  with StagehandTool(
46
  api_key=os.environ["BROWSERBASE_API_KEY"],
47
  project_id=os.environ["BROWSERBASE_PROJECT_ID"],
48
- model_api_key=os.environ["OPENAI_API_KEY"],
49
- model_name="gpt-4.1"
50
  ) as web_browser_tool:
51
  web_browser_agent = Agent(
52
  role="Web Browser Agent",
@@ -182,7 +184,7 @@ class GAIACrew():
182
  verbose=True
183
  )
184
 
185
- def run_crew(question, file_path):
186
  final_question = question
187
 
188
  if file_path:
@@ -192,7 +194,7 @@ def run_crew(question, file_path):
192
  else:
193
  final_question = f"{question} File path: {file_path}."
194
 
195
- answer = GAIACrew().crew().kickoff(inputs={"question": final_question})
196
  final_answer = get_final_answer(FINAL_ANSWER_MODEL, question, str(answer))
197
 
198
  print(f"=> Initial question: {question}")
 
21
  MANAGER_MODEL = "gpt-4.5-preview"
22
  AGENT_MODEL = "gpt-4.1-mini"
23
 
24
+ STAGEHAND_MODEL = "gpt-4.1"
25
+
26
  FINAL_ANSWER_MODEL = "gemini-2.5-pro-preview-03-25"
27
 
28
  # LLM evaluation
 
40
  CrewAIInstrumentor().instrument(tracer_provider=tracer_provider)
41
 
42
  @CrewBase
43
+ class GAIACrew(openai_api_key):
44
  agents: List[BaseAgent]
45
  tasks: List[Task]
46
 
47
  with StagehandTool(
48
  api_key=os.environ["BROWSERBASE_API_KEY"],
49
  project_id=os.environ["BROWSERBASE_PROJECT_ID"],
50
+ model_api_key=openai_api_key,
51
+ model_name=STAGEHAND_MODEL
52
  ) as web_browser_tool:
53
  web_browser_agent = Agent(
54
  role="Web Browser Agent",
 
184
  verbose=True
185
  )
186
 
187
+ def run_crew(question, file_path, openai_api_key):
188
  final_question = question
189
 
190
  if file_path:
 
194
  else:
195
  final_question = f"{question} File path: {file_path}."
196
 
197
+ answer = GAIACrew(openai_api_key).crew().kickoff(inputs={"question": final_question})
198
  final_answer = get_final_answer(FINAL_ANSWER_MODEL, question, str(answer))
199
 
200
  print(f"=> Initial question: {question}")