Closed dwk601 closed 2 weeks ago
@dwk601 it looks like the the process cannot assign the task to an agent, I suggest you to split your task into multiple tasks and assign to multiple agents.
Refer the documentation:
@dwk601 shouldn't you set agent
property of Task
object, instead of agents
?
from crewai_tools import tool
@tool("用户发布啤酒数据抽取工具") def load_peer_tool(file_path = '../data/weibo_peer.xlsx') -> np.array: """ excel文件读取工具,用于读取用户发布啤酒文本数据 参数: file_path (str): 存储数据的文件名。 返回: np.array: 用户对啤酒发布信息数据。 """ data = pd.read_excel(file_path) json_data = data[['id', '内容']].to_json(orient='records', force_ascii=False) return np.array(json_data)
import re import json @tool("存储json数据为文件") def save_json(data, filename='../data/beer_analysis.xlsx'): """ 将数据存储为JSON文件。 参数: data (dict): 要存储的数据字典,必须传入整体数据,不可传入变量。 filename (str): 存储数据的文件名。 """ filename = re.sub(r'"', '', filename) try: with open(filename, 'w', encoding='utf-8') as file: json.dump(data, file, ensure_ascii=False, indent=4) print(f"数据已成功存储到 {filename}") except Exception as e: print(f"存储数据时出错: {e}")
@tool("读取json文件") def load_json(filename): """ 从JSON文件中读取数据。 参数: filename (str): 要读取的文件名。 返回: dict: 读取的数据字典。 """ try: with open(filename, 'r', encoding='utf-8') as file: data = json.load(file) print(f"数据已成功从 {filename} 读取") return data except FileNotFoundError: print(f"文件 {filename} 未找到") except json.JSONDecodeError: print(f"文件 {filename} 不是有效的JSON格式") except Exception as e: print(f"读取数据时出错: {e}") return None
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.
I have a data engineer agent that needs to read json file and reformat to a csv file how to make the agent read file and do a task? I'm getting an error with this code right now.
Traceback (most recent call last): File "/home/dongwook/Project/auto_crawl/main.py", line 71, in
result = crew.kickoff()
File "/home/dongwook/Project/auto_crawl/venv/lib/python3.10/site-packages/crewai/crew.py", line 264, in kickoff
result = self._run_sequential_process()
File "/home/dongwook/Project/auto_crawl/venv/lib/python3.10/site-packages/crewai/crew.py", line 287, in _run_sequential_process
if task.agent.allow_delegation: # type: ignore # Item "None" of "Agent | None" has no attribute "allow_delegation"
AttributeError: 'NoneType' object has no attribute 'allow_delegation'