Spring / Spring AI interview questions
How does Spring AI support the Ollama provider for local model development?
Ollama is an open-source tool that downloads and runs large language models locally on your machine — no API key, no internet connection required once the model is downloaded. Spring AI's Ollama integration makes local model development as seamless as using a cloud provider: the same ChatClient, EmbeddingModel, and Advisor abstractions work identically.
Setup involves running the Ollama server and pulling a model:
brew install ollama # macOS
ollama serve # starts the local API server at http://localhost:11434
ollama pull llama3 # download Llama 3 (4-8 GB depending on quantisation)
ollama pull nomic-embed-text # download an embedding modelSpring Boot configuration:
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-ollama-spring-boot-starter</artifactId>
</dependency>spring.ai.ollama.base-url=http://localhost:11434
spring.ai.ollama.chat.options.model=llama3
spring.ai.ollama.embedding.options.model=nomic-embed-textOllama supports chat, embeddings, and streaming. For CI environments, Testcontainers provides an OllamaContainer that downloads and starts an Ollama Docker container with a specified model as part of the test lifecycle — enabling fully automated, offline AI integration tests without any external API credentials:
@Container
static OllamaContainer ollama = new OllamaContainer("ollama/ollama:latest")
.withModel("phi3:mini");
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
