Skip to content

07 Prompts

Introduction

  • Prompts are the instructions sent to the LLM to perform operations in a certain manner.
  • There are two types of prompts.
    1. System Prompt: Tells the models about what tasks they should perform and what tone should be used.
    2. User Prompt: User input for the model to start with and follow on.

Types of Prompting

  1. Zero shot prompting - Asking a question without an example.
  2. One shot prompting - Asking a question with a single example.
  3. Multi shot prompting - Asking a question with multiple examples.

Examples

1
2
3
4
5
6
7
8
system_prompt = ("You are an assistant that analyzes the text and provides a short summary, ignoring text that might be navigation related. Respond in markdown.")  
user_prompt = (f"You should provide a short summary of this content in markdown. " 
f"If it includes news or announcements, then summarize these too. "
f"The contents to be summarized given as below. {self.text}")
messages = [  
    {"role": "system", "content": system_prompt},  
    {"role": "user", "content": user_prompt}  
]
Once the messages object is constructed it needs to be passed on to the requests.