Activity
Mon
Wed
Fri
Sun
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
What is this?
Less
More

Memberships

AI Developer Accelerator

10.8k members โ€ข Free

1 contribution to AI Developer Accelerator
CrewAI Tool Error
I'm using crewAI to create a simple agentic system to detect an object in an uploaded image. I create a custom tool but it is not working as expected. The tool has been created as following: @tool def ImageObjectDetectorTool(arguments: dict) -> str: """A tool for identifying objects in images. The input will be a dictionary with two keys: - The first [IMAGE_PATH] will be the full path of an image file. - The second [TEXT_PROMPT] will be replaced by the string query describing the object/s to identify in the image. To use this tool just call ImageObjectDetectorTool(dictionary) replacing dictionary by {"IMAGE_PATH": value, "TEXT_PROMPT": value} variables by their values. The output will the a path with an image file with the identified objects overlayed in the image. """ print("Tool activated:", arguments) # just to see if the agent achieves to enter into this tool BOX_TRESHOLD = 0.35 TEXT_TRESHOLD = 0.25 IMAGE_PATH = arguments["IMAGE_PATH"] image_source, image = load_image() boxes, logits, phrases = predict( model=model, image=image, caption=arguments["TEXT_PROMPT"], box_threshold=BOX_TRESHOLD, text_threshold=TEXT_TRESHOLD ) annotated_frame = annotate(image_source=image_source, boxes=boxes, logits=logits, phrases=phrases) output_file = IMAGE_PATH.split('.')[0] + "_annotated_image.jpg" cv2.imwrite(output_file, annotated_frame) return output_file And the Agent, Task and Crew have been created as: ### AGENT ### obj_detector_agent = Agent( role="Object Detector", goal="""Find and detect an object into a image. The result will be the path where is saved the image with the object located. Just give to the user the final answer with the path. """, backstory="""As an Object Detector, you are responsible for detecting an object in the image """, verbose=True, llm=llm, tools=[ImageObjectDetectorTool] ) ### TASK ### obj_detector_task = Task( description="""Detect a {object} in the following image {image_path} and show the annoted image returned by ImageObjectDetectorTool as a result""",
CrewAI Tool Error
0 likes โ€ข Jun '24
Oh, sorry. I attach the notebook with the full code Yes, I do, but it seems that the agent does not enter properly into the tool. I don't know if it is due to the input arguments definition of the tool, but I am fricking out.
1-1 of 1
Marta Rom
1
5points to level up
@marta-rom-2246
Data Engineer

Active 551d ago
Joined Jun 1, 2024
Powered by