Skip to main content
A context is one place in your product where recommendations appear: a homepage feed, a “similar items” rail on a listing page, a basket upsell, an email digest. Your application sends the context’s ID with each request, and everything about how that placement behaves is configured here, without a code change. Open Relevance → Contexts.

What a context controls

Item eligibility filters, such as “only in-stock items” or “only this category”, are filter rules in the Rules Engine, scoped to the context. Keeping them there gives each context one place for all of its business logic.

The contexts table

Each row shows the context’s name and description, its model, whether a recipe and pipeline are attached, how many rules apply to it, and when it last changed. Search by name at the top. Select a row to open the editor. Contexts can be arranged in groups for pages that show several rails together. Drag a context onto a group, or between rails in a group to set their priority.

Create a context

1

Start a new context

Select New Context. The editor opens as a panel on the right.
2

Choose a template

Use the template menu at the top right to start from a complete setup, or choose Build from scratch for a blank recipe. A template fills in the model, ranking and safety settings together; you can change any of them afterwards.
3

Name it

On Details, give it a name people will recognise, such as “Listing page - similar items”, and an optional description.
4

Review the recipe

Check the Inputs, Ranking and Safety tabs. A dot on a tab means it has non-default settings.
5

Create it

Select Create Context. The context gets a numeric ID, shown in the table, which you pass as context_id.
6

Enable it

Use the switch in the editor header to enable the context and its pipeline. A context needs a saved recipe before it can be enabled.

Templates

Reference algorithms reproduce the published ranking approaches of well-known social feeds (For You, home feed and short-video styles). They come with a pack of rules, such as author caps, topic diversity and fatigue on skipped topics. They are useful starting points for feed-style products. Applying a template creates its rules. Re-applying one later keeps any rules you have edited.

Details

Recipe

The recipe is the context’s ranking strategy. It is split across three tabs.

Inputs

Candidate sources decide where candidates come from, and what share of the candidate pool each one fills. The bar shows the mix. Ranking features lists the facets the ranker computes user affinity over, such as category, genre or brand: the first non-empty field on each item wins. User topic affinity, predicted score, item freshness and impression fatigue are always used. Event weights shows each event type’s weight and polarity as set on the Events page. Change a value here to override it for this context only; Reset returns it to the global value.

Ranking

Reranking sets the objectives for an optional reranker that reorders the top of the list using a language model or cross-encoder: relevance, diversity, freshness and policy, either from a preset (Balanced, Discovery, Personalised, Compliance) or custom weights. Discovery controls how much room is given to the unexpected:

Safety

Seen items: turn on Don’t re-show seen items to exclude items this context has already served to a user, matched across sessions and devices. Look-back window sets how long an item stays excluded: 24 hours, 7, 30 or 90 days, or forever. Choose a shorter window for small catalogues so the placement does not run dry. Guardrails stop one thing taking over a session: Readiness checks the context before it serves: activation, live retrieval sources, metadata guardrails, events, explanation replay and experiment setup. Fix anything marked as blocked. Recipe management removes the recipe while keeping its pipeline and rules.

Use the context in your code

Pass the context’s ID with each request:
For the website embed, choose the context per placement in Website embed. A workspace also has a default context, used by strips that do not name one.

Before you send traffic

  • The model is intentional, and shows as serving.
  • The recipe’s sources are live, not just stored.
  • filter rules exclude anything that must never appear, such as unavailable items.
  • Readiness has nothing blocked.
  • A few real users and items look right in Explainability.
See Launch a placement for the full checklist, including a staged rollout.