§
    éƒtj8  ã                  ór   — d Z ddlmZ ddlmZ ddlmZ d                     ¦   «         Zdddddœdd„Z	dd„Z
dS )uP   Assistant policy helpers â€” conversation vs document memory, follow-ups, voice.é    )Úannotations)ÚAny)ÚStructuredInsightuW  
You are an AI assistant that answers from the user's uploaded knowledge base. Be accurate, never hallucinate, and sound like a helpful colleague.

## Step 0 â€” Classify the question (do this mentally before answering)
A) Knowledge-base question â€” about uploaded files (facts, figures, names, dates, summaries, â€œthis PDF/documentâ€�).
B) Conversational / meta / general knowledge â€” greetings, who you are, or topics not tied to the uploads.
C) Unclear â€” ask one short clarifying question.

Only Category A may use Evidence notes. Categories B and C must ignore document notes even if they appear in the prompt.

## Two independent memories
1) Conversation memory â€” names and prior turns the user told you.
2) Document memory â€” facts from uploaded files only.

Never confuse them. If both could apply, clarify briefly.

## Answer shape
- Lead with a direct answer, then brief supporting detail from the notes.
- Prefer document facts over assumptions. If information is missing, say so â€” never invent numbers, names, or dates.
- Attribute naturally (â€œBased on your uploaded documentâ€¦â€� / â€œFrom your knowledge baseâ€¦â€�).
- Follow-ups must use Recent conversation.
- Never mention RAG, chunks, vectors, embeddings, extraction, or incomplete indexing.

## Tone
Natural, concise, conversational. No greetings on every turn. No goodbyes. No filler.
NF)Úfinance_intentÚinsightÚhas_statementÚhas_docsr   ú
str | Noner   úStructuredInsight | Noner   Úboolr	   Úreturnú	list[str]c                óþ   — |r|j         ndp| pd}|s|sg d¢S g d¢g d¢g d¢g d¢g d¢g d	¢g d
¢g d¢g d¢g d¢g d¢dœ}t          |                     |g ¦  «        ¦  «        }|r|sg d¢}|s|s|rg d¢ng d¢}|dd…         S )uM   Adaptive next questions â€” vary by intent; avoid identical chips every turn.NÚgeneral)zUpload a document to KnowledgezWhat can you help me with?zWhat is depreciation?)zHow much did I spend in total?úShow my biggest expenseszHow much money did I receive?úList all paymentsúWhose statement is this?)r   úHow much spent on groceries?zWhich merchant got the most?zSpend by dateúHow much did I receive?)úHow much did I spend overall?r   r   úSpend on a specific date)r   r   z$List payments to this merchant againr   )r   úShow spend by dater   r   )úHow much did I spend?zWhat is my net cashflow?r   zShow the statement overview)r   r   r   r   )r   r   r   r   )r   r   zWhat is the statement period?r   )r   r   r   r   )r   r   r   )Ústatement_summaryÚspending_summaryÚcategory_spendingÚmerchant_analysisÚdate_lookupÚincomeÚpayment_countÚtransaction_searchÚdocument_qaÚinsightsÚperiod_coverage)zSummarize the documentzWhat is this file about?ú Tell me about the knowledge baseúWhat should I ask you?)r%   r&   zExplain depreciationé   )ÚintentÚlistÚget)r   r   r   r	   r(   Ú	by_intentÚpickss          ú5/var/www/html/CA-Chatbot/app/saas/assistant_policy.pyÚsuggest_followupsr.   &   s‰  € ð !(Ð1ˆgŒnˆn¨TÐQ°nÐQÈ	€Fàð 
˜Mð 
ð
ð 
ð 
ð 	
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ðD'ð D'€IõL �—’˜v rÑ*Ô*Ñ+Ô+€EØð 
˜Uð 
ð
ð 
ð 
ˆð ð 

ð ð	
ð
 (ð	
ð 
ð 
ð 
ð 
ð
/
ð /
ð /
ð 	ð ��!�Œ9Ðó    ÚsuggestionsÚstrc                ó†   — | sdS ddg}| d d…         D ]}|                      d|› �¦  «         Œd                     |¦  «        S )NÚ zYou might also ask:r'   u   â€¢ Ú
)ÚappendÚjoin)r0   ÚlinesÚss      r-   Úformat_suggestions_footerr9   •   s^   € Øð ØˆrØÐ&Ð'€EØ˜˜!˜Œ_ð !ð !ˆØ�Š�Z˜A�Z�ZÑ Ô Ð Ð Ø�9Š9�UÑÔÐr/   )
r   r
   r   r   r   r   r	   r   r   r   )r0   r   r   r1   )Ú__doc__Ú
__future__r   Útypingr   Úapp.models.schemasr   ÚstripÚANALYST_POLICYr.   r9   © r/   r-   ú<module>rA      s§   ðØ VÐ Và "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð à 0Ð 0Ð 0Ð 0Ð 0Ð 0ð÷2 
‚E�G„Gð3 ð< "&Ø(,ØØðlð lð lð lð lð lð^ð ð ð ð ð r/   