Ollama
本地运行命令
ollama run qwen3:4b
pom 依赖<dependency><groupId>org.springframework.ai</groupId><artifactId>spring-ai-bom</artifactId><version>${spring-ai.version}</version><type>pom</type><scope>import</scope></dependency><dependency><groupId>org.springframework.ai</groupId><artifactId>spring-ai-starter-model-ollama</artifactId></dependency>yml配置
#Ollama配置 spring.ai.ollama.base-url=http://localhost:11434spring.ai.ollama.chat.options.model=qwen3:4b # 应用启动时不自动拉取模型(如需自动拉取可改为 when_missing) spring.ai.ollama.init.pull-model-strategy=never测试代码
@TestpublicvoidtestOllama(@AutowiredOllamaChatModelollamaChatModel){Promptprompt=newPrompt("你是谁");ChatResponsecall=ollamaChatModel.call(prompt);Stringtext=call.getResult().getOutput().getText();System.out.println("-------------- Ollama --------------");System.out.println(text);}@TestpublicvoidtestOllamaStream(@AutowiredOllamaChatModelollamaChatModel){Flux<String>stream=ollamaChatModel.stream("你是谁");stream.toStream().forEach(System.out::println);System.out.println("-------------- Ollama --------------");}多层级记忆
短期记忆+中期记忆+长期记忆
skill平台:https://skillsmp.com/
大模型渐进式加载