Microsoft Prompt Flow Hands On

What is Prompt Flow?

  • It is a tool that links LLMs, Python Code, and Prompts together, to create a generative AI application.
  • It is developed and open-sourced by Microsoft.
  • It also integrates with tools that test and deploy your application.

Read more here.


Hands-On

As suggested by its name, in a prompt flow project the developer defines one or multiple flows that handle the application use cases. To be hands-on, I decided to build a bot that handles leave applications for the employees.

1) First we construct a prompt, that defines what are the information we need and what are some of the leave policies we have.

We also tell the bot to not answer anything unrelated to the leave application.

2) We run the app, and let's see if it can tell me about my salary raise.

The application knows this question is unrelated.

3) Now we try to apply leaves.

It seems alright, BUT...

  • The dates aren’t printed in the correct format.
  • It is just today and tomorrow
  • Because the GPT model does not know the date/time.
  • Imagine you go into a library with lots of books and knowledge, you will not know what is the current date and time by reading any of those books.

4) Let's try adding context, which is the date and time.

This is where Python code comes in, to combine it with plain text prompts. Now our flow has a new block, where get_date_time is a simple Python code that prints the device time.

5) With the new updates, let's try to apply for leave again.

Now it knows what is the date when I say tomorrow.

6) I also tried to confuse the bot by changing the day, and it handled it well. The output is in markdown format, as requested.

7) But we still have a problem. When I run the app the second time, the application gives me a slightly different markdown format.

8) I decide to change the format to JSON. And give it some samples to refer to.

And now, we have a pretty JSON format as the output.

Some notes:

  • The model used is GPT3.5 Turbo.
  • The app does not factor in employee authentication
  • The app could be enhanced to send the data to the leave application endpoint.

AI Summary
gpt-4o-2024-05-13 2024-07-16 00:40:34
Microsoft Prompt Flow is an open-source tool that integrates LLMs, Python code, and prompts to create generative AI applications. This hands-on project demonstrates building a bot that handles leave applications for employees, highlighting challenges and solutions for integrating date and time context, formatting issues, and potential enhancements.
Chrome On-device AI 2024-07-20 06:33:05

Share Article