This project implements a semantic search API for product-related data using:
- Spring AI
- Ollama as the local LLM/embedding provider
- Milvus as the vector store backend
- Structured product data (e.g. title, description, features, price, category)
- 🔍 Semantic product search over embedded documents
- 💬 Chat-style querying with structured JSON responses
- ⚙️ Embedding generation endpoint
- 📦 Integration with Milvus for vector similarity search
- 🧠 Uses Ollama models locally (e.g.,
mxbai-embed-large
,llama3.2
)
Component | Tool / Library |
---|---|
LLM & Embeddings | Ollama (llama3.2 , mxbai-embed-large ) |
Embedding store | Milvus vector DB |
Framework | Spring Boot + Spring AI |
REST API | Spring MVC (@RestController ) |
Data Format | JSON |
- Java 17+
- Docker (for running Milvus)
- Ollama installed and running locally
brew install ollama
# Pull models
ollama pull mxbai-embed-large
ollama pull llama3.2
# Check available models
ollama ls
docker-compose up -d
mvn spring-boot:run
Request:
curl --location 'http://localhost:8080/api/ollama/chat?query=Captial%20of%20Vietnam'
Response:
{
"answer": "Hanoi"
}
Request:
curl --location 'http://localhost:8080/api/ollama/embedding?query=smartphone'
Response:
{
"embedding": [
-0.018574331,
-0.05374644,
-0.05071582,
...]
}
Request:
curl --location 'http://localhost:8080/api/ollama/search?query=headphone'
Response:
{
"title": "Bluetooth Wireless Earbuds",
"description": "Noise-canceling earbuds with up to 30 hours battery life and fast charging support. Sweat and water-resistant.",
"price": "$49.99",
"category": "Electronics",
"features": "Touch controls, Charging case, Bluetooth 5.3, Built-in microphone"
}
- If you have any questions, please open an issue on GitHub or contacting me via email: ducan1406@gmail.com.