-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multi part chat messages (and gpt-4-vision-preview model) #580
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #580 +/- ##
==========================================
+ Coverage 98.35% 98.44% +0.09%
==========================================
Files 24 24
Lines 1276 1354 +78
==========================================
+ Hits 1255 1333 +78
Misses 15 15
Partials 6 6 ☔ View full report in Codecov by Sentry. |
b468820
to
2b59ea6
Compare
OpenAI has recently introduced a new model called gpt-4-visual-preview, which now supports images as input. The chat completion endpoint accepts multi-part chat messages, where the content can be an array of structs in addition to the usual string format. This commit introduces new structures and constants to represent different types of content parts. It also implements the json.Marshaler and json.Unmarshaler interfaces on ChatCompletionMessage.
any updates? |
We are waiting for review. |
Hey, thank you for the PR! Sorry for being so slow with the review! |
Looks good! Just a couple of minor fixes and let's merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the updates! Note: there were more tests, do you want to return them or can we merge like that?
I introduced requested changes. |
Not sure what you are referring with "more tests". Do you mean that we catch errors in tests? If so, then my answer is no. I don't thing it is worth wrapping json.Unmarshal/json.Marshal errors only to be able to catch them in test. This could potentially break someones code. |
@rkintzi There was this whole block of checks 1520212#diff-035a00c5352f69159c65e81dbeffed087f0028e2a9324d7ff62786940f548827R339-R354 |
And what about them? I really don't get what is the change that you suggest? |
@rkintzi ah, sorry, they are still here. I was looking only at the diff from the latest commit! Thank you for the PR! ❤️ |
Sure thing! You're welcome! |
OpenAI has recently introduced a new model called gpt-4-visual-preview, which now supports images as input. The chat completion endpoint accepts multi-part chat messages, where the content can be an array of structs in addition to the usual string format.
This commit introduces new structures and constants to represent different types of content parts. It also implements the json.Marshaler and json.Unmarshaler interfaces on ChatCompletionMessage.
Issues: #539,#596
Similar PR: #557