title: Poor Man's Interaction Models
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
fullWidth: true
Laguna Anticipatory Chat Demo
Tiny Docker Space for the anticipatory chat demo. The browser only talks to the
local Space server; PRIME_API_KEY and any optional access controls are read
from Space secrets on the server.
Modes:
- Non-interactive: waits for Enter, then generates with
LAGUNA_BASE_MODEL. - Interactive: predicts user completion and assistant response with
LAGUNA_BASE_MODEL. - Interactive RL: same interactive prompt, routed to
LAGUNA_RL_MODELwhen set, otherwiseLAGUNA_BASE_MODEL:LAGUNA_RL_CHECKPOINT_ID.
Interactive modes add <|silence|> to the model-visible user turn every 500ms
after the user stops at a completed word boundary. The tokens are kept in the
conversation history sent back to the model, but hidden in the browser UI.
The UI reports average TTFT and average accuracy. Accuracy is scored as
1 / interactive_inference_calls per committed interactive turn: one
prediction is 100%, two resynthesis calls is 50%, and so on.
Required Space Secrets
PRIME_API_KEY: Prime Intellect inference API key.
For a private organization Space, set DISABLE_APP_AUTH=1 and rely on
Hugging Face repository permissions. If the Space is not private, also set:
ACCESS_CODES: comma-separated or newline-separated demo access codes.SESSION_SECRET: required random secret used to sign auth cookies.
Optional Variables
LAGUNA_BASE_MODEL: base Laguna model used by Non-interactive and Interactive modes, defaults topoolside/Laguna-XS.2.LAGUNA_RL_MODEL: full model id for Interactive RL mode. When unset, the app uses the deployed adapterpoolside/Laguna-XS.2:b6dx32frg4opcixaq4jgq0py.LAGUNA_RL_CHECKPOINT_ID: LoRA checkpoint id for Interactive RL mode, defaulting to checkpointau1xd3gbqhij4dgi438jp9cg(step 45 fromanticipatory-chat-laguna-xs2-structured-stage1-easy-h0). This value must be a checkpoint id, not a run id likes50.... Set this as a Space secret to swap deployed checkpoints without code changes. For compatibility, the app maps the known run ids50rbs1ixegeqszfknp8r9ufand checkpoint idau1xd3gbqhij4dgi438jp9cgto deployed modelpoolside/Laguna-XS.2:b6dx32frg4opcixaq4jgq0py.LAGUNA_RL_ADAPTER_ID: legacy alias forLAGUNA_RL_CHECKPOINT_ID.PRIME_MODEL: legacy alias forLAGUNA_RL_MODEL.PRIME_API_BASE_URL: defaults tohttps://api.pinference.ai/api/v1.PRIME_CONFIG_PATH: optional local-dev fallback path, defaulting to~/.prime/config.jsonwhenPRIME_API_KEYis not set.DISABLE_APP_AUTH: set to1for private Hugging Face org Spaces where HF permissions already gate access.MAX_TOKENS: defaults to512.MAX_HISTORY_MESSAGES: defaults to24.MAX_HISTORY_CHARS: defaults to12000.INFERENCE_TIMEOUT_SECONDS: defaults to60.SESSION_TTL_SECONDS: defaults to43200.
Local Run With Prime
cd spaces/laguna-anticipatory-demo
DISABLE_APP_AUTH=1 ../../.venv/bin/python -m app.main
This uses PRIME_API_KEY when set, otherwise it falls back to
~/.prime/config.json for local development. The real Prime path uses the
OpenAI Python client, matching the environment-generation tooling.
Offline UI Smoke Run
cd spaces/laguna-anticipatory-demo
DISABLE_APP_AUTH=1 DEMO_OFFLINE_MODE=1 python -m app.main
Then open http://127.0.0.1:7860.
Offline mode only verifies auth, SSE, and UI behavior; it does not call Laguna.