crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

[BUG] VisionTool: image_path_url default value is the description string, making the required argument optional

Open Akaliup opened this issue 1 month ago • 1 comments

Summary

lib/crewai-tools/src/crewai_tools/tools/vision_tool/vision_tool.py:29 declares:

image_path_url: str = "The image path or URL."

The intended Field(..., description="The image path or URL.") collapsed into a plain default value (compare the correct form in OCRToolSchema, ocr_tool.py:26). Two consequences:

  1. The LLM-visible JSON schema no longer marks image_path_url as required, so the model is invited to omit it.
  2. When omitted, _validate_kwargs validates {} successfully and passes image_path_url="The image path or URL." into _run; the truthy default bypasses the if not image_path_url: guard (lines 141-143), and the tool fails with An error occurred: Image file does not exist: The image path or URL. instead of a clean validation error.

Verified via ImagePromptSchema.model_json_schema() (no required, property default is the description string) and ImagePromptSchema.model_validate({}) (returns the description string as the value).

Possible fix

image_path_url: str = Field(..., description="The image path or URL.")

Disclosure

This issue and the upcoming PR are AI-agent-assisted (generated with an AI coding agent). Please apply the llm-generated label per CONTRIBUTING - I cannot set labels without triage permission.

Akaliup avatar Oct 31 '26 04:10 Akaliup

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.

github-actions[bot] avatar Nov 30 '26 12:11 github-actions[bot]