bstraehle commited on
Commit
88872fd
·
verified ·
1 Parent(s): bfe27d1

Update crew.py

Browse files
Files changed (1) hide show
  1. crew.py +15 -19
crew.py CHANGED
@@ -4,30 +4,23 @@
4
  # https://ai.google.dev/gemini-api/docs
5
 
6
  import os
7
- import pandas as pd
8
- from crewai import Agent, Crew, Process, Task
9
  from crewai.agents.agent_builder.base_agent import BaseAgent
10
  from crewai.project import CrewBase, agent, crew, task
11
  from google import genai
12
- from google.genai import types
13
  from openinference.instrumentation.crewai import CrewAIInstrumentor
14
  from phoenix.otel import register
15
  from tools.ai_tools import AITools
16
  from tools.arithmetic_tools import ArithmeticTools
17
  from typing import List
18
- from utils import (
19
- read_file_json,
20
- read_docx_text,
21
- read_pptx_text,
22
- is_ext
23
- )
24
 
25
  ## LLMs
26
 
27
- MANAGER_MODEL = "gpt-4.5-preview"
28
- AGENT_MODEL = "gpt-4.1-mini"
29
 
30
- FINAL_ANSWER_MODEL = "gemini-2.5-pro-preview-03-25"
31
 
32
  # LLM evaluation
33
 
@@ -126,24 +119,24 @@ class GAIACrew():
126
  )
127
 
128
  @agent
129
- def code_execution_agent(self) -> Agent:
130
  return Agent(
131
- config=self.agents_config["code_execution_agent"],
132
  allow_delegation=False,
133
  llm=AGENT_MODEL,
134
  max_iter=3,
135
- tools=[AITools.code_execution_tool],
136
  verbose=True
137
  )
138
 
139
  @agent
140
- def code_generation_agent(self) -> Agent:
141
  return Agent(
142
- config=self.agents_config["code_generation_agent"],
143
  allow_delegation=False,
144
  llm=AGENT_MODEL,
145
  max_iter=3,
146
- tools=[AITools.code_generation_tool],
147
  verbose=True
148
  )
149
 
@@ -175,7 +168,10 @@ def run_crew(question, file_path):
175
  final_question = question
176
 
177
  if file_path:
178
- if is_ext(file_path, ".csv") or is_ext(file_path, ".xls") or is_ext(file_path, ".xlsx") or is_ext(file_path, ".json") or is_ext(file_path, ".jsonl"):
 
 
 
179
  json_data = read_file_json(file_path)
180
  final_question = f"{question} JSON data:\n{json_data}."
181
  else:
 
4
  # https://ai.google.dev/gemini-api/docs
5
 
6
  import os
7
+ from crewai import Agent, Crew, Task
 
8
  from crewai.agents.agent_builder.base_agent import BaseAgent
9
  from crewai.project import CrewBase, agent, crew, task
10
  from google import genai
 
11
  from openinference.instrumentation.crewai import CrewAIInstrumentor
12
  from phoenix.otel import register
13
  from tools.ai_tools import AITools
14
  from tools.arithmetic_tools import ArithmeticTools
15
  from typing import List
16
+ from utils import read_file_json, is_ext
 
 
 
 
 
17
 
18
  ## LLMs
19
 
20
+ MANAGER_MODEL = "gpt-4.5-preview"
21
+ AGENT_MODEL = "gpt-4.1-mini"
22
 
23
+ FINAL_ANSWER_MODEL = "gemini-2.5-pro-preview-03-25"
24
 
25
  # LLM evaluation
26
 
 
119
  )
120
 
121
  @agent
122
+ def code_generation_agent(self) -> Agent:
123
  return Agent(
124
+ config=self.agents_config["code_generation_agent"],
125
  allow_delegation=False,
126
  llm=AGENT_MODEL,
127
  max_iter=3,
128
+ tools=[AITools.code_generation_tool],
129
  verbose=True
130
  )
131
 
132
  @agent
133
+ def code_execution_agent(self) -> Agent:
134
  return Agent(
135
+ config=self.agents_config["code_execution_agent"],
136
  allow_delegation=False,
137
  llm=AGENT_MODEL,
138
  max_iter=3,
139
+ tools=[AITools.code_execution_tool],
140
  verbose=True
141
  )
142
 
 
168
  final_question = question
169
 
170
  if file_path:
171
+ if is_ext(file_path, ".csv") or
172
+ is_ext(file_path, ".xls") or
173
+ is_ext(file_path, ".xlsx") or
174
+ is_ext(file_path, ".json") or is_ext(file_path, ".jsonl"):
175
  json_data = read_file_json(file_path)
176
  final_question = f"{question} JSON data:\n{json_data}."
177
  else: