1 00:00:0,040 --> 00:00:5,160 So today we will be covering a scenario that  will allow you to enrich your list of domains

2 00:00:5,160 --> 00:00:10,800 with additional customer information. In  our example, you have received a list of

3 00:00:10,800 --> 00:00:15,440 domains from your sales team, and you want  to run a quick automation to retrieve further

4 00:00:15,440 --> 00:00:20,920 information such as the name, the number  of employees, and, in our particular case,

5 00:00:20,920 --> 00:00:28,160 whether it's a startup or a bigger company.  Lastly, we want to get a short description.

6 00:00:28,160 --> 00:00:29,960 So let's go to our Scenario Builder.

7 00:00:34,320 --> 00:00:39,560 As a first step, we will search for our Google  Sheets module. We'll retrieve the search for

8 00:00:39,560 --> 00:00:45,560 rows module, which allows you to search all  columns and rows in your Google sheet. So

9 00:00:45,560 --> 00:00:50,040 let's jump into configuring the spreadsheet.  I know my company list is in Google Drive,

10 00:00:50,040 --> 00:00:55,920 so I'll leave this option here. Let me just  look for it in the list of my spreadsheets.

11 00:00:55,920 --> 00:01:0,200 Now I know that I only have one sheet in  that file, so I'll go ahead and select that

12 00:01:0,200 --> 00:01:7,160 one. I know my Google sheet contains  headers, so I will leave that option on.

13 00:01:7,160 --> 00:01:11,280 I can do the same for the column range,  and since I want to return all values,

14 00:01:11,280 --> 00:01:16,600 I will leave the filters empty. It seems that we  are all set to test out the module as we don't

15 00:01:16,600 --> 00:01:21,200 need any other fields for this example. Let's  now run the module to see if we are getting

16 00:01:21,200 --> 00:01:39,040 our values back. Great, we can see that we  are getting the companies that we wanted.

17 00:01:39,040 --> 00:01:45,440 Let's now create an OpenAI module. Let's look  for OpenAI and then select the option to create

18 00:01:45,440 --> 00:01:51,160 a completion, which is the one that allows  me to communicate and write prompts. If you

19 00:01:51,160 --> 00:01:57,280 are stuck on how to set up an OpenAI module,  just head back to our earlier videos. This

20 00:01:57,280 --> 00:02:4,680 time I choose to create a chat completion, and  I would like to give it a bit of system context.

21 00:02:4,680 --> 00:02:9,400 Before jumping into what system context is,  let's first choose a model. In this case,

22 00:02:9,400 --> 00:02:24,280 I'll use Chat GPT Omni, and I add a message. You  can notice that there are suddenly multiple roles

23 00:02:24,280 --> 00:02:30,000 you can choose from. Up to now, we have been  using the role of user, which is automatically

24 00:02:30,000 --> 00:02:37,200 selected if you choose create a prompt  completion instead of create a chat completion.

25 00:02:37,200 --> 00:02:41,760 So if you select the role of a user, the  result will be exactly the same as when you

26 00:02:41,760 --> 00:02:49,160 write to a Chat GPT or any other chatbot. In  contrast, a system user allows you to specify

27 00:02:49,160 --> 00:02:54,960 an additional context that underpins  all of your prompts. Imagine you could

28 00:02:54,960 --> 00:03:0,000 tell your chatbot the context of your entire  conversation, and then it would automatically

29 00:03:0,000 --> 00:03:7,000 know that any question that follows needs to be  responded to within this context. So you can see

30 00:03:7,000 --> 00:03:14,000 that a system prompt can be particularly useful  for when you send various user messages. Let's

31 00:03:14,000 --> 00:03:29,760 add the system context, and I copy-paste the  one I prepared. I go on to add my user message.

32 00:03:33,640 --> 00:03:38,080 In this message, you can see that I'm specifying  that I want help to complete some information

33 00:03:38,080 --> 00:03:44,880 on the provided companies and determine whether  companies are startups or not. I go on to specify

34 00:03:44,880 --> 00:03:52,240 I want my output to be in JSON format. I want for  any domain to return a name, number of employees,

35 00:03:52,240 --> 00:04:1,240 which are sorted into five different categories,  and I want to also tell it shouldn't return

36 00:04:1,240 --> 00:04:6,080 anything if it's not sure, which is sometimes  important because I want to be in control of

