Spaces:
Configuration error
Configuration error
Update crew.py
Browse files
crew.py
CHANGED
|
@@ -181,7 +181,7 @@ def run_crew(question, file_path):
|
|
| 181 |
|
| 182 |
@tool("Code Generation Tool")
|
| 183 |
def code_generation_tool(question: str, file_path: str) -> str:
|
| 184 |
-
"""Generate and execute Python code,
|
| 185 |
|
| 186 |
Args:
|
| 187 |
question (str): Question to answer
|
|
@@ -193,16 +193,9 @@ def run_crew(question, file_path):
|
|
| 193 |
Raises:
|
| 194 |
RuntimeError: If processing fails"""
|
| 195 |
try:
|
| 196 |
-
print("###")
|
| 197 |
-
print(question)
|
| 198 |
-
print(file_path)
|
| 199 |
-
print("###")
|
| 200 |
if file_path:
|
| 201 |
df = read_file(file_path)
|
| 202 |
question = f"Question:\n{question}\nData:\n{df.to_string()}"
|
| 203 |
-
print("###")
|
| 204 |
-
print(question)
|
| 205 |
-
print("###")
|
| 206 |
|
| 207 |
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
|
| 208 |
|
|
@@ -224,7 +217,7 @@ def run_crew(question, file_path):
|
|
| 224 |
|
| 225 |
@tool("Code Execution Tool")
|
| 226 |
def code_execution_tool(question: str, file_path: str) -> str:
|
| 227 |
-
"""Execute a Python code file to answer a question.
|
| 228 |
|
| 229 |
Args:
|
| 230 |
question (str): Question to answer
|
|
@@ -313,7 +306,7 @@ def run_crew(question, file_path):
|
|
| 313 |
|
| 314 |
code_generation_agent = Agent(
|
| 315 |
role="Code Generation Agent",
|
| 316 |
-
goal="Generate and execute Python code,
|
| 317 |
backstory="As an expert Python code generation assistant, you generate and execute code to help answer the question.",
|
| 318 |
allow_delegation=False,
|
| 319 |
llm=AGENT_MODEL,
|
|
|
|
| 181 |
|
| 182 |
@tool("Code Generation Tool")
|
| 183 |
def code_generation_tool(question: str, file_path: str) -> str:
|
| 184 |
+
"""Generate and execute Python code, optionally reading a .csv, .xls, .xlsx, .json, .jsonl document, to answer a question.
|
| 185 |
|
| 186 |
Args:
|
| 187 |
question (str): Question to answer
|
|
|
|
| 193 |
Raises:
|
| 194 |
RuntimeError: If processing fails"""
|
| 195 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
if file_path:
|
| 197 |
df = read_file(file_path)
|
| 198 |
question = f"Question:\n{question}\nData:\n{df.to_string()}"
|
|
|
|
|
|
|
|
|
|
| 199 |
|
| 200 |
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
|
| 201 |
|
|
|
|
| 217 |
|
| 218 |
@tool("Code Execution Tool")
|
| 219 |
def code_execution_tool(question: str, file_path: str) -> str:
|
| 220 |
+
"""Execute a .py Python code file to answer a question.
|
| 221 |
|
| 222 |
Args:
|
| 223 |
question (str): Question to answer
|
|
|
|
| 306 |
|
| 307 |
code_generation_agent = Agent(
|
| 308 |
role="Code Generation Agent",
|
| 309 |
+
goal="Generate and execute Python code, optionally reading a .csv, .xls, .xlsx, .json, .jsonl document, to help answer question \"{question}\"",
|
| 310 |
backstory="As an expert Python code generation assistant, you generate and execute code to help answer the question.",
|
| 311 |
allow_delegation=False,
|
| 312 |
llm=AGENT_MODEL,
|