Skip to content

Tracked users: client.events.track and .list, user_id= on complete and sections - #52

Open
bruel-gabrielsson wants to merge 1 commit into
devfrom
feat/user-id-and-events
Open

bruel-gabrielsson wants to merge 1 commit into
devfrom
feat/user-id-and-events

Conversation

@bruel-gabrielsson

Copy link
Copy Markdown
Contributor

Lets a site record its users' events with the SDK and get results from those stored histories, instead of sending the history on every call.

  • client.events.track(user_id, event, catalog_id=, timestamp=) posts to /v1/events and returns the event id. An Order is sent as the API stores it, with a cart_id (generated if not given) and unit_selling_price 0. A naive timestamp is refused.
  • client.events.list(user_id=, limit=, types=) reads GET /v1/events/own, which returns only the calling account's events (Unbox-AI/unbox-api#590).
  • complete(user_id=...) and sections(user_id=...) send user_id with no history. The only event allowed alongside it is the current Search, which is recorded as the user's event by default (register_event=False turns that off). Without user_id, nothing is recorded unless register_event=True, as before.
  • history now defaults to empty, so client.complete(user_id="u1") works.
  • The async client gets the same methods.

The server side is on deploy/behaviorgpt in unbox-api and is off by default (EVENTS_SCOPED_TO_ACCOUNT, EVENTS_PUBLISHABLE_KEYS, features.events). These calls return errors until it is turned on for the BehaviorGPT deployment, so hold the release until then.

Tests: 19 new in tests/test_events.py; all 192 pass; ruff clean.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant