From 9d57eae9cfbe227323d37561d8351098b51c4795 Mon Sep 17 00:00:00 2001 From: Alex Harrison Date: Thu, 24 Sep 2026 04:19:05 -0600 Subject: [PATCH] Activities guide: both inference request shapes, intensity, rest_day, brick segments Matches fuel-backend #954: activity_name/source_type/device are accepted alongside title/workout_type, responses carry activity_type and segments next to type and sub_types, lift answers carry intensity (1-3, lift's levels on the 1-9 scale), rest days come back rest_day true, and an unreachable inference service is a 502 that is not counted as usage. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01X5MzUWe9V7E6etCRacGHCb Ci-From: linux Ci-Session: 66b38ef5-cd79-4bf7-9ff3-846a159ee7bc --- guides/activities.mdx | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/guides/activities.mdx b/guides/activities.mdx index 07371a4..e9154c6 100644 --- a/guides/activities.mdx +++ b/guides/activities.mdx @@ -227,13 +227,31 @@ Response: ```json { + "activity_type": "run", "type": "run", - "confidence": 0.95 + "confidence": 0.95, + "request_id": "req_4f2a9c1e7b30" } ``` -`type` is one of the seven activity keys or `"unknown"`. Inference never fails the request: when the model is unavailable or the evidence is too thin, you get `"unknown"` with `confidence: 0`, so branch on the type rather than on an error. +`activity_type` is one of the seven activity keys or `"unknown"`, and `type` carries the same value. When the model is unavailable or the evidence is too thin, you get `"unknown"` with low or zero confidence rather than an error, so branch on the type. A `502` means the inference service itself could not be reached; it is not counted as usage, so retry with backoff. -Sending more than a title sharpens the result. The endpoint also reads `pre_activity_comment`, `workout_type` (your provider's own coarse type), `velocity` in m/s, `has_power`, and `cadence`, and those structured signals resolve most cases before the model is consulted. +Sending more than a title sharpens the result. The endpoint also reads `pre_activity_comment`, `workout_type` (your provider's own coarse type), `tss_calculation_method`, `structure_summary`, `velocity` in m/s, `has_power`, and `cadence`, and those structured signals resolve many cases before the model is consulted. The API reference names two of these differently, and both spellings work: `activity_name` is `title`, and `source_type` is `workout_type`. You can also send `device`, the recording device's name. -For multi-sport titles like "Bike/run brick", use `POST /v1/infer/brick-types`. It returns `sub_types` (for example `["bike", "run"]`) with a single `confidence`, and you create one activity per leg. +A strength session also carries `intensity`: `1` light, `2` medium, `3` heavy. Lift uses levels 1-3 of `intensity_level`, so pass the value unchanged as `intensity_level` when you create the lift activity; rescaling it onto 1-9 raises the carbohydrate ceiling. An entry that marks a day with no training, such as "Rest day", comes back with `"rest_day": true` and type `"unknown"`; it is not a workout to create. + +For multi-sport titles like "Bike/run brick", use `POST /v1/infer/brick-types`. It takes the same fields plus an optional `segments` list of the legs you already know, in order, and returns every leg in order: + +```json +{ + "segments": [ + {"activity_type": "bike", "order": 1}, + {"activity_type": "run", "order": 2} + ], + "sub_types": ["bike", "run"], + "confidence": 0.9, + "request_id": "req_8d51e0b2c7a4" +} +``` + +`sub_types` is the same list without the order numbers. Create one activity per leg.