Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

W7S169G Exercise Guide

Download as pdf or txt
Download as pdf or txt
You are on page 1of 36

Exercise Guide

IBM watsonx Foundations


Course code W7S169G

IBM Learning

IBM Training
IBM watsonx Foundations

January 2023 edition


Notices
This information was developed for products and services offered in the US.

IBM may not offer the products, services, or features discussed in this document in other countries. Consult your local IBM
representative for information on the products and services currently available in your area. Any reference to an IBM product, program,
or service is not intended to state or imply that only that IBM product, program, or service may be used. Any functionally equivalent
product, program, or service that does not infringe any IBM intellectual property right may be used instead. However, it is the user's
responsibility to evaluate and verify the operation of any non-IBM product, program, or service.

IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of this
document does not grant you any license to these patents. You can send license inquiries, in writing, to:

IBM Director of LicensingIBM Corporation

North Castle Drive, MD-NC119Armonk, NY 10504-1785

United States of America

INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,

MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do not allow disclaimer of express or implied
warranties in certain transactions, therefore, this statement may not apply to you.

This information could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein;
these changes will be incorporated in new editions of the publication. IBM may make improvements and/or changes in the product(s)
and/or the program(s) described in this publication at any time without notice.

Any references in this information to non-IBM websites are provided for convenience only and do not in any manner serve as an
endorsement of those websites. The materials at those websites are not part of the materials for this IBM product and use of those
websites is at your own risk.

IBM may use or distribute any of the information you provide in any way it believes appropriate without incurring any obligation to you.

Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other
publicly available sources. IBM has not tested those products and cannot confirm the accuracy of performance, compatibility or any
other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of
those products.

This information contains examples of data and reports used in daily business operations. To illustrate them as completely as possible,
the examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to
actual people or business enterprises is entirely coincidental.

Trademarks
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corp., registered in many
jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM
trademarks is available on the web at “Copyright and trademark information” at www.ibm.com/legal/copytrade.shtml.

© Copyright International Business Machines Corporation 2023.

This document may not be reproduced in whole or in part without the prior written permission of IBM.

US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

© Copyright IBM Corp. 2023 2


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

Trademarks
The reader should recognize that the following terms, which appear in the content of this training
document, are official trademarks of IBM or other companies:
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International
Business Machines Corp., registered in many jurisdictions worldwide.
The following are trademarks of International Business Machines Corporation, registered in many
jurisdictions worldwide:
IBM Cloud Pak for Data
Watson Machine Learning
Watson Studio
Watson Knowledge Catalog
Db2
Db2 Big SQL
Db2 Warehouse
Data Virtualization
IBM Cloud File Storage
OpenShift® and Red Hat® are trademarks or registered trademarks of Red Hat, Inc. or its
subsidiaries in the United States and other countries.
Adobe, and the Adobe logo, are either registered trademarks or trademarks of Adobe Systems
Incorporated in the United States, and/or other countries.
Microsoft, Windows, and the Windows logo are trademarks of Microsoft Corporation in the United
States, other countries, or both.
Other product and service names might be trademarks of IBM or other companies.

© Copyright IBM Corp. 2023 3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

IBM watsonx Foundations


This file contains instructions for all the guided exercises presented in the ‘IBM watsonx
Foundations’ course. Use it for future reference or during the course workflow as
guidance to perform the tasks.
To access the classroom environment, you log in to the IBM Cloud with your valid IBM
credentials. You use the IBM’s Software as a Service (SaaS) offering available in the IBM
public cloud. If you do not currently have valid IBM Cloud credentials, the first exercise
guides you to register for an IBM Cloud account to obtain your IBM Cloud credentials.

The rest of the prompt engineering exercises are done in the IBM public cloud by using
the watsonx.ai platform.

