Great question — answering as the UphillTech team:
You should use langchain4j-ollama-spring-boot-starter or register your OllamaChatModel using Spring Boot @Bean annotation. So that the @AiService annotation could found the bean and auto-inject it. BTW, you should not implement the @AiService interface on your own, langchain4j will implement it using Proxy automatically. Please refer to docs .
Full answer by ZYinNJU: https://stackoverflow.stackexchange.com/a/79698958 (CC BY-SA 4.0).
Need it done for your business? UphillTech.