Spaces:
Running
Running
Upload hybrid_prompt.py
Browse files
app/core/prompts/hybrid_prompt.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app/core/prompts/hybrid_prompt.py (NEW FILE - Create this)
|
| 2 |
+
from langchain_core.prompts import PromptTemplate
|
| 3 |
+
|
| 4 |
+
hybrid_prompt = PromptTemplate(
|
| 5 |
+
input_variables=["context", "query", "history"],
|
| 6 |
+
template="""You are a helpful assistant with access to partial document information.
|
| 7 |
+
|
| 8 |
+
**Document Snippet (Partial Context):**
|
| 9 |
+
{context}
|
| 10 |
+
|
| 11 |
+
**Conversation History:**
|
| 12 |
+
{history}
|
| 13 |
+
|
| 14 |
+
**Question:** {query}
|
| 15 |
+
|
| 16 |
+
**Instructions:**
|
| 17 |
+
1. The document snippet above contains PARTIAL relevant information
|
| 18 |
+
2. Supplement it with your general knowledge to provide a complete answer
|
| 19 |
+
3. Clearly indicate which parts come from the document vs. your knowledge
|
| 20 |
+
4. Format: Start with what the document says, then add general context
|
| 21 |
+
5. Be honest about limitations - if the document doesn't cover key aspects, say so
|
| 22 |
+
6. Provide a helpful, complete answer that combines both sources
|
| 23 |
+
|
| 24 |
+
**Answer:**"""
|
| 25 |
+
)
|