"""AI Labs — the employee-facing playground over the org's Qwen tenancy. Helix already pays for a DashScope / Bailian tenancy (the AI/LLM connector that drives the support copilot, the intelligence briefs and the AI-spending summaries). This domain wraps that same tenancy in a surface every employee can open, so the capability is available to all ~500 people rather than only to the flows that happen to embed it. Surfaces -------- * **Chat** — streaming multi-turn conversation over the catalogue's chat models, with optional image and document attachments. Server-Sent Events, because a thinking model's answer takes tens of seconds to complete and buffering it reads as a hang. * **Generations** — a durable job per artifact: text-to-image, image editing, text/image-to-video, text-to-speech and speech-to-text. Every job is executed in the background and its result is re-homed into Helix's own S3 bucket, because DashScope's result links expire ~24h out. * **Translate** — a single synchronous call against the dedicated translation model. Two product promises are load-bearing and constrain the code ------------------------------------------------------------ 1. **Helix does not read what employees write here.** There is no admin endpoint anywhere in this domain that returns message content, a prompt, or a generated artifact. Admin surfaces read :class:`~app.domains.ai_labs.models.AiLabUsageDaily`, which holds counters only. Audit rows record who / when / which capability / which model / how many tokens — never the text. Deleting a conversation is a hard delete, cascading to its messages and to the S3 objects. 2. **Helix does not touch the employee's prompt.** No system message is injected, no rewriting, no grounding, no tool calls. What the employee types is what the vendor receives, verbatim. This is asserted by a test (``test_prompt_passthrough_contract``) rather than left to reviewer vigilance, because it is the kind of invariant a later "small improvement" erodes silently. Where the code lives -------------------- * :mod:`app.domains.ai_labs.catalog` — every model id, parameter option and limit, in code. Each entry carries the date it was verified against the live endpoint; ``server/scripts/verify_ai_labs_catalog.py`` re-checks the whole catalogue against the configured key. * :mod:`app.domains.ai_labs.models` — four tables (``ai_labs_*``). * :mod:`app.domains.ai_labs.service` — conversation + generation lifecycle. * :mod:`app.domains.ai_labs.executor` — the background job runner shared by the request path and the reaper cron. * :mod:`app.domains.ai_labs.quota` — per-person daily ceilings, unlimited by default. * :mod:`app.domains.ai_labs.router` — employee + admin HTTP surfaces. The vendor clients themselves are shared platform pieces and live with the Bailian connector: :mod:`app.domains.bailian.llm_client` (chat, streaming) and :mod:`app.domains.bailian.media_client` (images, video, speech). """