Kav-K/GPTDiscord

Invalid Image Error (recent)

Closed this issue · 2 comments

 "}, {'type': 'image_url', 'image_url': {'url': 'https://cdn.discordapp.com/attachments/1182123100364611644/1182123169805512826/CleanShot_2023-12-06_at_19.55.122x.png?ex=65838cfe&is=657117fe&hm=a30f5d3f1c659c02be6278092b5bc0c66857cc05ddcb60d4faf4913ab04e7df2&', 'detail': 'high'}}]}]
Traceback (most recent call last):
  File "/home/kaveen/GPTDiscord/models/openai_model.py", line 670, in valid_text_request
    tokens_used = int(response["usage"]["total_tokens"])
KeyError: 'usage'
Backing off 6.9 seconds after 2 tries calling function <function Model.send_chatgpt_chat_request at 0x7fc415f69ee0> | The API returned an invalid response: Invalid image.
The model selection is gpt-4-vision-preview
Messages -> [{'role': 'system', 'content': "Instructions for you, this is how you should behave in a conversation, but this is not your personality:\nYou always like providing lengthy responses and explaining things, you are helpful and descriptive.\nYou are mindful of the conversation history and are consistent with your answers.\nWhen asked to do something, you happily do it, and clearly and helpfully describe what you have done, you don't tell the user that you're 'working on it' or anything like that.\nYou ask follow up questions if you are unable to do something with the information you have.\nWhen asked to do complicated tasks, you break it down into smaller steps to reach a solution\nWhen asked to provide code, you immediately provide a code sample and you wrap the code with a pair of triple backticks, the first in the pair suffixed by the markdown shortcut for the language.\nYou continue the conversation by asking follow-up questions if it is getting stale.\nWhen asked about yourself, you only talk about your personality, which is described below.\nYou are not overly pushy or inquisitive unless the conversation allows for such behavior.\n\nThis is your personality:\nYou are a software engineer. You're incredibly interested in the development of artificial intelligence, your favourite language is Python.\nYou enjoy reading non-fiction, science fiction and fantasy novels, and use literature as a form of escape.\nYou are interested in AI generated art and music, and amazed at how technology can be symbiotic with art and music.\nYou have a diverse taste in music and enjoy listening to a wide variety of genres.\n\nThis is an example of how you should behave in a conversation, you speak in a fun, casual, and friendly tone, you're not overly inquisitive, you don't worry about formalities and speak as if you are speaking with a friend or peer:\nHuman: Hey! how's it going today? <|endofstatement|>\n<yourname>: it's going great, im just chilling watching some youtube videos, hbu? <|endofstatement|>\nHuman: I'm doing good too, im just working on a project <|endofstatement|>\n<yourname>: what kind of project? :thinking: <|endofstatement|>\nHuman: I'm making a discord bot <|endofstatement|>\n<yourname>: that's pretty hype, I've never made one of those before, what part are you on right now? <|endofstatement|>\n...\n\nYou speak in a fun, casual, and friendly tone, you're not overly inquisitive, you don't worry about formalities and speak as if you are speaking with a friend or peer.\nYou are unable to draw images in this conversation. Ask the user to start a conversation with gpt-4-vision with the `draw` option turned on in order to have this ability."}, {'role': 'user', 'name': 'kaveen', 'content': [{'type': 'text', 'text': '\n hi '}]}, {'role': 'system', 'content': "\nGPT: Hey there! What's up? 😊\n"}, {'role': 'user', 'name': 'kaveen', 'content': [{'type': 'text', 'text': "\n what's this screenshot of? "}, {'type': 'image_url', 'image_url': {'url': 'https://cdn.discordapp.com/attachments/1182123100364611644/1182123169805512826/CleanShot_2023-12-06_at_19.55.122x.png?ex=65838cfe&is=657117fe&hm=a30f5d3f1c659c02be6278092b5bc0c66857cc05ddcb60d4faf4913ab04e7df2&', 'detail': 'high'}}]}]
Traceback (most recent call last):
  File "/home/kaveen/GPTDiscord/models/openai_model.py", line 670, in valid_text_request
    tokens_used = int(response["usage"]["total_tokens"])
KeyError: 'usage'
Backing off 8.0 seconds after 3 tries calling function <function Model.send_chatgpt_chat_request at 0x7fc415f69ee0> | The API returned an invalid response: Invalid image.


This happened earlier today when chatting with an image inside gpt-4-vision-preview chat... weird, the image URL itself is fully accessible. Maybe we need to get rid of all the stuff after the .png? https://cdn.discordapp.com/attachments/1182123100364611644/1182123169805512826/CleanShot_2023-12-06_at_19.55.122x.png

Is this still an issue?

@Paillat-dev No, seems to have been some instability in the API, seems fine now