Spaces:
Sleeping
Sleeping
GitHub Actions commited on
Commit ·
d87399c
1
Parent(s): 8ccf339
Deploy cf7f476
Browse files
app/pipeline/nodes/generate.py
CHANGED
|
@@ -40,14 +40,14 @@ def make_generate_node(llm_client: LLMClient) -> Callable[[PipelineState], dict]
|
|
| 40 |
context_block = "\n\n".join(context_parts)
|
| 41 |
|
| 42 |
system_prompt = (
|
| 43 |
-
"You are
|
| 44 |
-
"
|
| 45 |
-
"Darshan Chheda is the subject
|
| 46 |
-
"
|
| 47 |
-
"
|
| 48 |
-
"
|
| 49 |
-
"
|
| 50 |
-
"
|
| 51 |
)
|
| 52 |
|
| 53 |
prompt = f"Context:\n{context_block}\n\nQuestion: {query}"
|
|
|
|
| 40 |
context_block = "\n\n".join(context_parts)
|
| 41 |
|
| 42 |
system_prompt = (
|
| 43 |
+
"You are a knowledgeable assistant on Darshan Chheda's personal portfolio website. "
|
| 44 |
+
"Use the numbered context passages below — which cover Darshan's projects, blog posts, skills, and background — to answer the question. "
|
| 45 |
+
"Darshan Chheda is always the subject. When a passage says 'I', 'my', or 'me', that voice is Darshan's. "
|
| 46 |
+
"Write in clear, professional English as if you know Darshan well. "
|
| 47 |
+
"You may draw reasonable, confident inferences from the evidence (e.g. if he built a full-stack app he knows both front-end and back-end; if he wrote Assembly he understands low-level programming). "
|
| 48 |
+
"Do NOT say you cannot find information when the context clearly contains the answer — read it carefully. "
|
| 49 |
+
"Cite every factual claim inline with bracketed numbers like [1], [2] immediately after the claim. "
|
| 50 |
+
"Be concise and direct. Avoid hedging phrases like 'based on the context' or 'the context suggests'."
|
| 51 |
)
|
| 52 |
|
| 53 |
prompt = f"Context:\n{context_block}\n\nQuestion: {query}"
|
app/security/sanitizer.py
CHANGED
|
@@ -59,7 +59,10 @@ def redact_pii(text: str) -> str:
|
|
| 59 |
# Failsafe if Presidio isn't installed/working
|
| 60 |
return text
|
| 61 |
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
try:
|
| 65 |
results = analyzer.analyze(text=text, entities=entities, language='en')
|
|
|
|
| 59 |
# Failsafe if Presidio isn't installed/working
|
| 60 |
return text
|
| 61 |
|
| 62 |
+
# PERSON is intentionally excluded: visitors are expected to name Darshan Chheda
|
| 63 |
+
# in their queries. Redacting that breaks retrieval and confuses the LLM.
|
| 64 |
+
# We only protect against visitor PII that could leak into logs (e-mail, phone, etc.).
|
| 65 |
+
entities = ["EMAIL_ADDRESS", "PHONE_NUMBER", "UK_NHS", "IBAN_CODE"]
|
| 66 |
|
| 67 |
try:
|
| 68 |
results = analyzer.analyze(text=text, entities=entities, language='en')
|