Create a Monologue with AI¶
1. Install optional integrations¶
python -m venv .venv
source .venv/bin/activate
pip install -e ".[ai,server,dev,docs]"
PowerShell:
py -m venv .venv
.venv\Scripts\Activate.ps1
pip install -e ".[ai,server,dev,docs]"
2. Configure credentials¶
Never write the key into the repository.
export OPENAI_API_KEY="..."
export QLENS_AI_MODEL="YOUR_APPROVED_MODEL"
3. Create the publication contract¶
qlens publication new \
--title "বি কী সম্পর্ক প্রকাশ করে?" \
--space RSP-000001 \
--source QST-000001 \
--source EVD-000001 \
--source OBS-000001 \
--source RSN-000001 \
--source UND-000001 \
--format monologue \
--language bn \
--audience general \
--voice first_person
4. Inspect the exact AI context¶
qlens publication trace PUB-000001
5. Generate a governed AI draft¶
qlens publication ai-draft PUB-000001 \
--provider openai \
--actor Mamun
For an offline deterministic test:
qlens publication ai-draft PUB-000001 --provider mock
The command writes versioned JSON, Markdown, and source-context files under generated/publications/drafts/pub-000001/ and changes the publication to needs_review.
6. Use the NUR button¶
Start the local API:
qlens serve --host 127.0.0.1 --port 8765
In another terminal:
mkdocs serve
Open Research Workspace → Publications and select Generate AI draft. Browser JavaScript sends only the publication OID to the local QLens service. The OpenAI key never enters NUR.
7. Review and publish¶
qlens publication review PUB-000001 \
--decision approve \
--reviewer Mamun \
--note "Claims, uncertainty, pronunciation, and sources checked" \
--signature "mamun-approved-v1"
qlens publication publish PUB-000001 \
--publisher Mamun \
--signature "mamun-published-v1"
Only the explicit publish command copies the approved monologue into docs/publications/ for NUR/MkDocs.
Security and governance¶
- Bind the local API to
127.0.0.1unless you deliberately secure it. - Do not commit
.envfiles or credentials. - Inspect
source_context_pathto see exactly what left the repository. - Inspect
structured_draft_pathfor section-level OID citations. - Regenerate and repeat review whenever source research changes.