Prompt engineering involves trial and error. Keep track of your experimentation and save model-and-prompt combinations that generate the output you want.
When you save your work, you can choose to save it as different asset types. Saving your work as an asset makes it possible to share your work with collaborators in the current project.
Asset type | When to use this asset type | What is saved | How to retrieve the asset |
---|---|---|---|
Prompt asset | When you find a combination of prompt text and prompt engineering parameters that generate the results you want from a specific model and want to reuse it. | Prompt text, model, prompt engineering parameters | From the Saved prompts tab |
Prompt session asset | When you want to keep track of the steps involved with your experimentation so you know what you've tried and what you haven't. | Prompt text, model, prompt engineering parameters for up to 500 prompts submitted during a prompt engineering session. | From the History tab |
Notebook asset | When you want to work with models programmatically, but want to start from the Prompt Lab interface for a better prompt engineering experience. | Prompt text, model, and prompt engineering parameters formatted as Python code and stored as a notebook. | From the Assets page of the project |
Each of these asset types is available from the project's Assets page. Project collaborators with the Admin or Editor role can open and work with them. Your prompt and prompt session assets are locked automatically, but you can unlock them by clicking the lock icon ().
Saving your work
To save your prompt engineering work, complete the following steps:
-
From the header of the prompt editor, click Save work, and then click Save as.
-
Choose an asset type.
-
Name the asset, and then click Save.
Working with prompts saved in a notebook
When you save your work as a notebook asset, a Python notebook is built. The notebook contains runnable code that manages the following steps for you:
- Authenticates with the service by using your IBM Cloud personal API key.
- Defines a Python class.
- Prompts you for model input.
- Uses the defined class to call the watsonx.ai inferencing API and pass your input to the foundation model.
- Shows the output generated by the foundation model.
You can use the notebook as is or change it to meet the needs of your use case. For more information about what you can do with the notebook, see Python library.
Working with saved prompts
To continue working with a saved prompt, open it from the Saved prompts tab of the Prompt Lab.
When you open a saved prompt, it is opened in Structured mode. Autosave is on, which means that any changes you make to the prompt will be reflected in the saved prompt asset.
If you want to preserve the saved prompt, turn off autosave or click New prompt to start a new prompt.
Working with saved prompt sessions
To continue working with a saved prompt session, open it from the History tab of the Prompt Lab. The saved prompt session is opened in Structured mode.
To review previous prompt submissions, you can click a prompt entry from the history to open it in the prompt editor. If you prefer the results from the earlier prompt, you can reset it as your current prompt by clicking Restore. When you restore an earlier prompt, your current prompt session is replaced by the earlier version of the prompt session.
Learn more
Parent topic: Foundation models