Contents
Trademarks .................................................................................................................................................... 3
Exercise 1. Prepare your lab environment ........................................................................................................ 5
1. Prepare your lab environment .................................................................................................................. 6
Section 1. Create an IBM Cloud account. .................................................................................................. 6
Section 2. Log in to watsonx ..................................................................................................................... 6
Section 3. Set up your lab environment.................................................................................................... 9
Exercise 2. Prompt engineering ...................................................................................................................... 16
2. Introduction ............................................................................................................................................ 17
Section 1. Zero-shot prompting .............................................................................................................. 17
Section 2. Single-shot and two-shot prompting ..................................................................................... 20
Section 3. Inspect the foundation model Python code........................................................................... 25
Section 4. Model options and tokens...................................................................................................... 30
Exercise 3. Exercise review and wrap-up ........................................................................................................ 35
3. Exercise review and wrap-up .................................................................................................................. 36

© Copyright IBM Corp. 2023 4


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

Exercise 1. Prepare your lab


environment
Estimated time
20:00 minutes

Overview
In this exercise, you set up your IBM Cloud account and log in to the watsox platform. If you
already have an account, you can skip the creation of an IBM Cloud account.
After the creation of an IBM Cloud account, you log in to the IBM cloud and switch to the watsonx
platform.

Objectives
After completing this exercise, you should have an existing IBM Cloud account and be logged in to
watsonx.
To complete all exercises, you need to have a running instance of Watson Machine Learning. You
create a Watson Machine Learning service by using the Lite plan and associate the service with a
project.
At the end of this exercise, you have access to the wasonx.ai prompt lab.

Requirements

• A valid email address and password


• Personal information such as name, country, and phone number
• Billing and payment information

© Copyright IBM Corp. 2023 5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

1. Prepare your lab environment


To get started, you need to get access to the lab environment in the IBM Cloud.

Section 1. Create an IBM Cloud account.


__ 1. Go to the Try IBM Cloud Pak for Data for free page.

__ 2. Select the Dallas region.


__ 3. Read the terms and check I agree to the terms and I have read the Data Use Policy,
including Cookie use checkbox.
__ 4. If you are not a current IBM Cloud account holder, click Create an IBM Cloud account
and complete the required information to create an IBM Cloud account.
__ 5. Record IBM Cloud credentials for further use.

Section 2. Log in to watsonx


In this section, you log in to the IBM Cloud and navigate to the watsonx platform.
__ 1. Go to the IBM Cloud and log in with your IBMid. You are greeted with the IBM Cloud
welcome page and dashboard.

© Copyright IBM Corp. 2023 6


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

__ 2. Click the Navigation Menu (four horizontal bars) in the upper-left quadrant of the page,
scroll down and click watsonx. If you want to experiment with Cloud Pak for Data and all
the data and AI services that the platform provides, you can also select Cloud Pak for
Data.

__ 3. Click Get started in the watsonx.ai tile.

© Copyright IBM Corp. 2023 7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

__ 4. Scroll to the end of the panel on the left and click Log in with your IBM Cloud
credentials.

__ 5. A pop-up window containing the watsonx welcome message appears. Click the check-box
and accept the terms of using the software.

© Copyright IBM Corp. 2023 8


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

__ 6. Click x in the upper-right quadrant of the pop-up message to skip the tour. The watsonx
welcome screen appears.

Before you can experiment with the Prompt Lab, you need to create a Watson Machine Learning
instance.

Section 3. Set up your lab environment


In this section, you create a project and a Watson Machine Learning service. You then associate
the machine learning service instance to a project.
__ 1. Click the Navigation Menu in the upper-left quadrant and click Projects > View all
projects.
__ 2. Click New Project in the upper-right quadrant of the page.
__ 3. Click Create an empty project.

© Copyright IBM Corp. 2023 9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

__ 4. Enter Prompt Lab in the Name field, attach object storage by clicking on an object storage
instance from the drop-down list and click Create.
__ 5.

__ 6. Attach object storage by clicking on an object storage instance from the drop-down list and
click Create.
__ 7. Click the Assets tab.

© Copyright IBM Corp. 2023 10


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

The current project has no assets.

