spring-projects / spring-ai

An Application Framework for AI Engineering
https://docs.spring.io/spring-ai/reference/1.0-SNAPSHOT/index.html
Apache License 2.0
2.53k stars 609 forks source link

qustion about ollama + qwen #992

Open zzllkk2003 opened 1 week ago

zzllkk2003 commented 1 week ago

Can Spring AI support the Qwen large language model? And can spring-ai-ollama-spring-boot-starter support function calling?

qinfengge commented 1 week ago

For the first one, it supports Qwen. For the second one, it does not yet support ollama's function call.

zzllkk2003 commented 1 week ago

For the first one, it supports Qwen. For the second one, it does not yet support ollama's function call.

Which Maven package can I use?

codespearhead commented 6 days ago
  1. Does Spring AI support the Qwen large language model?

Spring AI supports Ollama, so you just have to use the Ollama starter package.

  1. Does spring-ai-ollama-spring-boot-starter support function calling?

Spring AI does [1][2][3], but Ollama doesn't officially support function calling yet [4][5], so naturally spring-ai-ollama-spring-boot-starter doesn't have it baked-in. By the way, neither vLLM nor SGLang do either [6].

You might want to take a look at LangChain4j [8][9].


[1] https://github.com/spring-projects/spring-ai/discussions/193 [2] https://www.devturtleblog.com/sring-ai-function-calling-tutorial/ [3] https://spring.io/blog/2024/03/06/function-calling-in-java-and-spring-ai-using-the-latest-mistral-ai-api

[4] https://github.com/QwenLM/Qwen2/issues/378 (https://github.com/QwenLM/Qwen2/issues/378#issuecomment-2097355347) [5] https://github.com/ollama/ollama/issues/3137

[6] https://github.com/QwenLM/Qwen2/blob/d439e04e84ebe3734dea4e9769e17f380a8c72b8/README.md?plain=1#L192 [7] https://docs.langchain4j.dev/tutorials/tools#:~:text=following%20models%20have%20tool%20support

[8] https://docs.langchain4j.dev/tutorials/tools/#:~:text=following%20models%20have%20tool%20support [9] https://docs.langchain4j.dev/tutorials/spring-boot-integration/#langchain4j-spring-boot-starter

jidaojiuyou commented 4 days ago
  1. spring cloud alibaba ai for qwen
  2. 目前无法支持。因为 ollama 的 api 不支持 tools 和 tools_choice 字段。但是可以参考以下文档自己实现。(不推荐但是可用,以下两种方式都可以实现ollama的function call。) langchain ollama function call qwen agent funciton call