Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/viet2811/uk-travel-recommendation/llms.txt

Use this file to discover all available pages before exploring further.

The Bulk Like endpoint is designed for the onboarding flow, where a new user indicates attractions they have already visited before they start swiping on the Discovery screen. Rather than calling the single Like endpoint repeatedly, the client sends a single list of attraction IDs and the server processes them all atomically — summing the MHE category vectors and averaging the embedding vectors across every new attraction in the batch, then applying one combined update to the user’s preference profile. This batched averaging prevents the early interactions of an active onboarding user from over-fitting the profile toward a single attraction type.

Endpoint

FieldValue
MethodPOST
Path/api/recommendations/like/bulk/
AuthBearer token required
POST http://localhost:8000/api/recommendations/like/bulk/
Authorization: Bearer <access_token>
Content-Type: application/json

Request Body

{
  "ids": ["<attraction_id_1>", "<attraction_id_2>", "<attraction_id_3>"]
}
ids
array
required
An array of attraction ID strings to like in bulk. Each string must match the id field of an existing attraction (as returned by the Search or List Recommendations endpoints).Attractions that the user has already interacted with (liked or disliked) are silently skipped. If all provided IDs have already been interacted with, the endpoint returns a 400 error.Example: ["tower-of-london", "edinburgh-castle", "st-fagans"]

Profile Update Logic

The bulk like update differs from the single like update in how it aggregates multiple attractions:
  1. Collect new attractions — For each ID, a UserInteraction record is created with liked=True. Only newly created interactions contribute to the profile update; IDs the user already interacted with are skipped.
  2. Sum MHE vectors — The labelMHE vectors of all new attractions are summed together.
  3. Average embedding vectors — The labelEmbed and summaryEmbed vectors are averaged across all new attractions.
  4. Initialisation path — When isInitialising=True (the user has no prior interactions at all before this bulk call), the MHE update uses a factor of (1 - MHE_ALPHA) = 0.8 instead of the standard MHE_ALPHA = 0.2: profile.labelMHE += avgMHE * 0.8. Within this path, if the profile embeddings are still zero-filled (emptyEmbedding=True), the averaged embedding vectors are written directly as the initial profile embeddings. Otherwise, a higher blending alpha of 0.6 is used: profile.labelEmbed = (0.6 * avgLabelEmbed) + (0.4 * profile.labelEmbed).
  5. Standard path — When prior interactions exist, the profile is updated via the same _update_profile method used by the single Like endpoint (MHE_ALPHA = 0.2, LABEL_EMBED_ALPHA = 0.15, SUMMARY_EMBED_ALPHA = 0.1).
  6. Delta computation — The profile_delta (cosine distance before vs. after) is computed and stored on the last attraction’s interaction record only.
This endpoint does not log an ILD score. For individual swipe interactions during normal app usage, use the single Like and Dislike endpoints, which apply per-item learning rates, store individual deltas, and log ILD every 10 interactions.

Response

200 OK — Bulk like recorded successfully

{
  "message": "Preferences updated"
}
message
string
Confirmation string. Always "Preferences updated" on success.

400 Bad Request — All attractions already added

Returned when every ID in the ids array corresponds to an attraction the user has already interacted with, leaving no new attractions to process.
{
  "message": "Attraction already added"
}
message
string
Error message. "Attraction already added" indicates all provided IDs were pre-existing interactions.

Examples

curl -X POST "http://localhost:8000/api/recommendations/like/bulk/" \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "ids": [
      "tower-of-london",
      "edinburgh-castle",
      "st-fagans-national-museum",
      "giant-causeway",
      "lake-district"
    ]
  }'

Build docs developers (and LLMs) love