Issue with Trailing Dot in File Path for Multimodal Agent in gpt-4o

Hi CrewAI Support Team,

I’m encountering an issue with a multimodal agent configuration when using the gpt-4o model. Here’s a brief summary of the setup and problem:

  1. Task and Agent Configuration
  • Task
    technical_analysis_task = Task(
    config=tasks_config[‘long_term_technical_analysis_task’],
    tools=[TechnicalAnalysisTool()],
    agent=technical_analysis_agent
    )
    *Agent
    technical_analysis_agent = Agent(
    config=agents_config[‘technical_analyst’],
    verbose=True,
    multimodal=True,
    )
    Issue
    When the agent is tasked with analyzing a file path output by the TechnicalAnalysisTool, it appends a trailing period (.) to the file path, causing a failure to locate the file.

Example:

  • Expected path: c:\\code\\rag\\AgentFund\\agentfund\\src\\agentfund\\images\\EURUSD2022010120241231.png
  • Received path: c:\\code\\rag\\AgentFund\\agentfund\\src\\agentfund\\images\\EURUSD2022010120241231.png.

The error from the crew run are shown below:
penai.BadRequestError: Error code: 400 - {‘error’: {‘message’: ‘Failed to download image from [c:\code\rag\AgentFund\agentfund\src\agentfund\images\EURUSD2022010120241231.png.](file:///C://code//rag//AgentFund//agentfund//src//agentfund//images//EURUSD2022010120241231**.png.**) Image URL is invalid.’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: ‘invalid_image_url’}}

  • Behavior Observation
  • The issue does not occur with gpt-4o-mini.
  • Only gpt-4o exhibits this behavior.
  1. Expected Behavior
    The agent should not append a trailing period to the file path and should correctly process the image path for analysis.

Could you provide guidance on:

  • Why this might occur specifically with gpt-4o?
  • Any workarounds or fixes to prevent the trailing period from being added to the file path?

Please let me know if you need any further details or additional logs.

Thanks in advance for your help!