MXP Platform

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)

MethodPathDescription
GET/healthService health check
POST/get_predictGet recommendations routed by page type and model
POST/evaluationSingle-model evaluation for A/B testing

edit_app (configuration)

MethodPathDescription
GET/healthService health check
POST/modelsCreate or update a recommendation model configuration
GET/modelsList recommendation model configurations for a tenant
POST/containersCreate or update a recommendation container
GET/containersList 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
}
FieldTypeRequiredDescription
tenantstringYesTenant identifier
pageTypestringYesPage context: home, pdp, cart, category, search
modelTypestringYesRecommendation model type (see model configuration)
contextobjectNoRequest context: current product, user, cart contents
sizeintegerNoNumber 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 typeDescription
similar_itemsProducts similar to a viewed item (collaborative or content-based)
frequently_bought_togetherItems commonly purchased together
recently_viewedPersonalized recently-viewed history
genericGeneric model — configurable for custom scoring strategies

Model configurations define training parameters, serving backends, and feature engineering pipelines managed in the edit_app.