diff --git a/CLAUDE.md b/CLAUDE.md index 366d0f4..edfcf71 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -147,6 +147,10 @@ every change; they are enforced by this list. 7. `serving/config.pbtxt` and `serving/model.py` in this tree *are* the deployed files — the trainer overwrites them in S3 on every run. A bad import in `serving/model.py` breaks every model in the bucket, including ones that were not retrained. + `config.pbtxt` declares an optional `context` input that `model.py` does not read: the feed API + sends it on every SERP with a country/region/type filter, and Triton rejects a request naming an + undeclared input, so removing the declaration fails every filtered feed request (it did, between + 2026-08-14 and this note). Drop it only after the API stops sending it. 8. `Strategy` declares what a model MAY emit; `api/docs/DEBUG_INFO_CODEC.md` owns the published vocabulary and its numeric ids, which are append-only and never renumbered. The two are NOT the same set: the codec has rows with no member here (`popular`/8, `random`/9, and since 2026-08-25 diff --git a/smartrec-client/smartrec_client/triton_client.py b/smartrec-client/smartrec_client/triton_client.py index 08eb78e..eeb0c1f 100644 --- a/smartrec-client/smartrec_client/triton_client.py +++ b/smartrec-client/smartrec_client/triton_client.py @@ -120,8 +120,10 @@ def recommendations_triton_with_client( :param filter_viewed: Whether to filter viewed items. :param items_to_recommend: Optional list of items to restrict recommendations to. :param history: Optional list of item IDs from user's interaction history (for warm/new users). - :param context: Optional request context (e.g. {"country": ...}); only consumed by - models whose Triton config declares a "context" input (the orchestrator). + :param context: Optional request context (e.g. {"country": ...}). Sent as a + "context" input when non-empty. No served model reads it today; the input + stays declared in serving/config.pbtxt because Triton rejects a request + naming an input the model config does not declare. :return: Dictionary with model version, data, and strategy. """ diff --git a/smartrec-lib/smartrec_lib/serving/config.pbtxt b/smartrec-lib/smartrec_lib/serving/config.pbtxt index f5485a5..82c5b05 100644 --- a/smartrec-lib/smartrec_lib/serving/config.pbtxt +++ b/smartrec-lib/smartrec_lib/serving/config.pbtxt @@ -31,6 +31,16 @@ input [ dims: [ -1 ] optional: true }, + { + # Declared but not read by model.py. The feed API sends it whenever a SERP + # carries a country/region/type filter, and Triton rejects a request that + # names an input the config does not declare - so dropping this line fails + # every filtered feed request. Keep it until the API stops sending it. + name: "context" + data_type: TYPE_STRING + dims: [ 1 ] + optional: true + }, { name: "top_n" data_type: TYPE_INT32