You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RequestFailedException(message: Invalid type for 'messages[1].content[1].image_url': expected an object, but got a string instead., statusCode: 400)
#203
Open
lukehutch opened this issue
Dec 4, 2024
· 3 comments
RequestFailedException(message: Invalid type for 'messages[1].content[1].image_url': expected an object, but got a string instead., statusCode: 400)
#0 OpenAINetworkingClient.post (package:dart_openai/src/core/networking/client.dart:332:7)
<asynchronous suspension>
#1 OpenAIChat.create (package:dart_openai/src/instance/chat/chat.dart:87:12)
<asynchronous suspension>
#2 run (package:qa/qa.dart:68:46)
<asynchronous suspension>
#3 main (file:///Users/lhutchison/qa/bin/qa.dart:8:3)
<asynchronous suspension>
The text was updated successfully, but these errors were encountered:
I fixed it.. try to make a pr.
i changed the content.dart line 55 from Map<String, dynamic> toMap() { return { "type": type, if (text != null) "text": text, if (imageUrl != null) "image_url": imageUrl, }; }
to Map<String, dynamic> toMap() { return { "type": type, if (text != null) "text": text, if (imageUrl != null) "image_url": { "url": imageUrl, }, }; }
it should be a object (map) but in the line 55 it throws only a String that's why its error.
When trying the chat example, I get:
The text was updated successfully, but these errors were encountered: