-
Principle 1 - write clear and specific instructions
- Use delimiters to quote the task and avoid prompt injection to ensure to execute content as a whole, i.e. '', "", ``, <>
- Ask for structured output formats to respond, i.e. JSON, HTML
- Check if the conditions are satisfied
- Few-shot prompting
-
Principle 2 - give the model time to 'think'
- Specify steps to complete a task
- Instruct model to think before conclude and complete a task
- Process
- Idea/ Problem
- Implementation
- Experimental results
- Error analysis
-
Summarizing
- Summarize a task content based on prompt
- Can be single/ multiple tasks
- For multiple tasks
- Define a List of all required task contents
- Define for-loop of List
- Print( i, response, "\n")
-
Extracting
- Extracting is part of natural language processing (NLP)
- Can be included in the process of summarizing and inferring
-
Inferring
- Help provide basic understanding of a task content
- Classify sentiment of a task content (Yes/ No)
- Identify specific sentiments of a task content (What kinds of sentiments)
- Extract keywords as an understanding of a task content
- Can be single/ multiple tasks
-
Transforming
- Identify language
- Translate from language A to language B
- Tranform to formal and informal tone
- Tranform from format A to format B, i.e. HTML, JSON
- Transform from text A to text B, i.e. re-writing, shortening
- Check gramma and spelling
- Can be single/ multiple tasks
-
Expanding
- Create a response including all the other functions, i.e. extract and summarize the task content for creating a response
- OpenAI API: OpenAI API access
- if there is rate and region limit, check out Limit guide
- Best practices for prompt engineering Prompting FAQ
- Prompting with OpenAI examples: Examples
- Reference task contents for prompting: DeepLearning.AI