__ 8. Click the Navigation menu and click Services > Services catalog.

© Copyright IBM Corp. 2023 11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

__ 9. Click the Watson Machine Learning tile under the AI / Machine Learning category.

__ 10. Verify that the Lite plan is selected and click Create.

© Copyright IBM Corp. 2023 12


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

__ 11. A new Watson Machine Learning service was created.


__ 12. Click the Navigation Menu and click Home to get back to the watsonx welcome screen.
__ 13. Click the Experiment with foundation models and build prompts tile.

__ 14. Although the Watson Machine Learning service was created, the service instance needs
to be associated to the project to be able to experiment with the Prompt Lab. Click
Associate service.

© Copyright IBM Corp. 2023 13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

__ 15. Click the checkbox next to the Watson Machine Learning instance and click Associate.

__ 16. Click the Navigation menu and click Home to get back to the watsonx welcome screen.
__ 17. Click the Experiment with foundation models and build prompts tile.

© Copyright IBM Corp. 2023 14


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

__ 18. The Prompt Lab GUI opens.

You are now ready to start experimenting with the Prompt Lab.

End of exercise

© Copyright IBM Corp. 2023 15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

Exercise 2. Prompt engineering


Estimated time
30:00 minutes

Overview
This exercise covers the following tasks:
• Experimenting with the prompt Lab
• Creating a series of ever more complex prompts
• Inspecting the Python code that the prompt Lab generates
• Changing the default Prompt Lab settings

Introduction
This exercise introduces you to the Prompt Lab in watsonx. First, you experiment with simple
prompts to get a feel for the environment. Second, you create more elaborate prompts to steer the
underlying foundation model in the right direction. Third, you inspect the underlying Python code
generated by the lab. Fourth, you change the underlying foundation model and experiment with
different lab settings.
After this exercise, you should be able to set up and experiment with prompts in the Prompt Lab.

Requirements
• Access to IBM Cloud Pak for Data, IBM watsonx.
• Knowledge of working with graphical user interfaces.

© Copyright IBM Corp. 2023 16


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

2. Introduction
Verify that you are still logged in to the IBM Cloud and watsonx. If not, go back to Exercise 1 and
revisit how to log in to the IBM Cloud and watsonx.
Erik is new to prompt engineering, so he will first explore the interface with some basic prompts
and gradually increase the complexity of the prompts as he gains more experience.
After the exercise, Erik will recommend some use cases for generative AI and foundation models
to the company.

Section 1. Zero-shot prompting


In this section, Erik, the AI specialist, creates a couple of basic prompts. Creating basic prompts
without any examples or any other additional information is also called zero-shot prompting.
You can create prompts in a structured or a freeform way. Using the structured approach, you give
the model instructions on what to do, examples of how to format the response, and text that you
want the model to process. All this information is then concatenated to form a prompt that is
passed to the selected foundation model. In the freeform approach, your text is formatted in one
text box.
As Erik is new to prompt engineering, he starts with the structured approach and interface (which
is the default option when you open the Prompt Lab).
__ 1. Click the AI Guardrails checkmark button in the upper-right quadrant to set AI guardrails to
on.

This setting removes any potentially harmful input and output text, such as hate speech,
abuse, or profanity. The default setting is for the guardrails to be off (no filtering of input or
output text).
__ 2. Scroll to the end of the displayed Prompt Lab page and type in the following prompt in the
Input: text box under the Try section.

© Copyright IBM Corp. 2023 17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

Input: List ideas to start a dog-walking business:


__ 3. Click Generate. The output of the foundation model is given in the Output: text box. Inspect
the output.

The response is underwhelming. After exploring the sample prompts from the IBM
Documentation Tips for writing foundation model prompts: prompt engineering — Docs |
IBM watsonx, Erik decides to take “baby steps” and gradually increase the complexity of
the prompt, incorporating what he learned from studying the tips for writing prompts.
__ 4. A tip to receive a structured response is to include a cue to start the response in the
wanted structure. In this case, add the two characters, "1.", to the prompt. This small
change might improve the response. Click New test + .
__ 5. Add a line of text with “1.” to the previous prompt. Click Generate.

© Copyright IBM Corp. 2023 18


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

The response is still underwhelming. Erik decides to investigate the current model
parameters.
__ 6. Click the Model parameters icon in the upper-right quadrant (two horizontal lines with
offset circles). Scroll down and inspect the Stopping criteria.

The reason for the underwhelming result might be the minimum and the maximum number
of tokens setting. The Max tokens is set to 20, which gives the model little leeway to
generate a meaningful response (on average 1 token is equivalent to 4 characters).
__ 7. Delete the previous prompts and add a new test with the same prompt. Change the Max
tokens value to 100 and the Min tokens to 50 to “force” the foundation model to generate a
longer response (more characters).

__ 8. Click Generate. The results improved dramatically, but there is much repetition of the
string “Start a dog-“ in the response. After further consideration, Erik decides to increase
the repetition penalty from 1 to 2.

© Copyright IBM Corp. 2023 19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

__ 9. Changing the Repetition penalty in the Model parameters panel from 1 to 2 to minimize
repetition. Slide the slider from 1 to 2 or directly type in 2 in the Repetition penalty number
box.

__ 10. Click Generate.

Increasing the repetition penalty creates a dramatic improvement over the previous
responses.

Section 2. Single-shot and two-shot prompting


Erik also learned from reading the Tips for writing foundation model prompts that adding examples
might improve the response. To receive a higher-quality response, you should provide an example
of the kind of response you want. This approach is called single-shot or one-shot prompting.
__ 1. Under Examples, add the expected Input: and Output: on starting a lemonade business.

© Copyright IBM Corp. 2023 20


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

Input: List ideas to start a lemonade business:


Output:
1. Setup a lemonade stand
2. Partner with a restaurant
3. Arrange for a celebrity to endorse the lemonade stand
Click Generate.

The response is more concise and an improvement over the previous response.
__ 2. Add another example of how to start a landscaping business.

© Copyright IBM Corp. 2023 21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

Input: List ideas to start a landscaping business:


Output:
1. Setup a basic lawn care business and move up to more elaborate landscaping as your
experience grows
2. Buy some inexpensive equipment like a lawn mower, rakes, shovels, etc.
3. Purchase used lawn furniture from estate sales or yard sales at very low cost
Click Generate.

The result is even better and contains more creative ideas.


__ 3. Reviewing the Prompt Lab interface and thinking back to the tips for writing good prompts,
Erik noticed that he did not provide any instructions in the Instruction text box. An
instruction is an imperative statement that tells the model what to do. In this case, the
imperative statement refers to an unconditional action to be taken by the foundation model.
Add the following instructions in the text box.

Instruction: Act as an entrepreneur starting a small one-person business. List ideas to


start a successful business.

© Copyright IBM Corp. 2023 22


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

The important keywords trying to steer the model in the right direction are “Act”,
“entrepreneur”, “one-person”, and “successful”.
Click Generate.

This change results in the best response yet. It contains some innovative ideas and
practical advice for starting a dog-walking business.
__ 4. It is always a good idea to test your prompt on multiple examples before you assume that
the prompt is working as intended. Erik decides to give the foundation model one more
example to test its effectiveness in teasing out responses from the foundation model. Erik
decides to prompt the foundation model to list ideas to start a car detailing business.

Input: List ideas to start a car detailing business:


1.

The response is appropriate, and Erik is delighted with his progress.

© Copyright IBM Corp. 2023 23


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

At the beginning of the prompt, you saw that there are two ways to construct your prompt:
using the Structured or the Freeform interface. Erik has so far focused on the Structured
way of creating a prompt and is curious how it differs from the Freeform way. Click the
Freeform option to switch interfaces.

__ 5. Click Switch mode to switch to the Freeform mode.

The interface changes and you are viewing one large prompt containing all the information
previously completed.

