6 Ways To Use Few-Shot Prompts: Copy-Paste Templates

6 Ways To Use Few-Shot Prompts: Copy-Paste Templates

Few-Shot Prompt Templates: Copy, Paste, and Customize for Your Niche

Welcome to your go-to resource for ready-to-use few-shot prompt templates. We've compiled a collection of templates designed for a variety of niches, enabling you to quickly leverage the power of LLMs. Simply copy, paste, and customize these templates to fit your specific needs.

 

(1) Sentiment Analysis & Text Classification:

  • Template:

Input: "This movie was absolutely fantastic! I loved every minute."
Sentiment: Positive

Input: "The food was terrible, and the service was even worse."
Sentiment: Negative

Input: "The report was informative, but a bit dry."
Sentiment: Neutral

Input: "[Your Text Here]"
Sentiment:

  • Customization:
    • Replace [Your Text Here] with the text you want to analyze.
    • Adjust the example inputs and sentiments to match your specific domain or industry.
  • Niche Examples:
    • Customer reviews (e-commerce)
    • Social media posts (marketing)
    • Product feedback (development)

(2) Translation:

  • Template:

English: "Hello, how are you?"
Spanish: "Hola, ¿cómo estás?"

English: "Thank you very much."
Spanish: "Muchas gracias."

English: "Where is the nearest restaurant?"
Spanish: "¿Dónde está el restaurante más cercano?"

English: "[Your English Text Here]"
Spanish:

  • Customization:
    • Replace [Your English Text Here] with the text you want to translate.
    • Change the languages to suit your needs.
  • Niche Examples:
    • Legal documents (legal)
    • Technical manuals (engineering)
    • Website localization (web development)

(3) Code Generation:

  • Template:

Input: "Create a Python function to add two numbers."
Output:
def add_numbers(a, b):
    return a + b

Input: "Generate a JavaScript function to reverse a string."
Output:
function reverseString(str) {
  return str.split('').reverse().join('');
}

Input: "[Your Code Request Here]"
Output:

  • Customization:
    • Replace [Your Code Request Here] with your desired code request.
    • Change the coding language as needed.
  • Niche Examples:
    • Web development (front-end, back-end)
    • Data science (data manipulation)
    • Scripting (automation)

(4) Creative Writing:

  • Template:

Style: Short, descriptive poem
Example: "The wind whispers low, trees dance in the night, stars softly glow."

Style: Humorous short story
Example: "The squirrel, convinced he was a spy, hid acorns in his neighbor's mailbox."

Style: Formal business letter
Example: "Dear Sir/Madam, I am writing to inquire about..."

Style: "[Your Desired Style Here]"
Example: "[Your Writing Prompt Here]"

  • Customization:
    • Replace [Your Desired Style Here] and [Your Writing Prompt Here] with your specific requirements.
  • Niche Examples:
    • Marketing copy (advertising)
    • Blog posts (content creation)
    • Screenplays (entertainment)

(5) Question Answering/Chatbot responses:

  • Template:

Question: "What is the capital of France?"
Answer: "The capital of France is Paris."

Question: "How do I reset my password?"
Answer: "To reset your password, click on the 'Forgot Password' link."

Question: "[Your Question Here]"
Answer:

  • Customization:
    • Replace [Your Question Here] with the question you want answered.
    • Customize the examples to fit the tone of the chatbot.
  • Niche Examples:
    • Customer support (e-commerce)
    • Technical support (software)
    • Information retrieval (research)

(6) Data Extraction:

  • Template:

Text: "Name: John Doe, Age: 30, Email: [email protected]"
Extracted: "Name: John Doe, Age: 30, Email: [email protected]"

Text: "Product: Laptop, Price: $1200, Manufacturer: Dell"
Extracted: "Product: Laptop, Price: $1200, Manufacturer: Dell"

Text: "[Your Text Here]"
Extracted:

  • Customization:
    • Replace [Your Text Here] with the data you want to extract.
    • Adjust the examples to fit the data format you are working with.
  • Niche Examples:
    • Resume parsing (HR)
    • Invoice processing (accounting)
    • Web scraping (data analysis)

Tips for Success:

  • Experiment: Don't be afraid to experiment with different prompts and examples.
  • Iterate: Refine your prompts based on the LLM's output.
  • Context is Key: Provide enough context for the LLM to understand the task.
  • Clear Instructions: Give clear and concise instructions.