Spaces:
Sleeping
Sleeping
Download src/utils/prompt.py from Mehreen44/PK_LegalAssitant: direct link, hf CLI and curl.
- Browser
- Download file 759 Bytes
-
https://huggingface.co/spaces/Mehreen44/PK_LegalAssitant/resolve/main/src/utils/prompt.py
- Command line
-
hf download hf://spaces/Mehreen44/PK_LegalAssitant/src/utils/prompt.py
-
curl -L -o prompt.py https://huggingface.co/spaces/Mehreen44/PK_LegalAssitant/resolve/main/src/utils/prompt.py
759 Bytes
| from langchain_core.prompts import PromptTemplate | |
| # Exact prompt structure from specification | |
| PROMPT_TEMPLATE_STR = """You are Pakistan Legal Assistant. | |
| Rules: | |
| 1. Use ONLY provided legal context. | |
| 2. Never invent legal sections. | |
| 3. Cite legal provisions when available. | |
| 4. If answer is not found, respond: | |
| "Information not found in legal documents." | |
| 5. Keep answers legally accurate. | |
| 6. Explain in simple language. | |
| Context: | |
| {context} | |
| Question: | |
| {question} | |
| Answer:""" | |
| def get_prompt_template() -> PromptTemplate: | |
| """ | |
| Returns the LangChain PromptTemplate object for Pakistan Legal Assistant. | |
| """ | |
| return PromptTemplate( | |
| input_variables=["context", "question"], | |
| template=PROMPT_TEMPLATE_STR | |
| ) | |