File size: 1,998 Bytes
aad7814
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Intentional Deviations from `instructions v2.md`

This deployment closes the v2 spec gap while preserving the following locked decisions.

## Onboarding

- **Spec:** `POST /api/upload/template` for tenant master upload + schema discovery.
- **This deployment:** Operator PDF + Word bundle ingested at startup (`backend/startup.py`) plus optional gated `/admin/template` override. No tenant template upload route.

## LLM provider

- **Spec:** Anthropic Claude (`anthropic_api_key`, `claude-sonnet-4-20250514`).
- **This deployment:** OpenAI via `backend/llm/openai_client.py` (`openai_api_key`, `gpt-4o-mini` defaults).

## Embeddings

- **Spec:** OpenAI `text-embedding-3-small` only.
- **This deployment:** Configurable `embedding_provider` with local `all-MiniLM-L6-v2` default.

## Surveyor notes (Security #1)

- **Spec:** Scrub `raw_notes` before any LLM call; middleware may return 400 on PII in requests.
- **This deployment:** Notes are parsed **verbatim**. Request middleware logs EMAIL/POSTCODE but does not block. PII scrubbing applies to REFERENCE RAG ingest and generated DOCX output.

## Generation RAG

- **Spec:** Allows REFERENCE tier as style fallback during mapping.
- **This deployment:** Mapping is sourced from each tenant's **own past reports
  (REFERENCE tier)** at every interference level via `search_for_reference_mapping()`.
  The shared MASTER boilerplate is **disabled by default** (`master_template_auto_ingest=false`);
  `search_for_generation()` (MASTER-only) remains for explicit opt-in but is not in the
  default path. Per-tenant isolation: a tenant only ever retrieves its own scrubbed reports.

## Legacy `app/`

The original `app/` package is untouched. All v2 work lives under `backend/`.

## Additional extensions (beyond spec)

| Feature | Route / setting |
|---------|-----------------|
| JWT auth | `/auth/register`, `/auth/login` |
| Health | `GET /health` with `reference_ready` + FAISS counts |
| Admin reingest | `POST /admin/template/reingest` |