This repository was archived by the owner on Jun 6, 2024. It is now read-only.
This repository was archived by the owner on Jun 6, 2024. It is now read-only.
When using the GPT-4V model in this library, GPT replied, "Sorry, I cannot access external URLs to view images." However, when I use the curl command, GPT can access image links #421
Open
Description
When using the GPT-4V model in this library, GPT replied, "Sorry, I cannot access external URLs to view images." However, when I use the curl command, GPT can access image links.
my curl commend
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxx" \
-d '{
"model":"gpt-4-vision-preview",
"messages":[
{
"role":"user",
"content":[
{
"type":"text",
"text":"What’s in this image?"
},
{
"type":"image_url",
"image_url":{
"url":"https://wework.qpic.cn/wwpic/xxxx",
"detail":"low"
}
}
]
}
],
"max_tokens":300
}'
and this is my code
String model = "gpt-4-vision-preview";
List<ChatMessage> messages = new ArrayList<>();
JSONArray contents = new JSONArray();
JSONObject textContent = new JSONObject();
textContent.put("type","text");
textContent.put("text","What’s in this image?");
contents.add(textContent);
JSONObject imageContent = new JSONObject();
imageContent.put("type","image_url");
JSONObject url = new JSONObject();
//url.put("url","https://upload.wikimedia.org/wikipedia/commons/thumb/2/20/John_Everett_Millais_-_%22A_Reverie%22_from_The_Window%3B_or%2C_The_Song_of_the_Wrens.jpg/403px-John_Everett_Millais_-_%22A_Reverie%22_from_The_Window%3B_or%2C_The_Song_of_the_Wrens.jpg");
url.put("url","https://wework.qpic.cn/wwpic/xxxx");
url.put("detail","low");
imageContent.put("image_url",url);
contents.add(imageContent);
log.info("contents:{}",contents.toString());
messages.add(new ChatMessage(ChatMessageRole.USER.value(),contents.toString()));
log.info("===messages:{}",messages);
and I use ChatCompletionRequest
ChatCompletionRequest chatCompletionRequest = ChatCompletionRequest.builder()
.model(model)
.messages(messages)
.maxTokens(300)
.n(1)
.build();
Can anyone help me solve this problem?
Metadata
Metadata
Assignees
Labels
No labels