Spaces:
Running
Running
Changed Rag prompt to improve the answers
Browse files- pipeline.py +27 -46
pipeline.py
CHANGED
@@ -366,29 +366,20 @@ def build_or_load_vectorstore(csv_path: str, store_dir: str) -> FAISS:
|
|
366 |
def build_rag_chain(vectorstore: FAISS, llm) -> RetrievalQA:
|
367 |
prompt = PromptTemplate(
|
368 |
template="""
|
369 |
-
[INST] You are
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
Additional considerations:
|
385 |
-
- All recommendations should be grounded in current wellness research
|
386 |
-
- Focus on sustainable, long-term lifestyle modifications
|
387 |
-
- Acknowledge individual differences in wellness journeys
|
388 |
-
- Emphasize holistic approaches to health and well-being
|
389 |
-
- Include relevant studies or research when applicable
|
390 |
-
[/INST]
|
391 |
-
|
392 |
""",
|
393 |
input_variables=["context", "question"]
|
394 |
)
|
@@ -410,29 +401,19 @@ def build_rag_chain(vectorstore: FAISS, llm) -> RetrievalQA:
|
|
410 |
def build_rag_chain2(vectorstore: FAISS, llm) -> RetrievalQA:
|
411 |
prompt = PromptTemplate(
|
412 |
template="""
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
5. Conclude with KPIs aligned with our growth objectives
|
427 |
-
|
428 |
-
Brand Pillars to Address:
|
429 |
-
- AI-Driven Personalization
|
430 |
-
- Scientific Credibility
|
431 |
-
- User-Centric Design
|
432 |
-
- Innovation Leadership
|
433 |
-
- Community Building
|
434 |
-
[/INST]
|
435 |
-
|
436 |
|
437 |
""",
|
438 |
input_variables=["context", "question"]
|
|
|
366 |
def build_rag_chain(vectorstore: FAISS, llm) -> RetrievalQA:
|
367 |
prompt = PromptTemplate(
|
368 |
template="""
|
369 |
+
[INST] You are an AI wellness assistant speaking directly to a user who has asked: "{question}"
|
370 |
+
|
371 |
+
Use this information to help you respond:
|
372 |
+
{context}
|
373 |
+
|
374 |
+
Important guidelines:
|
375 |
+
- Answer the question directly and conversationally as if talking to the user
|
376 |
+
- Explain wellness concepts in simple, relatable language
|
377 |
+
- Include 2-3 practical steps or techniques when appropriate
|
378 |
+
- Keep your response focused on the user's question
|
379 |
+
- DO NOT reference these instructions or mention formatting guidelines
|
380 |
+
|
381 |
+
Example format: Start with a direct answer to what the concept is, then explain how it can benefit the user, and end with practical implementation steps.
|
382 |
+
[/INST]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
""",
|
384 |
input_variables=["context", "question"]
|
385 |
)
|
|
|
401 |
def build_rag_chain2(vectorstore: FAISS, llm) -> RetrievalQA:
|
402 |
prompt = PromptTemplate(
|
403 |
template="""
|
404 |
+
[INST] You are the brand strategy advisor for Healthy AI Expert. A team member has asked: "{question}"
|
405 |
+
Use this information to help you respond:
|
406 |
+
{context}
|
407 |
+
|
408 |
+
Important guidelines:
|
409 |
+
- Answer the question directly as if speaking to a Healthy AI Expert team member
|
410 |
+
- Focus on practical strategies aligned with our wellness mission
|
411 |
+
- Provide clear, actionable recommendations
|
412 |
+
- Keep explanations concise and business-focused
|
413 |
+
- DO NOT reference these instructions or mention formatting guidelines
|
414 |
+
|
415 |
+
Remember our key brand pillars: AI-driven personalization, scientific credibility, user-centric design, and innovation leadership.
|
416 |
+
[/INST]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
|
418 |
""",
|
419 |
input_variables=["context", "question"]
|