37 00:04:6,080 --> 00:04:12,200 what comes out. I will now give it an example of  the kind of output that I'm looking for, including

38 00:04:12,200 --> 00:04:18,160 the ideal data structure, and then I just put the  list of company domains and specify the number

39 00:04:18,160 --> 00:04:34,080 of tokens. The last thing we need to do is to  head up to advanced settings. I scroll down to

40 00:04:34,080 --> 00:04:41,160 a field called response format. Here I need to  change it to a JSON format instead of the text

41 00:04:41,160 --> 00:04:46,920 option to ensure that I don't receive a simple  text response. Whenever you want your prompt to

42 00:04:46,920 --> 00:04:54,480 return a JSON format, you need to specify this  field as well as be explicit in your prompt.

43 00:04:54,480 --> 00:04:59,640 And that's it. I can test my module now.

44 00:05:3,360 --> 00:05:12,320 I'll choose one of the examples from my list,  maybe apple.com. I can see my scenario running.

45 00:05:12,320 --> 00:05:17,360 Let's now check the result of our test.  All seems to be working just as I wanted,

46 00:05:17,360 --> 00:05:22,880 so let's get to the next part. Now it's time  to parse the prompt we received from our OpenAI

47 00:05:22,880 --> 00:05:30,080 modules so we can return that data to our Google  sheet and save it there. For parsing JSON, I will

48 00:05:30,080 --> 00:05:36,160 look for the right module and I select parse  JSON. I can see that I'm asked to create a data

49 00:05:36,160 --> 00:05:43,400 structure. For a data structure, I'll just add a  new one in my case, and I'll name it companies. I

50 00:05:43,400 --> 00:05:47,960 can use generation to make my life much easier  since I can just paste in the sample data from

51 00:05:47,960 --> 00:06:3,200 our JSON prompt in OpenAI and click on generate  data structure. I can see that it pre-populated

52 00:06:3,200 --> 00:06:24,080 company, number of employees, and startup, and the  description of the company in my data structure.

53 00:06:24,080 --> 00:06:29,120 Then it's time to add a JSON string, which is  the response OpenAI gave me back in the previous

54 00:06:29,120 --> 00:06:42,720 module. So I just map the responses directly  in my scenario, and that's it for this module.

55 00:06:42,720 --> 00:06:48,640 The last step now is to connect again our Google  sheet with the companies. This is because we've

56 00:06:48,640 --> 00:06:54,040 now taken the domains our initial Google sheet  fed them into our OpenAI connection, and we've

57 00:06:54,040 --> 00:07:0,000 got back a list of additional information that we  want to put back in that original Google sheet.

58 00:07:0,000 --> 00:07:6,120 So let's look for the familiar module that updates  our Google sheet. So I get my update a row,

59 00:07:6,120 --> 00:07:11,280 which is a module that takes a row of our company  list, a company domain, finds the output for that

60 00:07:11,280 --> 00:07:18,080 domain, and inserts it back into the appropriate  column. Setting my module as usual, I get to the

61 00:07:18,080 --> 00:07:26,040 columns where I can pass the data to update my  Google sheet. I locate my company's list, select

62 00:07:26,040 --> 00:07:40,720 the sheet, and map the real pH number from our  first module. Great, all ready to map our values.

63 00:07:40,720 --> 00:07:45,640 I don't want to put anything in my first  column because I already have values there.

64 00:07:45,640 --> 00:07:51,240 Going back to my Google sheet, I can see  that I want company names in column B,

65 00:07:51,240 --> 00:07:59,440 number of employees in column C,  whether it's a startup in column D,

66 00:08:4,560 --> 00:08:11,200 and some short description in column  E. So that's what I map in my scenario,

67 00:08:11,200 --> 00:08:27,800 and that's it. I click on OK, and let's  save and run the entire scenario. Great,

68 00:08:27,800 --> 00:08:32,640 everything is working smoothly. I can see  that my Google sheet reflects the changes,

69 00:08:32,640 --> 00:08:37,520 which is exactly what we wanted to  achieve with our scenario today.

70 00:08:37,520 --> 00:08:44,240 Great, so to sum up, we have learned to use OpenAI  to enrich and autocomplete our data. We managed to

71 00:08:44,240 --> 00:08:49,880 get from a simple domain to a comprehensive list  of companies. Along the way, we also learned about

72 00:08:49,880 --> 00:08:55,280 system user and parsing JSON. Well, that's it for  today, and I hope to see you in our next video.