Practical RAG contd..
- We have indexed the documents and stored in vector database
- Now lets create the generation pipeline
Prompting techniques
- A Basic approach to create a well defined prompt is
- Give a persona
- Add your context
- Ask the question
- Add restrictions (optional)
- Add output format (optional)
- Prompt for home remidies
As a grandmother from south india with well versed knowledge in home remidies, Suggest remedy for cough for me with age of 39. Ensure you give me remedy and recipe on how to create that.
-
Refer Here for interesting prompts
-
Zero-shot prompting: In this technique we directly ask question.
- Few-shot prompting: We give some examples and then ask a question
As an expert in Computer science, I want you to explain the usages of the concepts in the following way.
Question: Trees
Answer:
Tree is a very popular data structure used in
* File organizations by operating systems
* For storing parent child relationships in workflows
Popular trees are
* Binary Tree
* Binary Search Tree
* AVL Trees
I will be asking questions
- Chain of thought: Asking model to reason
Solve the following problem step by step 2 * 3 + 4 % 2 * 7
Lets Create Generation pipeline
- Langchain Messages are used in prompts
-
lets try few-shot prompting with langchain Refer Here
-
From vector database we can create a retriever and ask a question which gives some documents and they should be part of prompt as context. This means we need to create a reusable prompt i.e Prompt Templates
Exercise
- I want you to write messages for few shot prompt where the
- persona: tution teacher
- examples: 5 class student asks the question and some one line response and a books reference
- Write your version of RAG.
