Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Add support for gpt-4-vision #413

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

JanCong
Copy link

@JanCong JanCong commented Nov 19, 2023

support the content in chat completion with format https://platform.openai.com/docs/guides/vision

support the content in chat completion with format
https://platform.openai.com/docs/guides/vision
@JanCong JanCong mentioned this pull request Nov 19, 2023
@Jegorex
Copy link

Jegorex commented Nov 26, 2023

I would love it if this or #423 could be added

@yangleimiao
Copy link

Excuse me , Do these code in class ChatCompletionResult not need to be modified?

    @JsonProperty("finish_reason")
    String finishReason;

because I found that these changed to 'finish_details' in GPT-4V's return value, like:

"finish_details":{
    "type":"stop",
    "stop":"<|fim_suffix|>"
}

@JanCong
Copy link
Author

JanCong commented Dec 3, 2023

Excuse me , Do these code in class ChatCompletionResult not need to be modified?

    @JsonProperty("finish_reason")
    String finishReason;

because I found that these changed to 'finish_details' in GPT-4V's return value, like:

"finish_details":{
    "type":"stop",
    "stop":"<|fim_suffix|>"
}

Yes, I've noticed too, and I've already made the changes. Thank you very much for your suggestion.

@Ran-Mewo
Copy link

Ran-Mewo commented Jan 1, 2024

I really don't like the parameterized ChatMessage, it completely breaks my entire code.

It'll be better with something like

@JsonInclude() // content should always exist in the call, even if it is null
Object content;
public ChatMessage(String role, List<ChatMessageContent> content) {
	this.role = role;
	this.content = content;
}

public ChatMessage(String role, List<ChatMessageContent> content, String name) {
	this.role = role;
	this.content = content;
	this.name = name;
}

public ChatMessage(String role, String content) {
	this.role = role;
	this.content = content;
}

public ChatMessage(String role, String content, String name) {
	this.role = role;
	this.content = content;
	this.name = name;
}

@JsonIgnore
public String getStringContent() {
	return content instanceof String ? (String) content : null;
}

This atleast keeps the code compatible

Ran-Mewo added a commit to Ran-Mewo/openai-java that referenced this pull request Jan 3, 2024
with a few modifications that removes parameterized `ChatMessage`
@ittech17
Copy link

ittech17 commented Feb 6, 2024

when can we have this feature merged ?

@caopengan
Copy link

I wonder if we could speed up the merger

Copy link

@lakf lakf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

@fedorBir
Copy link

@JanCong, is this ever going to be merged?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants