1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
@RestController public class MultiModelController {
@Resource private ChatClient chatClient;
@RequestMapping(value = "/ai/multi") public Object multi(String msg, String imageUrl) {
UserMessage userMessage = new UserMessage(msg, List.of(new Media(MimeTypeUtils.IMAGE_PNG, imageUrl)));
ChatResponse response = chatClient.call(new Prompt(userMessage, OpenAiChatOptions.builder() .withModel(OpenAiApi.ChatModel.GPT_4_VISION_PREVIEW.getValue()) .build()));
System.out.println(response.getResult().getOutput()); return response.getResult().getOutput().getContent(); } }
|