Skip to content

ChatClient Vision Capability Fails Without Explicit CallAdvisor - java.lang.IllegalStateException: No CallAdvisors available to execute #3302

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

Open
dilipsundarraj1 opened this issue May 23, 2025 · 0 comments

Comments

@dilipsundarraj1
Copy link

dilipsundarraj1 commented May 23, 2025

Bug description
Getting this error when trying to access the vision capability using ChatClient:
java.lang.IllegalStateException: No CallAdvisors available to execute

Environment

Steps to reproduce

  1. Clone the multimodal-llms project from this link.
  2. In VisionController.java, comment out this line:
    defaultAdvisors
  3. Start the app by running MultimodalLLMApplication.java:
    MultimodalLLMApplication.java
  4. Hit the following curl command:
    curl --request POST \
      --url http://localhost:8083/springai/v2/vision \
      --header 'Content-Type: multipart/form-data' \
      --form file=@/Users/dilipbandlasundarraj/Dilip/code-with-dilip/spring-ai/multimodal-llms/src/main/resources/files/vision/pizza.png \
      --form 'prompt=Explain what do you see in this picture?. Summarize it like an attractive menu item name.'
    

Expected behavior
The vision capability should work even without explicitly adding an advisor in the ChatClient.

Minimal Complete Reproducible example
The issue can be reproduced using the multimodal-llms sample project.
Comment out this line:
VisionController.java#L39
Then hit the POST /springai/v2/vision endpoint.

Fix
This endpoint works only when the following advisor is explicitly added in the controller constructor:

public VisionController(ChatClient.Builder chatClientBuilder,
                        OpenAiChatModel openAiChatModel) {
    this.openAiChatModel = openAiChatModel;
    var advisor = ChatModelCallAdvisor.builder()
            .chatModel(openAiChatModel)
            .build();
    this.chatClient = chatClientBuilder
            .defaultAdvisors(advisor)
            .build();
}

Source: VisionController.java#L39

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

1 participant