After you become familiar with the Prompt Lab, it might be easier, faster, and more
convenient to construct the prompt in the unstructured or freeform way. The response from
the foundation model is unaffected by which interface you prefer.

__ 6. If you would like to generate alternative responses, change the Decoding parameter from
Greedy to Sampling. Selecting the sampling parameter option instructs the foundation

© Copyright IBM Corp. 2023 24


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

model to customize the variability of word selection. This setting change lets the model
create alternative responses instead of re-creating a previous response. Click Sampling in
the Decoding option.
__ 7. Click Generate.

The response is pleasing.

Important: After you set the decoding parameter to Sampling, your responses might be different
from what is given in this course. This result is as expected as more variability in word selection
might lead to different responses.

Section 3. Inspect the foundation model Python code


Erik is also interested in seeing the Python code that was generated in the background.
__ 1. Click Save work in the upper-right quadrant of the interface.

__ 2. Click Save as.


__ 3. Click the Prompt session tile and give the session a descriptive name, such as Prompt
Lab. Click Save to save the Prompt Session.
__ 4. Click Save work in the upper-right quadrant of the interface.

© Copyright IBM Corp. 2023 25


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

__ 5. Click the Notebook tile and give the Python notebook a descriptive name, such as Prompt
Lab. Click the View in project after saving box. Click Save to save the notebook.

__ 6. Click Maybe later to skip the code editor tour.

The Notebook opens and you can inspect the code, modify the code, and use the notebook
as a template for other Prompt Lab experiments.

© Copyright IBM Corp. 2023 26


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

Cell 6 of the Jupyter Notebook contains the Python prompt equivalent of what you input in
the Prompt Lab GUI.

__ 7. Click Edit in the upper-right quadrant of the interface.

The runtime for the Prompt Lab Jupyter Notebook instantiates.


__ 8. Retrieve your API key (for more information on how to generate your IBM Cloud personal
API key, click the documentation link Documentation).

__ a. Click the Navigation menu and click Access (IAM).

© Copyright IBM Corp. 2023 27


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

__ b. Click API keys from the menu on the left of the screen.

__ c. Click Create.

© Copyright IBM Corp. 2023 28


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

__ d. Enter a name and description for your API key, such as watsonx and watsonx API key.

__ e. Click Create. The API key is generated.

__ f. Click Show (eye icon) to display the API key.


__ g. Click Copy to copy your API key.

© Copyright IBM Corp. 2023 29


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

__ 9. Click the Home | IBM watsonx tab in your browser to return to the watsonx GUI and your
Jupyter Notebook.
__ 10. Click Cell > Run All to run the notebook.

__ 11. Paste your API key in the browser when asked and press Enter.
__ 12. The rest of the Notebook is executed and the following response is generated.

The response is slightly different from what you got previously as the Decoding parameter
is set to Sampling. The response is pleasing again.

Section 4. Model options and tokens


Different foundation models might also generate different responses to a prompt. This difference is
expected as the models might have different architectures, a different number of parameters, and
the models might have been trained on different data sets.
__ 1. Click Prompt Lab in the upper left quadrant of your project to get back to your Prompt Lab
Project.

__ 2. Click Prompt Lab session under the Assets tab.

© Copyright IBM Corp. 2023 30


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

You are now back at your prompt session.


__ 3. Click the current foundation model flan-ul2-20b to open a menu. Click View all
foundation models to see a list of the currently available foundation models.

The following models are available (this list might change over time).

For example, Flan-ul2-20b is a general foundation model with 20 billion parameters


suitable for zero-shot and few-shot prompt engineering in Prompt Lab.
Sometimes, you might also need to experiment with a more complex model if the response
to your prompt is unsatisfactory. You might also need to explore different types of models
based on different architectures, such as coder-decoder or decoder-only models. Models
might also be trained on different data sets, and in different languages. Inspect the
documentation by clicking on a particular model in the GUI.
__ 4. Sometimes you can get similar results that use a smaller model (which might save
resources). Click flan-t5-xxl-11b to select a smaller model (11 billion parameters), still

