Skip to content
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

GPT 4 Vision Support #659

Open
Mr-LiuDC opened this issue Apr 30, 2024 · 1 comment
Open

GPT 4 Vision Support #659

Mr-LiuDC opened this issue Apr 30, 2024 · 1 comment

Comments

@Mr-LiuDC
Copy link

Mr-LiuDC commented Apr 30, 2024

springAiVersion: 0.8.1

This is an example I saw here, but based on my testing, it seems that the gpt-4-vision-preview model is not yet supported.

Spring AI - Multimodality - Orbis Sensualium Pictus

Map<?, ?> aiVision() {
    var userMessage = new UserMessage("图片中有些什么?",
            List.of(new Media(MimeTypeUtils.IMAGE_PNG, "https://docs.spring.io/spring-ai/reference/1.0-SNAPSHOT/_images/multimodal.test.png"))
    );

    ChatResponse response = chatClient.call(new Prompt(List.of(userMessage),
            OpenAiChatOptions.builder().withModel(OpenAiApi.ChatModel.GPT_4_VISION_PREVIEW.getValue()).build()));
    return Map.of("result", response);
}
@ThomasVitale
Copy link
Contributor

Multimodality was not part of Spring AI 0.8.1. You can try it out using version 1.0.0-SNAPSHOT. I have an example here: https://github.com/ThomasVitale/llm-apps-java-spring-ai/tree/main/02-prompts/prompts-multimodality-openai.

OpenAI is now supporting multimodality with vision using the gpt-4-turbo model. The gpt-4-vision-preview model was a preview and it's not recommended anymore (see: https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4). Still, the example works with both the gpt-4-vision-preview and with the gpt-4-turbo models.

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

No branches or pull requests

2 participants