Skip to content

Commit

Permalink
Merge pull request #80 from aprildunnam/main
Browse files Browse the repository at this point in the history
Add AI Time Plan Flow Sample
  • Loading branch information
Katerina-Chernevskaya authored Mar 10, 2024
2 parents d06c335 + a504b94 commit 5ffac67
Show file tree
Hide file tree
Showing 25 changed files with 790 additions and 0 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified samples/.DS_Store
Binary file not shown.
Binary file added samples/ai-time-management-flow/.DS_Store
Binary file not shown.
74 changes: 74 additions & 0 deletions samples/ai-time-management-flow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# AI Daily Time Management Plan

## Summary

A daily flow that utilizes a custom Prompt in AI Builder to take your Outlook calendar events and Microsoft ToDo (Business) tasks for the day and formulates a plan for how to allot your time for the day.

![picture of the flow](assets/flow.png)

## Applies to

* [Microsoft Power Automate](https://docs.microsoft.com/en-us/power-automate/getting-started)
* [Azure Logic Apps](https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-overview)
* [AI Builder Custom Prompts](https://learn.microsoft.com/en-us/ai-builder/create-a-custom-prompt)

## Compatibility

![Premium License](https://img.shields.io/badge/Premium%20License-Required-yellow.svg "Premium license required")
![On-Premises Connectors](https://img.shields.io/badge/On--Premises%20Connectors-No-green.svg "Does not use on-premise connectors")
![Custom Connectors](https://img.shields.io/badge/Custom%20Connectors-Not%20Required-green.svg "Does not use custom connectors")

## Features
This solution consists of a Scheduled Cloud Flow and a Custom AI Builder Prompt from the [Power Platform Prompts Library](https://aka.ms/prompts/time-management).

It demonstrates how to:
* Call an AI Prompt in a Flow
* Pass dynamic inputs into the prompt
* Get a customized AI generated plan in HTML format so that it's email ready.

The only configuration required is to fill in the Compose action with the email you want to send the daily time management plan to as seen below:

![picture of the flow](assets/email.png)

You will also need to customize the recurrence to your needs. It is set to 7am daily. If you change the time you'll also need to update the Filter in the Get Events action so accomodate for the time change as seen below:

![picture of the flow](assets/getEventsLe.png)

## Authors

Solution|Author(s)
--------|---------
ai-time-management-flow | [April Dunnam](https://github.com/aprildunnam), Microsoft

## Version history

Version|Date|Comments
-------|----|--------
1.0|March 4, 2024|Initial release

## Minimal Path to Awesome

* [Download](./solution/ai-time-management-flow.zip) the `.zip` from the `solution` folder
* [Import](https://learn.microsoft.com/en-us/power-apps/maker/data-platform/import-update-export-solutions) the `.zip` file using **Solutions** > **Import solution** within Power Apps Maker portal.

## 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.**

## Help

We do not support samples, but we this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.

If you encounter any issues while using this sample, [create a new issue](https://github.com/pnp/powerautomate-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=bug-report.yml&sample=ai-time-management-flow&authors=@aprildunnam&title=ai-time-management-flow%20-%20).

For questions regarding this sample, [create a new question](https://github.com/pnp/powerautomate-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=question.yml&sample=ai-time-management-flow&authors=@aprildunnam&title=ai-time-management-flow%20-%20).

Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/powerautomate-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=suggestion.yml&sample=ai-time-management-flow&authors=@aprildunnam&title=ai-time-management-flow%20-%20).

## For more information

- [Create your first flow](https://docs.microsoft.com/en-us/power-automate/getting-started#create-your-first-flow)
- [Microsoft Power Automate documentation](https://docs.microsoft.com/en-us/power-automate/)


<img src="https://m365-visitor-stats.azurewebsites.net/powerplatform-samples/samples/ai-time-management-flow" />
Binary file not shown.
Binary file added samples/ai-time-management-flow/assets/email.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/ai-time-management-flow/assets/flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions samples/ai-time-management-flow/assets/sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[
{
"name": "pnp-powerplatform-samples-ai-time-management-flow",
"source": "pnp",
"title": "AI Time Managemeent Plan Flow",
"shortDescription": "A daily flow that utilizes a custom Prompt in AI Builder to take your Outlook calendar events and Microsoft ToDo (Business) tasks for the day and formulates a plan for how to allot your time for the day.",
"url": "https://github.com/pnp/powerplatform-samples/tree/main/samples/ai-time-management-flow",
"downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/powerplatform-samples/tree/main/samples/ai-time-management-flow",
"longDescription": [
"A daily flow that utilizes a custom Prompt in AI Builder to take your Outlook calendar events and Microsoft ToDo (Business) tasks for the day and formulates a plan for how to allot your time for the day."
],
"creationDateTime": "2024-03-04",
"updateDateTime": "2024-03-04",
"products": [
"Power Automate",
"Power Platform",
"AI Builder"
],
"tags": [
"Prompts"
],
"categories": [
"POWERAUTOMATE"
],
"metadata": [
{
"key": "POWERAPPS-EXPERIMENTAL",
"value": "No"
},
{
"key": "POWERAUTOMATE-PREMIUM",
"value": "yes"
},
{
"key": "POWERAUTOMATE-ONPREM",
"value": "No"
},
{
"key": "POWERAUTOMATE-CUSTOMCONNECTOR",
"value": "No"
}
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://github.com/pnp/powerplatform-samples/raw/main/samples/ai-time-management-flow/assets/flow.png",
"alt": "App preview"
}
],
"authors": [
{
"gitHubAccount": "aprildunnam",
"pictureUrl": "https://github.com/aprildunnam.png",
"name": "April Dunnam"
}
],
"references": [
{
"name": "Create your first flow",
"description": "Anyone from a basic business user to an IT professional can create automated processes using Power Automate's no-code/low-code platform.",
"url": "https://docs.microsoft.com/en-us/power-automate/getting-started#create-your-first-flow"
},
{
"name": "Microsoft Power Automate documentation",
"description": "Power Automate is a service that helps you create automated workflows between your favorite apps and services to synchronize files, get notifications, collect data, and more.",
"url": "https://docs.microsoft.com/en-us/power-automate/"
}
]
}
]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PowerAppsTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\PowerApps</PowerAppsTargetsPath>
</PropertyGroup>

<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.props" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.props')" />

<PropertyGroup>
<ProjectGuid>d195e61b-d2f4-4e94-8483-018c0372fd88</ProjectGuid>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<!--Remove TargetFramework when this is available in 16.1-->
<TargetFramework>net462</TargetFramework>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<SolutionRootPath>src</SolutionRootPath>
</PropertyGroup>

<!--
Solution Packager overrides, un-comment to use: SolutionPackagerType (Managed, Unmanaged, Both)
Solution Localization Control, if you want to enabled localization of your solution, un-comment SolutionPackageEnableLocalization and set the value to true. - Requires use of -loc flag on Solution Clone or Sync
-->
<!--
<PropertyGroup>
<SolutionPackageType>Managed</SolutionPackageType>
<SolutionPackageEnableLocalization>false</SolutionPackageEnableLocalization>
</PropertyGroup>
-->

<ItemGroup>
<PackageReference Include="Microsoft.PowerApps.MSBuild.Solution" Version="1.*" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\.gitignore" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\bin\**" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\obj\**" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.cdsproj" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.cdsproj.user" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.sln" />
</ItemGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\**" Exclude="@(ExcludeDirectories)" />
<Content Include="$(SolutionPackageZipFilePath)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.targets" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.targets')" />

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<ImportExportXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Entities />
<Roles />
<Workflows />
<FieldSecurityProfiles />
<Templates />
<EntityMaps />
<EntityRelationships />
<OrganizationSettings />
<optionsets />
<CustomControls />
<EntityDataProviders />
<AIModels>
<AIModel>
<msdyn_aimodelid>{65320871-cfe9-42a6-9785-7858b6967c6f}</msdyn_aimodelid>
<msdyn_name>Time Management</msdyn_name>
<msdyn_templateid>{edfdb190-3791-45d8-9a6c-8f90a37c278a}</msdyn_templateid>
<statecode>1</statecode>
<statuscode>1</statuscode>
<IsCustomizable>1</IsCustomizable>
<msdyn_activerunconfigurationid>{0f574678-cad9-ee11-904d-0022482a4279}</msdyn_activerunconfigurationid>
<AIConfigurations>
<AIConfiguration>
<msdyn_aiconfigurationid>{0f574678-cad9-ee11-904d-0022482a4279}</msdyn_aiconfigurationid>
<msdyn_customconfiguration>{"version":"GptDynamicPrompt-1","prompt":[{"type":"literal","text":"Create a time management plan for a workday, given these tasks and priorities "},{"type":"inputVariable","id":"priorities","text":"priorities"},{"type":"literal","text":". Take into account the meetings already in place for the day "},{"type":"inputVariable","id":"meetings","text":"meetings"},{"type":"literal","text":" and display a breakdown of focus allocations by time. Format response as HTML.\n\n\n\n"}]}</msdyn_customconfiguration>
<msdyn_majoriterationnumber>6</msdyn_majoriterationnumber>
<msdyn_minoriterationnumber>0</msdyn_minoriterationnumber>
<msdyn_name>65320871-cfe9-42a6-9785-7858b6967c6f_2024-03-04T01:56:53.893Z</msdyn_name>
<msdyn_modelrundataspecification>H4sIAAAAAAAACoWRSwvCMBCE/4rsORdBPPTmE7woaPEe7aoLbRKSDVhK/7tJK75S8BYyM98usw0cDJ7X2laSj2gdaQXZWMBGGc97rXmlmLiGrIElOVPKeisrhAwoGkDAjNnSyTO66JFFQRwYslxoxXjnNDhLLAJ2pv+BjK1HAXltonUuHU4nhzBAXaEVYCxpG8L9rG/sh/bJu8jSvYFvVIXI4TkAein/MW0A7Tz/aUp3jqSq4XbyvpBk3wspcrc9ShcP9Jtad+roKQ/s2T4AOtmtIOgBAAA=</msdyn_modelrundataspecification>
<msdyn_type>190690001</msdyn_type>
<msdyn_aimodelid>{65320871-cfe9-42a6-9785-7858b6967c6f}</msdyn_aimodelid>
<msdyn_trainedmodelaiconfigurationpareid>{ed5cdadd-22d8-ee11-9079-0022482a45d2}</msdyn_trainedmodelaiconfigurationpareid>
<statecode>2</statecode>
<statuscode>7</statuscode>
<IsCustomizable>1</IsCustomizable>
<msdyn_templateversion>1</msdyn_templateversion>
</AIConfiguration>
<AIConfiguration>
<msdyn_aiconfigurationid>{ed5cdadd-22d8-ee11-9079-0022482a45d2}</msdyn_aiconfigurationid>
<msdyn_majoriterationnumber>1</msdyn_majoriterationnumber>
<msdyn_minoriterationnumber>0</msdyn_minoriterationnumber>
<msdyn_modeldata>28c3c42f-82e1-4a8e-9f8a-6f31f2806724</msdyn_modeldata>
<msdyn_name>65320871-cfe9-42a6-9785-7858b6967c6f_2024-03-01T23:24:45.020Z</msdyn_name>
<msdyn_modelrundataspecification>
{
"schemaVersion": 2,
"input": {},
"output": {}
}
</msdyn_modelrundataspecification>
<msdyn_type>190690000</msdyn_type>
<msdyn_aimodelid>{65320871-cfe9-42a6-9785-7858b6967c6f}</msdyn_aimodelid>
<statecode>2</statecode>
<statuscode>6</statuscode>
<IsCustomizable>1</IsCustomizable>
<msdyn_templateversion>1</msdyn_templateversion>
</AIConfiguration>
</AIConfigurations>
</AIModel>
</AIModels>
<connectionreferences>
<connectionreference connectionreferencelogicalname="ms_sharedcommondataserviceforapps_bbd3e">
<connectionreferencedisplayname>Microsoft Dataverse AITimeManagementFlow-bbd3e</connectionreferencedisplayname>
<connectorid>/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps</connectorid>
<iscustomizable>1</iscustomizable>
<statecode>0</statecode>
<statuscode>1</statuscode>
</connectionreference>
<connectionreference connectionreferencelogicalname="ms_sharedoffice365_f3c08">
<connectionreferencedisplayname>Office 365 Outlook AITimeManagementFlow-f3c08</connectionreferencedisplayname>
<connectorid>/providers/Microsoft.PowerApps/apis/shared_office365</connectorid>
<iscustomizable>1</iscustomizable>
<statecode>0</statecode>
<statuscode>1</statuscode>
</connectionreference>
<connectionreference connectionreferencelogicalname="ms_sharedtodo_18ea2">
<connectionreferencedisplayname>Microsoft To-Do (Business) AITimeManagementFlow-18ea2</connectionreferencedisplayname>
<connectorid>/providers/Microsoft.PowerApps/apis/shared_todo</connectorid>
<iscustomizable>1</iscustomizable>
<statecode>0</statecode>
<statuscode>1</statuscode>
</connectionreference>
</connectionreferences>
<Languages>
<Language>1033</Language>
</Languages>
</ImportExportXml>
95 changes: 95 additions & 0 deletions samples/ai-time-management-flow/sourcecode/src/Other/Solution.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<ImportExportXml version="9.2.24015.196" SolutionPackageVersion="9.2" languagecode="1033" generatedBy="CrmLive" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SolutionManifest>
<UniqueName>AITimeManagementFlow</UniqueName>
<LocalizedNames>
<LocalizedName description="AI Time Management Flow" languagecode="1033" />
</LocalizedNames>
<Descriptions>
<Description description="Recurring daily flow that calls an AI Prompt to look at your ToDo tasks for the day and your meetings for the day to create a custom time management plan and send that to you via email" languagecode="1033" />
</Descriptions>
<Version>1.0.0.1</Version>
<Managed>2</Managed>
<Publisher>
<UniqueName>AprilDunnam</UniqueName>
<LocalizedNames>
<LocalizedName description="April Dunnam" languagecode="1033" />
</LocalizedNames>
<Descriptions />
<EMailAddress xsi:nil="true"></EMailAddress>
<SupportingWebsiteUrl xsi:nil="true"></SupportingWebsiteUrl>
<CustomizationPrefix>ms</CustomizationPrefix>
<CustomizationOptionValuePrefix>12470</CustomizationOptionValuePrefix>
<Addresses>
<Address>
<AddressNumber>1</AddressNumber>
<AddressTypeCode>1</AddressTypeCode>
<City xsi:nil="true"></City>
<County xsi:nil="true"></County>
<Country xsi:nil="true"></Country>
<Fax xsi:nil="true"></Fax>
<FreightTermsCode xsi:nil="true"></FreightTermsCode>
<ImportSequenceNumber xsi:nil="true"></ImportSequenceNumber>
<Latitude xsi:nil="true"></Latitude>
<Line1 xsi:nil="true"></Line1>
<Line2 xsi:nil="true"></Line2>
<Line3 xsi:nil="true"></Line3>
<Longitude xsi:nil="true"></Longitude>
<Name xsi:nil="true"></Name>
<PostalCode xsi:nil="true"></PostalCode>
<PostOfficeBox xsi:nil="true"></PostOfficeBox>
<PrimaryContactName xsi:nil="true"></PrimaryContactName>
<ShippingMethodCode>1</ShippingMethodCode>
<StateOrProvince xsi:nil="true"></StateOrProvince>
<Telephone1 xsi:nil="true"></Telephone1>
<Telephone2 xsi:nil="true"></Telephone2>
<Telephone3 xsi:nil="true"></Telephone3>
<TimeZoneRuleVersionNumber xsi:nil="true"></TimeZoneRuleVersionNumber>
<UPSZone xsi:nil="true"></UPSZone>
<UTCOffset xsi:nil="true"></UTCOffset>
<UTCConversionTimeZoneCode xsi:nil="true"></UTCConversionTimeZoneCode>
</Address>
<Address>
<AddressNumber>2</AddressNumber>
<AddressTypeCode>1</AddressTypeCode>
<City xsi:nil="true"></City>
<County xsi:nil="true"></County>
<Country xsi:nil="true"></Country>
<Fax xsi:nil="true"></Fax>
<FreightTermsCode xsi:nil="true"></FreightTermsCode>
<ImportSequenceNumber xsi:nil="true"></ImportSequenceNumber>
<Latitude xsi:nil="true"></Latitude>
<Line1 xsi:nil="true"></Line1>
<Line2 xsi:nil="true"></Line2>
<Line3 xsi:nil="true"></Line3>
<Longitude xsi:nil="true"></Longitude>
<Name xsi:nil="true"></Name>
<PostalCode xsi:nil="true"></PostalCode>
<PostOfficeBox xsi:nil="true"></PostOfficeBox>
<PrimaryContactName xsi:nil="true"></PrimaryContactName>
<ShippingMethodCode>1</ShippingMethodCode>
<StateOrProvince xsi:nil="true"></StateOrProvince>
<Telephone1 xsi:nil="true"></Telephone1>
<Telephone2 xsi:nil="true"></Telephone2>
<Telephone3 xsi:nil="true"></Telephone3>
<TimeZoneRuleVersionNumber xsi:nil="true"></TimeZoneRuleVersionNumber>
<UPSZone xsi:nil="true"></UPSZone>
<UTCOffset xsi:nil="true"></UTCOffset>
<UTCConversionTimeZoneCode xsi:nil="true"></UTCConversionTimeZoneCode>
</Address>
</Addresses>
</Publisher>
<RootComponents>
<RootComponent type="29" id="{cf92c4b1-cad9-ee11-904d-0022482a4279}" behavior="0" />
<RootComponent type="401" id="{65320871-cfe9-42a6-9785-7858b6967c6f}" behavior="0" />
</RootComponents>
<MissingDependencies>
<MissingDependency>
<Required type="90" schemaName="Microsoft.Dynamics.AI.Plugins.CustomApis.AIPluginPredict, Microsoft.Dynamics.AI.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" displayName="Microsoft.Dynamics.AI.Plugins.CustomApis.AIPluginPredict" solution="msdyn_AISolution (202401.3.17.1)" id="{727e8789-bd29-46fa-b00a-3a49605eeb06}">
<package>msdyn_AISolutionAnchor (202401.3.17.1)</package>
</Required>
<Dependent type="CustomAPI" displayName="msdyn_aibdpttimemanagement65320871cfe942a697857858b6967c6f" id.uniquename="msdyn_aibdpttimemanagement65320871cfe942a697857858b6967c6f" />
</MissingDependency>
</MissingDependencies>
</SolutionManifest>
</ImportExportXml>
Loading

0 comments on commit 5ffac67

Please sign in to comment.