A reusable Power Platform snippet

Travel Plan (Topic)

This is a snippet that demonstrates how to use an AI prompt in a Copilot Studio Topic.

Copilot Studio
Preview PNG
Last updated
Aug 27, 2024
Category
Community snippet

From idea to implementation

Make it your own.

Check this snippet's prerequisites, permissions, and licensing before using it. The documentation below comes directly from the snippet README.

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.

A view of the output of the topic

Authors

Snippet Author(s)
Travel Plan (Topic) Daniel Laskewitz (@laskewitz)

Minimal path to awesome

  1. Open a copilot in Copilot Studio

  2. Select Topics

  3. Select + Add a topic

  4. Select From blank

  5. Change the name from Untitled to Travel Plan

  6. Select More

  7. Select Open code editor

  8. Paste the contents of the YAML-file in the code editor

  9. Select Close code editor

    Don't worry about the error you'll see in the message card, later on that will disappear.

  10. Select the + after the adaptive card to add a node

  11. Select Call an action in the popout

  12. Select Create a prompt in the next area

    View of the create prompt action.

    This will open the AI Builder prompt builder

  13. Enter Travel Plan as the name for the prompt at the top

  14. Enter the following prompt as the prompt:

    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.

  15. Under Prompt settings, select Input

  16. Select + Add input

  17. Enter Number as the name

  18. Enter 3 as the sample data

  19. Select + Add input again

  20. Enter Destination as the name

  21. Enter Amsterdam, The Netherlands as the sample data

  22. Select [Number] in the prompt and remove it from the prompt, leaving the cursor on that spot

  23. Select the + Insert button

  24. Select Number in the popout - this will add the input to your prompt

  25. Select [Destination] in the prompt and remove it from the prompt, leaving the cursor on that spot

  26. Select the + Insert button again

  27. Select Destination in the popout to add destination to the prompt as well

    Now you have replaced the text with actual inputs, and this means you can now test the prompt

  28. Select the Test prompt button under the prompt to test the prompt with the sample data

    This will show an example output of the prompt response in the Prompt response section

  29. Select the Save custom prompt button

  30. Back in Copilot Studio, you will not directly see the prompt. Make sure to search for Travel Plan and it will show for you

  31. Select Travel Plan

    Screenshot of how to insert the prompt node into the topic

  32. Select > in the Destination input and select the destination variable (this is the output of the adaptive card)

  33. Select > in the Number input and select the number variable

  34. Select > in the predictionOutput output and select the Create new button to create a new variable

    This will automatically create a variable called Var1.

  35. Select Var1

    This will open the Variable properties panel

  36. Change the name from Var1 to promptOutput

  37. Close the Variable properties panel

    A view of the steps to be taken in the next steps

  38. Select Prompt output in the message node by clicking on it (1)

  39. Remove the text Prompt output

  40. Select the variable icon {x} (2)

  41. Select promptOutput.text (3) - this is the generated text by the prompt.

  42. Save the topic

  43. Test out the topic by using the Test copilot section and send Can you help me with a travel plan?

  44. Fill in the card by adding a Location and a number of Activities

  45. When you get a response with a bunch of activities in the location you entered, you're done!

A view of the output of the topic

Disclaimer

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.