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
Add support for multi part chat messages (and gpt-4-vision-preview model) (#580)
* Add support for multi part chat messages
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.
* Add ImageURLDetail and ChatMessagePartType types
* Optimize ChatCompletionMessage deserialization
* Add ErrContentFieldsMisused error
ErrChatCompletionInvalidModel=errors.New("this model is not supported with this method, please use CreateCompletion client method instead") //nolint:lll
22
23
ErrChatCompletionStreamNotSupported=errors.New("streaming is not supported with this method, please use CreateChatCompletionStream") //nolint:lll
24
+
ErrContentFieldsMisused=errors.New("can't use both Content and MultiContent properties simultaneously")
0 commit comments