← Evidence Lab

Evidence Lab release

Evidence Lab v1.6.2 — Brief length targets and per-document citations, switchable third-party services, content moderation

Evidence Lab v1.6.2 is a Brief release: sections can be written to a length target that is enforced rather than merely requested, citations can be grouped one number per document with the numbering flowing through the prose and the Word export, and the Word export now mirrors the on-screen References exactly and shows each document’s year. Heatmapper and Search filters now do what the filter panel says, and large grids no longer fail on rate limits. Every optional third-party service is now switchable and has an open alternative: translation can run on LibreTranslate or the deployment’s own LLM, LLM tracing can go to OpenTelemetry instead of LangSmith, and web analytics loads from a provider module. Administrators can now hide a document from the whole platform when it breaches the new content policy, and the Terms and Privacy pages carry an explicit content policy and a GDPR statement. Under the hood, large API responses are compressed without stalling event streams, the API image stops downgrading FastAPI, and the pipeline scanner is safe to re-run over refreshed data. The pipeline also stops losing Word documents: every .doc and .docx was being indexed with no text and still recorded as indexed, so it answered no search while looking perfectly healthy.

Brief

  • Added Section length: choose Short (~150), Standard (~350) or Long (~700) words per section, a custom count, or no target — on the start screen and the New-brief modal, for the whole brief in AI Regenerate All, or per section in its research panel; the target is saved with the brief and can be set as a team default. The research prompt asks for that length in place of its “at least 3-4 paragraphs” default, the model’s output limit rises to fit long targets, and a section that comes back more than a quarter over its target is condensed with an AI edit that keeps every citation; each section shows its word count and the brief its total (#478)
  • Added Group by document (single per document) above the References list, giving each document one citation number and no page numbers, with the inline [n] markers renumbered to match; the existing toggle is renamed Group by document (multiple per document). Clicking a document-level reference opens its first cited passage, and hovering an inline number still shows the passage behind that claim (#477)
  • Export to Word now writes a single References section laid out per the on-screen grouping — previously the document carried two — and the grouped rows read exactly as on screen (Title, [1] p. 26, [2] p. 40, each number and page linked to its cited page) (#477)
  • The start screen’s three action buttons share one line and wrap cleanly on narrow windows instead of stranding Load a saved brief on the right (#477)
  • Export to Word adds each cited document’s publication year after its title in the References list, in all three layouts (1. Title, 2021, p.26); the year is looked up once per document from the brief’s own data source, and a document that cannot be resolved is exported without one (#481)

Search & Heatmapper

  • Fixed Heatmapper and Search filters that did not behave as the filter panel suggested: a language filter matching no documents now returns nothing instead of everything, region and multi-select filters in attribute mode match "; "-joined multi-valued payloads and comma-containing titles, multi-valued country/theme payloads are expanded so a Kenya filter finds every Kenya document, Clear filters and the mobile badge use the heatmap’s own state, and the sensitivity cutoff is pinned once set so filter-only re-runs keep the same threshold and excluded documents really empty their cells; narrowing a taxonomy axis (for example SDGs) to a few values now reduces the grid (#479)
  • Fixed Heatmapper cells failing to load: the multi-value filter expansion no longer 500s on sources whose filter fields have no Qdrant payload index (it reads the collection’s payload schema once per request), rate-limited (429) and transient gateway (502/503/504) cell requests are retried honouring the new Retry-After header, the failure message says how many cells failed and why, and document-level filter resolution runs in the threadpool so parallel cells no longer stall other requests (#482)

Optional third-party services

  • Translation provider is configurable. Search-result, AI-summary and document translation goes through a TranslationProvider interface chosen by TRANSLATION_PROVIDER: google (the previous behaviour, still the default), libretranslate (a self-hosted LibreTranslate server), llm (the deployment’s own configured model, with a new translate_system.j2 prompt) or off (translate endpoints answer 501). Reference protection and chunking are shared by every provider and now run in the threadpool instead of blocking the event loop (#485)
  • LLM tracing goes through a project-owned recorder. utils/tracing.py replaces the direct LangSmith wiring: TRACING_PROVIDER selects none, langsmith (hosted or self-hosted) or opentelemetry (spans over OTLP/HTTP to any collector, with one span per LLM call carrying model, run id and token counts). Trace links are built through the SDK’s public API instead of a private method, the user_activity.langsmith_trace_url column is renamed trace_url (migration 0033), and the link is now recorded on the activity row with the call’s usage (#486)
  • Web analytics loads from a provider module. The Google Analytics loader moves out of index.html into ui/frontend/src/utils/analytics.ts behind an AnalyticsProvider interface, so the Content-Security-Policy needs no inline-script hash; accepting the cookie banner loads analytics in place instead of reloading the page, and the Privacy page gains an Enable tracking link for visitors who declined (#489)
  • New admin docs page Optional Third-Party Services (in the in-app docs sidebar) lists each optional external service, how to turn it off, and its open alternative (#485, #486)

Content moderation, Terms & Privacy

  • Hide a document. Superusers see a Moderation column in the Documents Library with a Hide/Restore button; hiding asks for a reason and removes the document from Search, Document Search, title search, facet counts, the AI summary, the Research Assistant, Brief, Map cells and the MCP/A2A servers, and makes its document, PDF, thumbnail, chunk and highlight endpoints answer 404, while keeping it in the library (marked hidden) so it can be restored. Every action is written to the audit log with the reason and acting administrator. POST /moderation/documents/{doc_id}/hidden and GET /moderation/documents/hidden (superuser only) expose the same, and scripts/pipeline/hide_document.py gives deployments without the user module the same mechanism (#492)
  • The Terms of Service gain a Content policy defining prohibited content, the two reporting routes (a one-star rating with the reason in the comment, or the Feedback button for visitors without an account; and email) and how reports are triaged and acted on (#491)
  • The Privacy Policy gains a GDPR compliance section: data controller, legal basis per processing purpose, retention, data-subject rights including complaint to a supervisory authority, international transfers and safeguards (#490)
  • Deployment facts in the legal pages are configuration, not text. The operator name and address, hosting region, public site URL and contact email are set with REACT_APP_OPERATOR_NAME, REACT_APP_OPERATOR_ADDRESS, REACT_APP_HOSTING_REGION, REACT_APP_SITE_URL and REACT_APP_CONTACT_EMAIL and substituted into the Privacy Policy and Terms when they render; unset values fall back to the evidencelab.ai reference deployment (Astrobagel, the United States). Content Moderation becomes its own admin docs page with a report-handling checklist, and the README gains a “Deployment settings” table (#495)
  • The same deployment facts now reach every other place the app named its operator: the About, Technical Info and Data Sources pages, the Connecting to AI Platforms page (its MCP and A2A endpoint URLs are built from the site URL), the Contact dialog, and the deep links in the Word export of search results, which previously pointed at evidencelab.ai whatever the deployment. The docs sources carry {{OPERATOR}}, {{SITE_URL}}, {{CONTACT_EMAIL_LINK}} placeholders instead of literal values (#496)
  • The Customization & Branding admin page names its deployment-facts section for everything it covers (operator, contact, site URL and hosting region) and tabulates each variable with its default (#497)

API & Deployment

  • Large API responses are gzipped by a selective ASGI middleware that leaves text/event-stream and already-encoded responses untouched and flushes streamed files per chunk, so the assistant and AI-summary streams keep flowing; compression runs in the threadpool so the event loop keeps serving other requests. Settable with API_GZIP_ENABLED, API_GZIP_MIN_BYTES and API_GZIP_LEVEL (#476)
  • Aligned the backend requirement pins with the root file so the API image no longer downgrades FastAPI on build (the image now runs FastAPI 0.135.1, uvicorn 0.49.0, SQLAlchemy 2.0.49, Starlette 1.6.0, the versions CI tests), with a test that fails if a package pinned in both files ever differs again (#476)

Pipeline

  • Re-scanning a data source whose documents have changed is now safe: an existing document’s metadata is merged into its point instead of replacing it (keeping the document embedding, tags and duplicate flag), metadata changes propagate to every chunk’s search payload, and a changed file has its chunks removed and its status reset so it is parsed again (#475)
  • Fixed Word documents being indexed with no text. Chunk post-processing rebuilt each chunk’s text from its page elements, which are only built for provenance entries carrying a bounding box; a .doc or .docx has no page geometry, so the rebuild returned an empty string and discarded the text the chunker had produced, and the chunks then collapsed to one because de-duplication keys on page number and text. The chunker’s text is now kept whenever the rebuild contributes nothing. A document that indexed zero chunks is also no longer recorded as indexed — it now fails, so it is visible and can be reprocessed instead of silently answering no search (#493)
  • Pruning orphaned documents now deletes their chunks explicitly, and before the document, instead of relying on a database cascade that a table restored by other means may not have; a final pass also removes Qdrant points whose document is no longer in Postgres, which the Postgres-outward scan could not see (#487)
  • reset_failed_statuses.py can now reset two further classes of stranded document: --include-stuck for documents left mid-stage by an interrupted run (parsing, summarizing, tagging, indexing), which no stage picks up again, and --include-empty-indexed for documents marked indexed with no chunks. Both are opt-in, because resetting mid-stage documents during an active run would pull work out from under it (#494)

Tests

  • The translation integration test imports translate_text from its new module again; since the provider port it had failed at collection, and because the CI step is non-blocking the two real-service tests had silently stopped running (#498)

Contributor docs

  • Forbade suppressing or demoting type and lint errors in tooling and dev-server configuration, not only in source (#477)
  • Described the working data location generically: the source documents, parsed output and database storage live outside the repository on a disk of the maintainer’s choosing, set through DATA_MOUNT_PATH, DB_DATA_MOUNT and CACHE_MOUNT_PATH, with guidance on filesystem choice and on sizing for parsed output rather than source documents. No machine-specific paths are named (#488)
  • Added a contact address for reporting Code of Conduct violations, replacing the placeholder (#484)

Upgrade Notes

  • Word documents already in a deployment need reprocessing. The indexing fix (#493) applies when a document is next processed; it does not repair rows already written. Any .doc or .docx indexed before this release may hold no text and will answer no search. Find them with python scripts/pipeline/reset_failed_statuses.py --data-source <name> --include-empty-indexed --dry-run, then re-run without --dry-run to queue them, and run the pipeline. Run it only when no pipeline run is active.
  • Database migrations apply automatically on deploy. This release adds 0033_rename_trace_url, which renames user_activity.langsmith_trace_url to trace_url (values are kept).
  • config.json: new required key application.brief.target_words with presets, min, max and tolerance (see the repository config.json for the values). The UI image still builds without it, but the app then stops at startup with a blank page and a console error naming the key, so deployments that maintain their own config.json must add the block before deploying this release.
  • New optional env vars API_GZIP_ENABLED (default true), API_GZIP_MIN_BYTES (1024) and API_GZIP_LEVEL (6) — see .env.example. Deployments that added Starlette’s GZipMiddleware locally should remove it, otherwise their event streams stay buffered until the stream closes.
  • API image dependency versions change on rebuild (FastAPI 0.115.6 → 0.135.1, Starlette 0.41.3 → 1.6.0). No code changes are needed, but rebuild and smoke-test the API image rather than reusing a cached one.
  • New team default under Admin → Group Settings → Brief: Default section length.
  • New optional env vars (leave unset for the previous behaviour), all documented in .env.example and on the Optional Third-Party Services docs page:
    • Translation: TRANSLATION_PROVIDER (google default; libretranslate, llm, off), LIBRETRANSLATE_URL, TRANSLATION_LLM_MODEL, and a LibreTranslate key variable for servers that require one.
    • Tracing: TRACING_PROVIDER (none, langsmith, opentelemetry; unset keeps LangSmith when a LangSmith key is configured), OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME, TRACE_URL_TEMPLATE.
  • API: the AI summary and assistant completion events now carry trace_url; langsmith_trace_url is still emitted alongside it for this release only and will be dropped in the next.
  • Content-Security-Policy: script-src no longer contains an inline-script hash. Deployments that set their own CSP_POLICY can drop the sha256-… entry; the Google Analytics hosts remain in the default policy.
  • New Python dependencies: opentelemetry-api, opentelemetry-sdk, opentelemetry-exporter-otlp-proto-http (pinned in requirements.txt); rebuild the API and pipeline images.
  • Heatmapper rate limits: check RATE_LIMIT_SEARCH in the production .env; with the compose default of 30/minute, large grids complete but slowly, because each rate-limited cell now waits for the window to reset (#482).
  • Legal pages name the operator from the build: set REACT_APP_OPERATOR_NAME, REACT_APP_OPERATOR_ADDRESS, REACT_APP_HOSTING_REGION, REACT_APP_SITE_URL and REACT_APP_CONTACT_EMAIL in .env and rebuild the ui image; a deployment that leaves them unset publishes Astrobagel as its data controller and the United States as its hosting region.
  • Hidden documents use a new sys_hidden payload key on both Qdrant collections; the payload index for it is created the next time collections are initialised, and queries work without it. No database migration.