Beware that this does break API compatibility due to polymorphism in message contents (which can now be either image or text for the current Claude API with Claude 3 models).
ClaudeCompletionRequest request = new ClaudeCompletionRequest();
List<ClaudeMessageContent> messageContent = new ArrayList<>();
messageContent.add(new ClaudeMessageImageContent(new ClaudeBase64Source("image/jpeg", jpegBytes)));
messageContent.add(new ClaudeMessageTextContent("What is in the image?"));
ClaudeCompletionRequestMessage message = new ClaudeCompletionRequestMessage("user", messageContent);
request.setMessages(Collections.singletonList(message));
This adds vision support for Claude.
Beware that this does break API compatibility due to polymorphism in message contents (which can now be either image or text for the current Claude API with Claude 3 models).
Usage is pretty straight forward and similar to the API description (https://docs.anthropic.com/claude/docs/vision):