© Copyright IBM Corp. 2023 31


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

based on the same underlying model family (Flan-T5). Read the Note and terms of use and
click Select model.

__ 5. Remove the previous response from the Prompt Lab and click Generate to generate a new
response.

The response is acceptable and Erik can do some more experiments to evaluate this
model for future use.

Information: Each time you enter a prompt, your “input tokens” and “generated tokens” will update
in the lower-left quadrant of the interface. Tokens are an important concept to understand as they
constrain the performance of your model and determine the cost of using foundation models.
Tokens are not a 1:1 match with words in natural language. On average, one token is equal to 4
characters. Before sending your prompt to the model, the prompt's text is tokenized or broken into
smaller subsets of characters than can be better understood by the model. The correlation
between words and tokens is complex. A single word might be broken into multiple tokens,
depending on context (such as where the word appears in a sentence, or what the surrounding
words are). Spaces, newline characters, and punctuation might be included in tokens. The way
words are broken into tokens varies from language to language and from model to model.
Important: It is important to monitor your token usage to know how much information you are
feeding into the model with each prompt, and how much text is generated for you. Depending on
the model selected in Prompt Builder, you see a max of 2048 or 4096 tokens. Keep in mind that

© Copyright IBM Corp. 2023 32


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

the more expressive you are with your prompt instructions, the less room the model has to
respond back to you. The number of tokens used (input plus generated text) can be found in the
lower-left quadrant of the interface.

__ 6. Click the Sample prompts, Saved prompts and History icons in the left panel of your
prompt session to get additional information on tasks you can perform with suggested
prompts, saved prompts, and a history of your current prompt session.

The Sample prompts might be useful for suggesting more tasks that a foundation model
might solve, and how to get started with a particular task.

The last task for Erik is to recommend to his manager how this new technology might be used in
their company. This recommendation is covered in the next exercise.

End of exercise

© Copyright IBM Corp. 2023 33


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

© Copyright IBM Corp. 2023 34


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

Exercise 3. Exercise review and wrap-


up
Estimated time
10:00 minutes

Overview
This exercise covers the following tasks:
• Summarizing what you learned and achieved working through the labs.
• Identifying use cases for foundation models in the health products company.

Introduction
This section reviews what you learned experimenting with the Prompt Lab and provides
suggestions for use cases that might benefit the company in their endeavor to master this new
technology, called foundation models.
After this exercise, you should be able to talk intelligently about generative AI and foundation
models with colleagues.

Requirements
• Access to IBM Cloud Pak for Data, IBM watsonx.
• Knowledge of working with graphical user interfaces.

© Copyright IBM Corp. 2023 35


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM watsonx Foundations

3. Exercise review and wrap-up


In the exercises, you used the functionality available in IBM watsonx to build prompts in the
Prompt Lab. You started with a basic prompt (zero-shot prompting) and iterated until you had a
prompt that performed well on a couple of examples. During each successive iteration, you
improved the cue, added more examples, and finally added an imperative statement (called an
instruction) to improve your prompt. You also looked at the Prompt Lab settings and adjusted
several settings to steer the foundation model toward generating the wanted responses.
You followed Erik in his journey to explore foundation models in the watsonx platform. The only
question remaining is how Erik’s knowledge can benefit the company in their quest to use the
power of foundation models.
After careful consideration, Erik identified at least four use cases where foundation models can
possibly be used successfully in the company:
1. Generating marketing emails to customers.
2. Answering health product-related questions.
3. Doing sentiment analysis of survey responses.
4. Classifying survey responses into different categories, such as product, price, quality, etc.,
for further action.
Erik will prepare a presentation on his findings and share it with colleagues and management.
After completing these exercises, you should have all the necessary skills to use the Prompt Lab
successfully in watsonx.

© Copyright IBM Corp. 2023 36


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

You might also like