Spaces:
Paused
Paused
Update crew.py
Browse files
crew.py
CHANGED
|
@@ -27,6 +27,7 @@ AUDIO_ANALYSIS_MODEL = "gemini-2.5-flash-preview-04-17"
|
|
| 27 |
VIDEO_ANALYSIS_MODEL = "gemini-2.5-flash-preview-04-17"
|
| 28 |
YOUTUBE_ANALYSIS_MODEL = "gemini-2.5-flash-preview-04-17"
|
| 29 |
DOCUMENT_ANALYSIS_MODEL = "gemini-2.5-flash-preview-04-17"
|
|
|
|
| 30 |
CODE_GENERATION_MODEL = "gemini-2.5-flash-preview-04-17"
|
| 31 |
CODE_EXECUTION_MODEL = "gemini-2.5-flash-preview-04-17"
|
| 32 |
|
|
@@ -220,8 +221,8 @@ def run_crew(question, file_path):
|
|
| 220 |
except Exception as e:
|
| 221 |
raise RuntimeError(f"Processing failed: {str(e)}")
|
| 222 |
|
| 223 |
-
@tool("
|
| 224 |
-
def
|
| 225 |
"""Given a question and two numbers, perform the calculation to answer the question.
|
| 226 |
|
| 227 |
Args:
|
|
@@ -238,7 +239,7 @@ def run_crew(question, file_path):
|
|
| 238 |
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
|
| 239 |
|
| 240 |
response = client.models.generate_content(
|
| 241 |
-
model=
|
| 242 |
contents=question,
|
| 243 |
config=types.GenerateContentConfig(
|
| 244 |
tools=[add, subtract, multiply, divide, modulus]
|
|
@@ -379,10 +380,10 @@ def run_crew(question, file_path):
|
|
| 379 |
verbose=True
|
| 380 |
)
|
| 381 |
|
| 382 |
-
|
| 383 |
-
role="
|
| 384 |
goal="Given a question and two numbers, perform the calculation and answer the question: {question}",
|
| 385 |
-
backstory="As an expert
|
| 386 |
allow_delegation=False,
|
| 387 |
llm=AGENT_MODEL,
|
| 388 |
max_iter=2,
|
|
@@ -432,7 +433,7 @@ def run_crew(question, file_path):
|
|
| 432 |
"- Audio Analysis Agent requires a question and **.wav, .mp3, .aiff, .aac, .ogg, or .flac audio file**.\n"
|
| 433 |
"- Video Analysis Agent requires a question and **.mp4, .mpeg, .mov, .avi, .x-flv, .mpg, .webm, .wmv, or .3gpp video file**.\n"
|
| 434 |
"- Document Analysis Agent requires a question and **.docx, .pptx, .pdf, .txt, .html, css, .js, .md, .xml, or .rtf document file**.\n"
|
| 435 |
-
"-
|
| 436 |
"- YouTube Analysis Agent requires a question and **YouTube URL**.\n"
|
| 437 |
"- Code Generation Agent requires a question and **JSON data**.\n"
|
| 438 |
"- Code Execution Agent requires a question and **Python file**.\n"
|
|
@@ -449,7 +450,7 @@ def run_crew(question, file_path):
|
|
| 449 |
video_analysis_agent,
|
| 450 |
youtube_analysis_agent,
|
| 451 |
document_analysis_agent,
|
| 452 |
-
|
| 453 |
code_generation_agent,
|
| 454 |
code_execution_agent],
|
| 455 |
manager_agent=manager_agent,
|
|
|
|
| 27 |
VIDEO_ANALYSIS_MODEL = "gemini-2.5-flash-preview-04-17"
|
| 28 |
YOUTUBE_ANALYSIS_MODEL = "gemini-2.5-flash-preview-04-17"
|
| 29 |
DOCUMENT_ANALYSIS_MODEL = "gemini-2.5-flash-preview-04-17"
|
| 30 |
+
ARITHMETIC_MODEL = "gemini-2.5-flash-preview-04-17"
|
| 31 |
CODE_GENERATION_MODEL = "gemini-2.5-flash-preview-04-17"
|
| 32 |
CODE_EXECUTION_MODEL = "gemini-2.5-flash-preview-04-17"
|
| 33 |
|
|
|
|
| 221 |
except Exception as e:
|
| 222 |
raise RuntimeError(f"Processing failed: {str(e)}")
|
| 223 |
|
| 224 |
+
@tool("Arithmetic Tool")
|
| 225 |
+
def arithmetic_tool(question: str, a: float, b: float) -> float:
|
| 226 |
"""Given a question and two numbers, perform the calculation to answer the question.
|
| 227 |
|
| 228 |
Args:
|
|
|
|
| 239 |
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
|
| 240 |
|
| 241 |
response = client.models.generate_content(
|
| 242 |
+
model=ARITHMETIC_MODEL,
|
| 243 |
contents=question,
|
| 244 |
config=types.GenerateContentConfig(
|
| 245 |
tools=[add, subtract, multiply, divide, modulus]
|
|
|
|
| 380 |
verbose=True
|
| 381 |
)
|
| 382 |
|
| 383 |
+
arithmetic_agent = Agent(
|
| 384 |
+
role="Arithmetic Agent",
|
| 385 |
goal="Given a question and two numbers, perform the calculation and answer the question: {question}",
|
| 386 |
+
backstory="As an expert arithmetic assistant, you perform the calculation to answer the question.",
|
| 387 |
allow_delegation=False,
|
| 388 |
llm=AGENT_MODEL,
|
| 389 |
max_iter=2,
|
|
|
|
| 433 |
"- Audio Analysis Agent requires a question and **.wav, .mp3, .aiff, .aac, .ogg, or .flac audio file**.\n"
|
| 434 |
"- Video Analysis Agent requires a question and **.mp4, .mpeg, .mov, .avi, .x-flv, .mpg, .webm, .wmv, or .3gpp video file**.\n"
|
| 435 |
"- Document Analysis Agent requires a question and **.docx, .pptx, .pdf, .txt, .html, css, .js, .md, .xml, or .rtf document file**.\n"
|
| 436 |
+
"- Arithmetic Agent requires a question and **two numbers to add, subtract, multiply, divide, or get the modulus**.\n"
|
| 437 |
"- YouTube Analysis Agent requires a question and **YouTube URL**.\n"
|
| 438 |
"- Code Generation Agent requires a question and **JSON data**.\n"
|
| 439 |
"- Code Execution Agent requires a question and **Python file**.\n"
|
|
|
|
| 450 |
video_analysis_agent,
|
| 451 |
youtube_analysis_agent,
|
| 452 |
document_analysis_agent,
|
| 453 |
+
arithmetic_agent,
|
| 454 |
code_generation_agent,
|
| 455 |
code_execution_agent],
|
| 456 |
manager_agent=manager_agent,
|