Recommendations API
Recommendation System predict_app REST endpoints for real-time recommendation inference
The predict_app service serves real-time recommendations. It is a FastAPI application (default port 8084). The companion edit_app service (port 8080) manages model configurations and training data.
Endpoints
predict_app (inference)
| Method | Path | Description |
|---|---|---|
GET | /health | Service health check |
POST | /get_predict | Get recommendations routed by page type and model |
POST | /evaluation | Single-model evaluation for A/B testing |
edit_app (configuration)
| Method | Path | Description |
|---|---|---|
GET | /health | Service health check |
POST | /models | Create or update a recommendation model configuration |
GET | /models | List recommendation model configurations for a tenant |
POST | /containers | Create or update a recommendation container |
GET | /containers | List recommendation containers for a tenant |
POST /get_predict
Returns recommendations routed by page type (e.g., home page, product detail page, cart page) and model type.
Request body
{
"tenant": "my-tenant",
"pageType": "pdp",
"modelType": "similar_items",
"context": {
"productId": "SKU-12345",
"userId": "user-abc"
},
"size": 10
}| Field | Type | Required | Description |
|---|---|---|---|
tenant | string | Yes | Tenant identifier |
pageType | string | Yes | Page context: home, pdp, cart, category, search |
modelType | string | Yes | Recommendation model type (see model configuration) |
context | object | No | Request context: current product, user, cart contents |
size | integer | No | Number of recommendations to return (default: 10) |
Response
{
"recommendations": [
{ "productId": "SKU-99001", "score": 0.95 },
{ "productId": "SKU-99002", "score": 0.87 }
],
"modelUsed": "similar_items_v2",
"tenant": "my-tenant"
}POST /evaluation
Evaluates a single recommendation model, used for A/B testing and quality checks.
Request body
{
"tenant": "my-tenant",
"modelType": "similar_items",
"evaluationData": { ... }
}Recommendation models
The Recommendation System supports multiple model types configured via edit_app. Model configurations are stored per-tenant in GCS:
| Model type | Description |
|---|---|
similar_items | Products similar to a viewed item (collaborative or content-based) |
frequently_bought_together | Items commonly purchased together |
recently_viewed | Personalized recently-viewed history |
generic | Generic model — configurable for custom scoring strategies |
Model configurations define training parameters, serving backends, and feature engineering pipelines managed in the edit_app.