API Reference#
Base URL: http://localhost:8080/api/v1 (default).
GET /health#
Checks the liveness status of the service and reports the current VLM backend state.
Response#
{
"status": "healthy",
"service": "semantic-search-agent",
"version": "2026.1.0",
"vlm_backend": "ovms",
"vlm_status": "connected",
"uptime_seconds": 42.5
}
Field |
Type |
Description |
|---|---|---|
|
string |
Always |
|
string |
Service name. |
|
string |
Service version. |
|
string |
Configured VLM backend ( |
|
string |
|
|
float |
Seconds since the service started. |
POST /compare/order#
Compares a list of expected items against detected items to identify missing, extra, and quantity-mismatched products. Uses the configured matching strategy (exact, semantic, or hybrid).
Request Body (JSON)#
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
array of |
Yes |
Items that should be present with their expected quantities. |
|
array of |
Yes |
Items detected by the vision pipeline. |
|
|
No |
Optional matching behavior overrides. |
ItemModel
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Item name. |
|
integer |
Yes |
Item quantity (≥ 1). |
ComparisonOptions
Field |
Type |
Default |
Description |
|---|---|---|---|
|
boolean |
|
Enable semantic matching for items not matched exactly. |
|
boolean |
|
Try exact match before semantic (always true in engine). |
|
boolean |
|
Case-insensitive text normalization. |
Examples#
Basic Order Validation:
curl -X POST http://localhost:8080/api/v1/compare/order \
-H "Content-Type: application/json" \
-d '{
"expected_items": [
{"name": "apple", "quantity": 3},
{"name": "milk", "quantity": 2},
{"name": "bread", "quantity": 1}
],
"detected_items": [
{"name": "apple", "quantity": 3},
{"name": "whole milk", "quantity": 2},
{"name": "orange juice", "quantity": 1}
]
}'
Response#
{
"status": "mismatch",
"validation": {
"missing": [
{"name": "bread", "quantity": 1}
],
"extra": [
{"name": "orange juice", "quantity": 1}
],
"quantity_mismatch": [],
"matched": [
{
"expected": {"name": "apple", "quantity": 3},
"detected": {"name": "apple", "quantity": 3},
"match_type": "exact",
"confidence": 1.0
},
{
"expected": {"name": "milk", "quantity": 2},
"detected": {"name": "whole milk", "quantity": 2},
"match_type": "hybrid_semantic",
"confidence": 0.92
}
]
},
"metrics": {
"total_expected": 3,
"total_detected": 3,
"exact_matches": 1,
"semantic_matches": 1,
"processing_time_ms": 245.3
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
array |
Expected items with no detected match. |
|
array |
Detected items with no expected match. |
|
array |
Items where names matched but quantities differ. |
|
array |
Successfully matched item pairs with match type and confidence. |
|
integer |
Count of items resolved by exact string matching. |
|
integer |
Count of items resolved by semantic VLM matching. |
|
float |
Total processing time in milliseconds. |
POST /compare/inventory#
Checks whether a list of item names exist in the inventory, using exact or semantic matching.
Request Body (JSON)#
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
array of strings |
Yes |
Item names to look up in inventory. |
|
array of strings |
No |
Explicit inventory list. Uses |
|
|
No |
Optional matching behavior overrides (same as |
Examples#
Inventory Check:
curl -X POST http://localhost:8080/api/v1/compare/inventory \
-H "Content-Type: application/json" \
-d '{
"items": ["apple", "cola bottle", "bread loaf"],
"inventory": ["apple", "coca cola 500ml", "bread", "milk"]
}'
Response#
{
"results": [
{
"item": "apple",
"match": true,
"matched_inventory_item": "apple",
"match_type": "exact",
"confidence": 1.0
},
{
"item": "cola bottle",
"match": true,
"matched_inventory_item": "coca cola 500ml",
"match_type": "hybrid_semantic",
"confidence": 0.91
},
{
"item": "bread loaf",
"match": true,
"matched_inventory_item": "bread",
"match_type": "hybrid_semantic",
"confidence": 0.88
}
],
"summary": {
"total_items": 3,
"matched": 3,
"unmatched": 0,
"processing_time_ms": 312.7
}
}
POST /compare/semantic#
Performs a generic semantic comparison between two arbitrary text strings using the configured VLM backend.
Request Body (JSON)#
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
First text string (treated as the “expected” item). |
|
string |
Yes |
Second text string (treated as the “detected” item). |
|
string |
No |
Domain context passed to the VLM prompt. Default: |
Examples#
Semantic Comparison:
curl -X POST http://localhost:8080/api/v1/compare/semantic \
-H "Content-Type: application/json" \
-d '{
"text1": "green apple",
"text2": "apple",
"context": "grocery products"
}'
Response#
{
"match": true,
"confidence": 0.92,
"reasoning": "YES",
"match_type": "semantic"
}
Field |
Type |
Description |
|---|---|---|
|
boolean |
|
|
float |
Confidence score between 0.0 and 1.0. |
|
string |
Raw VLM response ( |
|
string |
Always |
GET /metrics#
Prometheus-compatible metrics endpoint. Available on port 9090 by default (configurable via METRICS_PORT).
curl http://localhost:9090/metrics
Key metrics exposed:
Metric |
Type |
Description |
|---|---|---|
|
Counter |
Total requests per endpoint, method, and status code. |
|
Counter |
Total match operations per match type and result. |
|
Histogram |
Request latency per endpoint and method. |
|
Histogram |
VLM inference latency per backend. |
|
Counter |
Total cache hits per operation type. |
|
Counter |
Total cache misses per operation type. |
|
Gauge |
VLM backend availability (1 = available, 0 = unavailable). |