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

example: multi model example is not running #321

Open
lanyanhua opened this issue Dec 26, 2024 · 5 comments
Open

example: multi model example is not running #321

lanyanhua opened this issue Dec 26, 2024 · 5 comments
Labels
area/example Spring AI Alibaba Examples

Comments

@lanyanhua
Copy link

我的URL没有问题 用的是官方样例的URL
new Media(
MimeTypeUtils.IMAGE_PNG,
new URI("https://dashscope.oss-cn-beijing.aliyuncs.com/images/dog_and_girl.jpeg").toURL()
)
实际的报错原因是:正确使用多模态模型:qwen-vl-max-latest。且开启multi-model: true。感觉配置有点多余。而且这报错和实际错误相差太远了
ai: # 阿里灵积 dash-scope: api-key: *** chat: options: model: qwen-vl-max-latest multi-model: true

@yuluo-yx yuluo-yx added the area/example Spring AI Alibaba Examples label Jan 6, 2025
@yuluo-yx
Copy link
Collaborator

yuluo-yx commented Jan 6, 2025

@yuluo-yx yuluo-yx changed the title 多模态报错 org.springframework.ai.retry.NonTransientAiException: 400 - {"code":"InvalidParameter","message":"url error, please check url!","request_id":"4bb03499-1f23-92c2-8792-812ae60d9c49"} example: multi model example is not running Jan 6, 2025
@yangwenliang123
Copy link

https://github.com/springaialibaba/spring-ai-alibaba-examples/tree/main/spring-ai-alibaba-multi-model-example/dashscope-multi-model

您可以参考这个 repo。
我试了一下多模态目前调用仅支持文本,图片+文本。不支持音频+文本,视频+文本

@yuluo-yx
Copy link
Collaborator

yuluo-yx commented Mar 4, 2025

https://github.com/springaialibaba/spring-ai-alibaba-examples/tree/main/spring-ai-alibaba-multi-model-example/dashscope-multi-model
您可以参考这个 repo。
我试了一下多模态目前调用仅支持文本,图片+文本。不支持音频+文本,视频+文本

得看模型那边支不支持这样,如果模型支持,框架是可以实现得,组装一个 userMessage 塞到 prompt 里面去就行

@yuluo-yx
Copy link
Collaborator

yuluo-yx commented Mar 4, 2025

https://github.com/springaialibaba/spring-ai-alibaba-examples/tree/main/spring-ai-alibaba-multi-model-example/dashscope-multi-model
您可以参考这个 repo。
我试了一下多模态目前调用仅支持文本,图片+文本。不支持音频+文本,视频+文本

刚确认了下,模型是支持的,上面那样用就行

@yangwenliang123
Copy link

https://github.com/springaialibaba/spring-ai-alibaba-examples/tree/main/spring-ai-alibaba-multi-model-example/dashscope-multi-model
您可以参考这个repo。
我试了一下多模态目前调用仅支持文本,图片+文本。不支持音频+文本,视频+文本

刚确认了下,模型是支持的,上面那样就行

以下是我的代码和错误信息:
@GetMapping("audio")
public Flux audio(@RequestParam(value = "prompt", required = false, defaultValue = "语音聊天") String prompt) {
Media media = new Media(MimeTypeUtils.parseMimeType("audio/mp3"), new ClassPathResource("/111.mp3"));
UserMessage userMessage = new UserMessage(prompt, media);
return chatClient.prompt(new Prompt(userMessage, DashScopeChatOptions.builder().withModel("qwen-omni-turbo").withMultiModel(true).build()))
.stream()
.content();
}

@GetMapping("/video")
public Flux<String> video(@RequestParam(value = "prompt", required = false, defaultValue = "请描述此视频中的内容。") String prompt) {
    List<Media> mediaList = List.of(new Media(Media.Format.VIDEO_MP4, new ClassPathResource("/222.mp4")));
    UserMessage message = new UserMessage(prompt, mediaList);
    return chatClient.prompt(new Prompt(message, DashScopeChatOptions.builder().withModel("qwen-omni-turbo").withMultiModel(true).build()))
            .stream()
            .content();
}

java.lang.NullPointerException: Cannot invoke "com.alibaba.cloud.ai.dashscope.api.DashScopeApi$ChatCompletionOutput.choices()" because the return value of "com.alibaba.cloud.ai.dashscope.api.DashScopeApi$ChatCompletionChunk.output()" is null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/example Spring AI Alibaba Examples
Projects
None yet
Development

No branches or pull requests

3 participants