LongCut logo

第4集-摘要-ChatGPT提示工程师|AI大神吴恩达教你写提示词

By 退休生活真精彩

Summary

Topics Covered

  • Prompts Tailor Summaries to Departments
  • Extract Beats Summarize for Targeted Feedback
  • Loop Summarizes Review Volumes Fast

Full Transcript

there's so much text in today's world pretty much none of us have enough time to read all the things we wish we had time to so one of the most exciting applications I've seen of large language

models is to use it to summarize text and this is something that I'm seeing multiple teams build into multiple software applications you can do this in the chat gbt web

interface I do this all the time to summarize articles so I can just kind of read the content of manual articles than I previously could and if you want to do this more programmatically you'll see how to in this lesson

so with that let's dig into the code to see how you could use this yourself to summarize text so let's start off with the same starter code as you saw before of import open AI

load the API key and here's that get completion Hopper function I'm going to use as the running example

the task of summarizing this product review got this Panda plush toy for my daughter's birthday who loves it and takes it everywhere and so on and so on

if you're building an e-commerce website and there's just a large volume of reviews having a tool to summarize the lengthy reviews could give you a way to

very quickly glance over more reviews to get a better sense of what all your customers are thinking so here's a prompt for generating a summary your task is generated short summary of

a product review from e-commerce website summarize review below and so on in that most 30 words and so this is something cute panda

plush toy Love by Daughter a bit small of a price arrive early not bad it's pretty good summary and as you saw in the previous video you can also play with things like controlling the

character count or the number of sentences to affect the length of this summary now sometimes when creating a summary if you have a very specific purpose in mind

for the summary for example if you want to give feedback to the shipping Department you can also modify the prompt to reflect that so that they can generate a summary that is more

applicable to one particular group in your business so for example if I add to give feedback

to the shipping Department let's say I change this to start to focus on any aspects that mentioned

shipping and delivery of the product and if I run this then again you get a summary but instead of starting off with something cute panda

plush toy it now focuses on the fact that it arrived a day earlier um than expected and then the store has you know other details that

or as another example if we aren't trying to give feedback to the shipping department but let's say we want to give feedback to the pricing Department

so the pricing department is um responsible for determining the price of the product and I'm going to tell it to focus on

any aspects they're relevant to the price and perceive value then this generates a different summary that it says oh maybe the price may be

too high for a size now in the summaries that I've generated for the shipping department or the pricing Department it focus a bit more

on information relevant to those specific departments and in fact feel free to pause the video now and maybe ask it to generate information for the

product Department responsible for the customer experience of the product or for something else that you think might be interested into an e-commerce site but in these summaries even though it

generated the information relevant to shipping it had some other information too which you could decide may or may not be helpful so depending on how you want to

summarize it you can also ask it to extract information rather than summarize it so here's a prompt this is Utah's extract relevant information

um to give feedback to shipping department and now it just says traffic arrived the day earlier than expected without all of the other information which was also hopeful in a general

summary but less specific to the shipping Department if all it wants to know is what happened with the shipping lastly let me just share with you a concrete example for how to use this in

a workflow to help summarize multiple reviews to make them easier to read so here are a few reviews this is kind of long but you know here's the second

review for standing around need the lamp on the bedroom here's the third review from the electric toothbrush my dental hygiene is recommended kind of a long review about the electric toothbrush

this is a review for a blender when it said so said 17p system on seasonal sale and so on and so on this is actually a lot of text if you want feel free to pause the video and read through all this text but one of you want to know

what these um reviewers wrote without having to stop and read all this in detail so I'm going to set review one to be just the product review that we

had up there and I'm going to put all of these reviews into a list and now if I Implement a for Loop over the reviews

so here's my prompt um and here I've asked it to summarize it in at most 20 words then let's have it get the response and print it out and

let's run that and it prints out the first review was that Panda toy review summary review of the lamp some review of the toothbrush and then

the blender and so if you have websites where you have hundreds of reviews you can imagine how you might

use this to build a dashboard to take huge numbers of reviews generate short summaries of them so that you or someone else can browse the reviews much more quickly and then if

they wish maybe click in to see the original longer review and this can help you efficiently get a better sense of what all of your

customers are thinking right so that's it for summarizing and I hope that you can picture if you have any applications with many pieces of text how you can use prompts like these

to summarize them to help people quickly get a sense of what's in the text the many pieces of text and perhaps optionally digging more if they wish

in the next video we'll look at another capability of large language models which is to make inferences using text for example what if you had again product reviews and you wanted to very

quickly get a sense of which product reviews have a positive or A negative sentiment let's take a look at how to do that in the next video

Loading...

Loading video analysis...