- spring-ai-starter-model-ollama autoconfigures ChatModel/EmbeddingModel from spring.ai.ollama.* properties alone; no API key anywhere in this module. - org.testcontainers:ollama and org.testcontainers:junit-jupiter were both renamed in the Testcontainers 2.x line -- to org.testcontainers:testcontainers-ollama and org.testcontainers:testcontainers-junit-jupiter respectively -- confirmed by reading the real testcontainers-bom-2.0.5.pom that Spring Boot 4.1.1 imports (spring-boot-dependencies -> testcontainers.version=2.0.5). The pre-rename artifact IDs still exist on Maven Central but are stuck on the 1.x line. - Unlike every other module in this series, tests drive a real local model (qwen2.5:0.5b chat, all-minilm embeddings) via a Testcontainers-managed OllamaContainer started from a baked image (scripts/bake-image.sh), not a ScriptedChatModel -- the whole point of this post is a real model answering a real prompt. - LocalChatAndEmbeddingTest forces a genuine cold state with Ollama's keep_alive: 0 option (set via ChatModel.call(Prompt) -- ChatClient.options() does not carry a keepAlive override through to the request in this version) and confirms the unload actually happened via /api/ps before measuring a reload, rather than trusting whichever call happens to run first. - On this quiet sandbox host, even a confirmed-cold reload of the 500MB model came back in single-digit milliseconds once the underlying image layers were cached -- eval (generation) time dominates total latency here, not loading. Captured, not asserted as universal: readers get scripts/bake-image.sh to get their own numbers. - Embedding dimension (384, all-minilm) asserted deterministically. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FtpJvZfg4nvLvtzgJTDWpB
16 lines
617 B
Bash
Executable File
16 lines
617 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Regenerates every file under output/ -- the test suite writes each one itself via the
|
|
# Transcript helper, overwriting it in place. Unlike every other module in this series, this
|
|
# one needs Docker and the baked image from scripts/bake-image.sh: these tests start a real
|
|
# container running a real small model, not a scripted one.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
if ! docker image inspect ollama-baked-qwen05b-minilm:local >/dev/null 2>&1; then
|
|
echo "Image ollama-baked-qwen05b-minilm:local not found -- run scripts/bake-image.sh first." >&2
|
|
exit 1
|
|
fi
|
|
|
|
rm -rf target
|
|
mvn -q -o test
|