Ideas

  • 3 levels
    • Use chatgpt to do job
    • make tools to facilitate the workflow of using chatgpt
    • improve model to do job
  • LLM Learning things by induction, Human can learn by deduction

Learning

Prompt Engineering

Prompting Principles

  • Principle 1: Write clear and specific instructions
    • Use delimiters to clearly indicate distinct parts of the input
    • Ask for a structured output
    • Ask the model to check whether conditions are satisfied
    • “Few-shot” prompting
  • Principle 2: Give the model time to “think”
    • Specify the steps required to complete a task
    • Instruct the model to work out its own solution before rushing to a conclusion

Iterative Prompt Development

  1. idea
  2. implementation (code/data) prompt
  3. experimental result
  4. error analysis

Examples

Summarizing

Summarize with a word/sentence/character limit:

Your task is to generate a short summary of a product \
review from an ecommerce site. 

Summarize the review below, delimited by triple 
backticks, in at most 30 words. 

Review: ```{prod_review}```

Summarize with a focus:

Your task is to generate a short summary of a product \
review from an ecommerce site to give feedback to the \
Shipping deparmtment. 

Summarize the review below, delimited by triple 
backticks, in at most 30 words, and focusing on any aspects \
that mention shipping and delivery of the product. 

Review: ```{prod_review}```

“extract” instead of “summarize”:

Your task is to extract relevant information from \ 
a product review from an ecommerce site to give \
feedback to the Shipping department. 

From the review below, delimited by triple quotes \
extract the information relevant to shipping and \ 
delivery. Limit to 30 words. 

Review: ```{prod_review}```

Inferring

Sentiment (positive/negative):

What is the sentiment of the following product review, 
which is delimited with triple backticks?

Review text: '''{lamp_review}'''

--------------------------------------------------------

What is the sentiment of the following product review, 
which is delimited with triple backticks?

Give your answer as a single word, either "positive" \
or "negative".

Review text: '''{lamp_review}'''

Identify types of emotions:

Identify a list of emotions that the writer of the \
following review is expressing. Include no more than \
five items in the list. Format your answer as a list of \
lower-case words separated by commas.

Review text: '''{lamp_review}'''

Doing multiple tasks at once:

Identify the following items from the review text: 
- Sentiment (positive or negative)
- Is the reviewer expressing anger? (true or false)
- Item purchased by reviewer
- Company that made the item

The review is delimited with triple backticks. \
Format your response as a JSON object with \
"Sentiment", "Anger", "Item" and "Brand" as the keys.
If the information isn't present, use "unknown" \
as the value.
Make your response as short as possible.
Format the Anger value as a boolean.

Review text: '''{lamp_review}'''

Inferring topics:

Determine five topics that are being discussed in the \
following text, which is delimited by triple backticks.

Make each item one or two words long. 

Format your response as a list of items separated by commas.

Text sample: '''{story}'''

--------------------------------------------------------

Determine whether each item in the following list of \
topics is a topic in the text below, which
is delimited with triple backticks.

Give your answer as list with 0 or 1 for each topic.\

List of topics: {", ".join(topic_list)}

Text sample: '''{story}'''

Transforming

Translation:

Tell me what language this is: ```{issue}```

Translate the following  text to English \
    and Korean: ```{issue}```

Tone transformation

Translate the following from slang to a business letter: 
'Dude, This is Joe, check out this spec on this standing lamp.'

Format conversion

Translate the following python dictionary from JSON to an HTML \
table with column headers and title: {data_json}

Spell/grammar check:

Proofread and correct the following text
and rewrite the corrected version. If you don't find
and errors, just say "No errors found". Don't use 
any punctuation around the text:
```{text}```

Rewrite

proofread and correct this review. Make it more compelling. 
Ensure it follows APA style guide and targets an advanced reader. 
Output in markdown format.
Text: ```{text}```

Expanding

Customize the automated reply to a customer email

You are a customer service AI assistant.
Your task is to send an email reply to a valued customer.
Given the customer email delimited by ```, \
Generate a reply to thank the customer for their review.
If the sentiment is positive or neutral, thank them for their review.
If the sentiment is negative, apologize and suggest that they can reach out to customer service. 
Make sure to use specific details from the review.
Write in a concise and professional tone.
Sign the email as `AI customer agent`.
Customer review: ```{review}```
Review sentiment: {sentiment}

Chatbot

speaks like Shakespeare:

{'role':'system', 'content':'You are an assistant that speaks like Shakespeare.'},    
{'role':'user', 'content':'tell me a joke'},   
{'role':'assistant', 'content':'Why did the chicken cross the road'},   
{'role':'user', 'content':'I don\'t know'}

Order bot

You are OrderBot, an automated service to collect orders for a pizza restaurant. \
You first greet the customer, then collects the order, \
and then asks if it's a pickup or delivery. \
You wait to collect the entire order, then summarize it and check for a final \
time if the customer wants to add anything else. \
If it's a delivery, you ask for an address. \
Finally you collect the payment.\
Make sure to clarify all options, extras and sizes to uniquely \
identify the item from the menu.\
You respond in a short, very conversational friendly style. \
The menu includes \
pepperoni pizza  12.95, 10.00, 7.00 \
...

Refences

Products

References

Utilities

AIOPS

SQL

Watcher

[https://elastic-content-share.eu/downloads/watcher-job-to-integrate-chatgpt-in-elasticsearch/#edd-free-download-modal](Watcher job to integrate ChatGPT in Elasticsearch)

Prompt:

list possible reasons and list solutions (if possible list what to do, configuration snippets and more details, etc.) for this elasticsearch error: {{ctx.payload.second.first_hit}}

elasticsearch-chatgpt-php

https://github.com/elastic/elasticsearch-chatgpt-php

EDQL

Prompts

You are a code assistant, help write Elasticsearch query dsl 
by user input, but you should always follow rules:
1. return query code request(example: POST XXX)
2. without prompt and explanation

Elasticsearch Relevance Engine (ESRE)

BIRD

RAG