Skip to content

Conversation

@dev-jonghoonpark
Copy link
Contributor

@dev-jonghoonpark dev-jonghoonpark commented Apr 21, 2025

related issue: #2804

I have improved the Anthropic API to support image URLs.


The following areas still need improvement:

  • In Spring AI, the MimeType is required in the Media object, but the Anthropic API does not require the MimeType. Therefore, we need to explicitly provide a MimeType (any value can be used).

example:

String response = ChatClient.create(this.chatModel).prompt()
        .options(AnthropicChatOptions.builder().model(modelName).build())
        .user(u -> u.text("Explain what do you see on this picture?").media(MimeTypeUtils.IMAGE_PNG, url))
        .call()
        .content();

MimeTypeUtils.IMAGE_PNG is not necessary for the Anthropic API, but it must be included to meet the requirements of Spring AI.

I thought that creating a media(URL url) method that does not require a MimeType could cause confusion with other models that mandate the use of a MimeType.

@dev-jonghoonpark dev-jonghoonpark changed the title Make allow image url for Anthropic API Make allow image url for Anthropic Message API Apr 22, 2025
@markpollack markpollack self-assigned this Apr 29, 2025
@markpollack markpollack added this to the 1.0.0-M8 milestone Apr 29, 2025
@ilayaperumalg
Copy link
Member

@dev-jonghoonpark Thanks for the PR. Rebased and merged as c6ccc1a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants