JoaoPito / ayanami-bot

Your AI-powered assistant that customizes itself to automate your tasks, conveniently in a Telegram bot
GNU General Public License v3.0
0 stars 0 forks source link

Issue: Non-multimodal LLMs crash after being switched from multimodal ones #10

Open JoaoPito opened 1 month ago

JoaoPito commented 1 month ago

After switching to GPT-3 from GPT-4o, for example, if there is an image in the conversation history, the OpenAI API raises the following error: openai.BadRequestError: Error code: 400 - {'error': {'message': 'Invalid content type. image_url is only supported by certain models.', 'type': 'invalid_request_error', 'param': 'messages.[3].content.[1].type', 'code': None}}

A possible solution is to discard images from the context after switching to a non-multimodal model, aiming to preserve the current context with the previous model.