Spaces:
Sleeping
Sleeping
Commit ·
7f3a266
1
Parent(s): ba47227
docs: README/ARCHITECTURE — list get_policy_facts tool + note #47 UIN dedup
Browse filesThe brain has 4 function-calling tools; the §4.2 ASCII fallback and
ARCHITECTURE.md's one-screen summary listed only 3 (get_policy_facts
was missing — the §4.3 Mermaid diagram already had it). Also documents
the #47 UIN net-new dedup in §6.1 Uploaded-PDF defence. Architecture
itself unchanged this session — the bug fixes (#41/#43/#44/#45/#47)
were internal logic/data corrections, not architecture changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- ARCHITECTURE.md +2 -1
- README.md +6 -0
ARCHITECTURE.md
CHANGED
|
@@ -20,7 +20,8 @@ authority.
|
|
| 20 |
`/api/admin/*`.
|
| 21 |
- **Brain** — one LLM call per turn: Google Gemini
|
| 22 |
(`gemini-2.5-flash`) + function-calling tools
|
| 23 |
-
(`save_profile_field`, `retrieve_policies`, `
|
|
|
|
| 24 |
`backend/single_brain.py` / `backend/brain_tools.py`. A single call owns
|
| 25 |
the whole turn: fact-find, retrieval, QA, and recommendation. On a
|
| 26 |
transient Gemini error / cold-start 503 → small `backend/nim_fallback.py`
|
|
|
|
| 20 |
`/api/admin/*`.
|
| 21 |
- **Brain** — one LLM call per turn: Google Gemini
|
| 22 |
(`gemini-2.5-flash`) + function-calling tools
|
| 23 |
+
(`save_profile_field`, `retrieve_policies`, `get_policy_facts`,
|
| 24 |
+
`mark_recommendation`) in
|
| 25 |
`backend/single_brain.py` / `backend/brain_tools.py`. A single call owns
|
| 26 |
the whole turn: fact-find, retrieval, QA, and recommendation. On a
|
| 27 |
transient Gemini error / cold-start 503 → small `backend/nim_fallback.py`
|
README.md
CHANGED
|
@@ -375,6 +375,7 @@ flowchart LR
|
|
| 375 |
│ tools (backend/brain_tools.py): │
|
| 376 |
│ • retrieve_policies(query, filters, top_k) │
|
| 377 |
│ • save_profile_field(...) │
|
|
|
|
| 378 |
│ • mark_recommendation(...) │
|
| 379 |
│ └ on Gemini failure / first-turn 503 → │
|
| 380 |
│ backend/nim_fallback.py (NIM chain, │
|
|
@@ -498,6 +499,11 @@ before the file is ever embedded or shown to the model:
|
|
| 498 |
7. **Page-count ceiling** — >200 pages is an abuse/bundle vector.
|
| 499 |
8. **Hash dedupe + reject-cache** — identical re-uploads short-circuit.
|
| 500 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 501 |
Accepted uploads are embedded into a **separate, per-session quarantine**
|
| 502 |
Chroma collection (never the shared corpus), scoped by `session_id` so one
|
| 503 |
user's document is invisible to another, and auto-purged after a 24-hour idle
|
|
|
|
| 375 |
│ tools (backend/brain_tools.py): │
|
| 376 |
│ • retrieve_policies(query, filters, top_k) │
|
| 377 |
│ • save_profile_field(...) │
|
| 378 |
+
│ • get_policy_facts(policy_ids) │
|
| 379 |
│ • mark_recommendation(...) │
|
| 380 |
│ └ on Gemini failure / first-turn 503 → │
|
| 381 |
│ backend/nim_fallback.py (NIM chain, │
|
|
|
|
| 499 |
7. **Page-count ceiling** — >200 pages is an abuse/bundle vector.
|
| 500 |
8. **Hash dedupe + reject-cache** — identical re-uploads short-circuit.
|
| 501 |
|
| 502 |
+
Beyond identical-file dedup, a **UIN net-new check** runs on every upload:
|
| 503 |
+
if the PDF's IRDAI UIN already belongs to a catalogued policy, the upload
|
| 504 |
+
is recognised as *not* net-new and the caller is pointed at the existing
|
| 505 |
+
marketplace card instead of a duplicate being indexed.
|
| 506 |
+
|
| 507 |
Accepted uploads are embedded into a **separate, per-session quarantine**
|
| 508 |
Chroma collection (never the shared corpus), scoped by `session_id` so one
|
| 509 |
user's document is invisible to another, and auto-purged after a 24-hour idle
|