|
| 1 | +# Travel Plan (Topic) |
| 2 | + |
| 3 | +This is a snippet that demonstrates how to use an AI prompt in a Copilot Studio Topic. It uses an Adaptive Card to gather inputs and an AI prompt to generate a travel plan for a trip. |
| 4 | + |
| 5 | +  |
| 6 | + |
| 7 | +## Authors |
| 8 | + |
| 9 | +Snippet|Author(s) |
| 10 | +--------|--------- |
| 11 | +Travel Plan (Topic) | [Daniel Laskewitz](https://github.com/laskewitz) ([@laskewitz](https://www.twitter.com/laskewitz)) |
| 12 | + |
| 13 | +## Minimal path to awesome |
| 14 | + |
| 15 | +1. Open a copilot in **Copilot Studio** |
| 16 | +1. Select **Topics** |
| 17 | +1. Select **+ Add a topic** |
| 18 | +1. Select **From blank** |
| 19 | +1. Change the name from **Untitled** to **Travel Plan** |
| 20 | +1. Select **More** |
| 21 | +1. Select **Open code editor** |
| 22 | +1. Paste the contents of the **[YAML-file](./source/travel-plan.yaml)** in the code editor |
| 23 | +1. Select **Close code editor** |
| 24 | + |
| 25 | + Don't worry about the error you'll see in the message card, later on that will disappear. |
| 26 | + |
| 27 | +1. Select the **+** after the adaptive card to add a node |
| 28 | +1. Select **Call an action** in the popout |
| 29 | +1. Select **Create a prompt** in the next area |
| 30 | + |
| 31 | +  |
| 32 | + |
| 33 | + This will open the AI Builder prompt builder |
| 34 | + |
| 35 | +1. Enter **Travel Plan** as the name for the prompt at the top |
| 36 | +1. Enter the following prompt as the prompt: |
| 37 | + |
| 38 | + `Pease give me [Number] options for activities in [Destination] for people who are there for the first time. Please return a numbered list with emojis in the name of the activity and give it a brief description.` |
| 39 | + |
| 40 | +1. Under Prompt settings, select **Input** |
| 41 | +1. Select **+ Add input** |
| 42 | +1. Enter **Number** as the name |
| 43 | +1. Enter **3** as the sample data |
| 44 | +1. Select **+ Add input** again |
| 45 | +1. Enter **Destination** as the name |
| 46 | +1. Enter **Amsterdam, The Netherlands** as the sample data |
| 47 | +1. Select **[Number]** in the prompt and remove it from the prompt, leaving the cursor on that spot |
| 48 | +1. Select the **+ Insert** button |
| 49 | +1. Select **Number** in the popout - this will add the input to your prompt |
| 50 | +1. Select **[Destination]** in the prompt and remove it from the prompt, leaving the cursor on that spot |
| 51 | +1. Select the **+ Insert** button again |
| 52 | +1. Select **Destination** in the popout to add destination to the prompt as well |
| 53 | + |
| 54 | + Now you have replaced the text with actual inputs, and this means you can now test the prompt |
| 55 | + |
| 56 | +1. Select the **Test prompt** button under the prompt to test the prompt with the sample data |
| 57 | + |
| 58 | + This will show an example output of the prompt response in the Prompt response section |
| 59 | + |
| 60 | +1. Select the **Save custom prompt** button |
| 61 | +1. Back in Copilot Studio, you will not directly see the prompt. Make sure to search for **Travel Plan** and it will show for you |
| 62 | +1. Select **Travel Plan** |
| 63 | + |
| 64 | +  |
| 65 | + |
| 66 | +1. Select **>** in the **Destination** input and select the **destination** variable (this is the output of the adaptive card) |
| 67 | +1. Select **>** in the **Number** input and select the **number** variable |
| 68 | +1. Select **>** in the **predictionOutput** output and select the **Create new** button to create a new variable |
| 69 | + |
| 70 | + This will automatically create a variable called *Var1*. |
| 71 | + |
| 72 | +1. Select **Var1** |
| 73 | + |
| 74 | + This will open the *Variable properties* panel |
| 75 | + |
| 76 | +1. Change the name from **Var1** to **promptOutput** |
| 77 | +1. Close the **Variable properties** panel |
| 78 | + |
| 79 | +  |
| 80 | + |
| 81 | +1. Select **Prompt output** in the message node by clicking on it (1) |
| 82 | +1. Remove the text **Prompt output** |
| 83 | +1. Select the variable icon **{x}** (2) |
| 84 | +1. Select **promptOutput.text** (3) - this is the generated text by the prompt. |
| 85 | +1. **Save** the topic |
| 86 | +1. Test out the **topic** by using the **Test copilot** section and send `Can you help me with a travel plan?` |
| 87 | +1. Fill in the card by adding a **Location** and a number of **Activities** |
| 88 | +1. When you get a response with a bunch of activities in the location you entered, you're **done**! |
| 89 | + |
| 90 | +  |
| 91 | + |
| 92 | +## Disclaimer |
| 93 | + |
| 94 | +**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** |
| 95 | + |
| 96 | +<img src="https://m365-visitor-stats.azurewebsites.net/powerplatform-snippets/copilot-studio/travel-plan-topic" aria-hidden="true" /> |
0 commit comments