Skip to content

Commit d90fe54

Browse files
authored
Merge pull request #276009 from MicrosoftDocs/main
Publish to Live Wednesday 4AM PST 5/22
2 parents 98c7736 + 6ed8edb commit d90fe54

File tree

106 files changed

+1100
-506
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1100
-506
lines changed

.openpublishing.redirection.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3633,6 +3633,11 @@
36333633
"redirect_url": "https://www.twilio.com/docs/usage/tutorials/serverless-webhooks-azure-functions-and-csharp",
36343634
"redirect_document_id": false
36353635
},
3636+
{
3637+
"source_path_from_root": "/articles/azure-functions/create-first-function-vs-code-web.md",
3638+
"redirect_url": "/azure/azure-functions",
3639+
"redirect_document_id": false
3640+
},
36363641
{
36373642
"source_path_from_root": "/articles/twilio-dotnet-how-to-use-for-voice-sms.md",
36383643
"redirect_url": "https://www.twilio.com/docs/usage/tutorials/serverless-webhooks-azure-functions-and-csharp",
@@ -4057,6 +4062,16 @@
40574062
"source_path_from_root":"/articles/cosmos-db/high-availability.md",
40584063
"redirect_url":"/azure/reliability/reliability-cosmos-db-nosql.md",
40594064
"redirect_document_id":false
4065+
},
4066+
{
4067+
"source_path_from_root":"/articles/migrate/how-to-assess.md",
4068+
"redirect_url":"/azure/migrate/whats-new#update-april-2024",
4069+
"redirect_document_id":false
4070+
},
4071+
{
4072+
"source_path_from_root":"/articles/migrate/prepare-isv-movere.md",
4073+
"redirect_url":"/azure/migrate/whats-new#update-april-2024",
4074+
"redirect_document_id":false
40604075
}
40614076
]
40624077
}
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
title: 'How to use Assistants with Logic apps'
3+
titleSuffix: Azure OpenAI
4+
description: Learn how to create helpful AI Assistants with Logic apps.
5+
services: cognitive-services
6+
manager: nitinme
7+
ms.service: azure-ai-openai
8+
ms.topic: how-to
9+
ms.date: 05/21/2024
10+
author: aahill
11+
ms.author: aahi
12+
recommendations: false
13+
---
14+
15+
# Call Azure Logic apps as functions using Azure OpenAI Assistants
16+
17+
> [!NOTE]
18+
> This functionality is currently only available in Azure OpenAI Studio.
19+
20+
[Azure Logic Apps](https://azure.microsoft.com/products/logic-apps) is an integration platform in Azure that allows you to build applications and automation workflows with low code tools enabling developer productivity and faster time to market. By using the visual designer and selecting from hundreds of prebuilt connectors, you can quickly build a workflow that integrates and manages your apps, data, services, and systems.
21+
22+
Azure Logic Apps is fully managed by Microsoft Azure, which frees you from worrying about hosting, scaling, managing, monitoring, and maintaining solutions built with these services. When you use these capabilities to create [serverless](../../../logic-apps/logic-apps-overview.md) apps and solutions, you can just focus on the business logic and functionality. These services automatically scale to meet your needs, make automation workflows faster, and help you build robust cloud apps using little to no code.
23+
24+
## Function calling on Azure Logic Apps through the Assistants Playground
25+
26+
To accelerate and simplify the creation of intelligent applications, we are now enabling the ability to call Logic Apps workflows through function calling in Azure OpenAI Assistants.
27+
28+
The Assistants playground enumerates and lists all the workflows in your subscription that are eligible for function calling. Here are the requirements for these workflows:
29+
30+
* [Consumption Logic Apps](../../../logic-apps/quickstart-create-example-consumption-workflow.md): Currently we only support consumption workflows.
31+
* [Request trigger](../../../connectors/connectors-native-reqres.md?tabs=consumption): Function calling requires a REST-based API. Logic Apps with a request trigger provides a REST endpoint. Therefore only workflows with a request trigger are supported for function calling.
32+
* Schema: The workflows you want to use for function calling should have a JSON schema describing the inputs and expected outputs. Using Logic Apps you can streamline and provide schema in the trigger, which would be automatically imported as a function definition.
33+
34+
If you already have workflows with above three requirements, you should be able to use them in Azure OpenAI Studio and invoke them via user prompts.
35+
If you do not have existing workflows, you can follow the steps in this article to create them. There are two primary steps:
36+
1. [Create a Logic App on Azure portal](#create-logic-apps-workflows-for-function-calling).
37+
2. [Import your Logic Apps workflows as a function in the Assistants Playground](#import-your-logic-apps-workflows-as-functions).
38+
39+
## Create Logic Apps workflows for function calling
40+
41+
Here are the steps to create a new Logic Apps workflow for function calling.
42+
43+
1. In the Azure portal search box, enter **logic apps**, and select **Logic apps**.
44+
1. On the Logic apps page toolbar, select **Add**.
45+
1. On the Create Logic App page, first select the Plan type for your logic app resource. That way, only the options for that plan type appear.
46+
1. In the **Plan** section, for the Plan type, select **Consumption** to view only the consumption logic app resource settings.
47+
1. Provide the following information for your logic app resource: Subscription, Resource Group, Logic App name, and Region.
48+
1. When you're ready, select **Review + Create**.
49+
1. On the validation page that appears, confirm all the provided information, and select **Create**.
50+
1. After Azure successfully deploys your logic app resource, select **Go to resource**. Or, find and select your logic app resource by typing the name in the Azure search box.
51+
1. Open the Logic Apps workflow in designer. Select Development Tools + Logic app designer. This opens your empty workflow in designer. Or you select Blank Logic App from templates
52+
1. Now you're ready to add one more step in the workflow. A workflow always starts with a single trigger, which specifies the condition to meet before running any subsequent actions in the workflow.
53+
1. Your workflow is required to have a Request trigger to generate a REST endpoint, and a response action to return the response to Azure OpenAI Studio when this workflow is invoked.
54+
1. Add a trigger [(Request)](../../../connectors/connectors-native-reqres.md?tabs=consumption)
55+
56+
Select **Add a trigger** and then search for request trigger. Select the **When a HTTP request is received** operation.
57+
58+
:::image type="content" source="..\media\how-to\assistants\logic-apps\create-logic-app-1.png" alt-text="A screenshot showing the Logic Apps designer." lightbox="..\media\how-to\assistants\logic-apps\create-logic-app-1.png":::
59+
60+
Provide the JSON schema for the request. If you do not have the schema use the option to generate schema.
61+
62+
:::image type="content" source="..\media\how-to\assistants\logic-apps\create-logic-app-2.png" alt-text="A screenshot showing the option to provide a JSON schema." lightbox="..\media\how-to\assistants\logic-apps\create-logic-app-2.png":::
63+
64+
Here is an example of the request schema. You can add a description for your workflow in the comment box. This is imported by Azure OpenAI Studio as the function description.
65+
66+
:::image type="content" source="..\media\how-to\assistants\logic-apps\create-logic-app-3.png" alt-text="A screenshot showing an example request schema." lightbox="..\media\how-to\assistants\logic-apps\create-logic-app-3.png":::
67+
68+
Save the workflow. This will generate the REST endpoint for the workflow.
69+
70+
:::image type="content" source="..\media\how-to\assistants\logic-apps\create-logic-app-4.png" alt-text="A screenshot showing the REST endpoint." lightbox="..\media\how-to\assistants\logic-apps\create-logic-app-4.png":::
71+
72+
1. Depending on the business use case, you can now add one or more steps/actions in this workflow. For example, using the MSN weather connector to get the weather forecast for the current location.
73+
74+
:::image type="content" source="..\media\how-to\assistants\logic-apps\create-logic-app-5.png" alt-text="A screenshot showing the MSN weather connector." lightbox="..\media\how-to\assistants\logic-apps\create-logic-app-5.png":::
75+
76+
In the action to **get forecast for today**, we are using the **location** property that was passed to this workflow as an input.
77+
78+
:::image type="content" source="..\media\how-to\assistants\logic-apps\create-logic-app-6.png" alt-text="A screenshot showing the location property." lightbox="..\media\how-to\assistants\logic-apps\create-logic-app-6.png":::
79+
80+
1. Configure the [response](../../../connectors/connectors-native-reqres.md#add-a-response-action). The workflow needs to return the response back to Azure OpenAI Studio. This is done using Response action.
81+
82+
:::image type="content" source="..\media\how-to\assistants\logic-apps\create-logic-app-7.png" alt-text="A screenshot showing the response action." lightbox="..\media\how-to\assistants\logic-apps\create-logic-app-7.png":::
83+
84+
In the response action, you can pick the output from any of the prior steps. You can optionally also provide a JSON schema if you want to return the output in a specific format.
85+
86+
:::image type="content" source="..\media\how-to\assistants\logic-apps\create-logic-app-7.png" alt-text="A screenshot showing the comment box to specify a JSON schema." lightbox="..\media\how-to\assistants\logic-apps\create-logic-app-7.png":::
87+
88+
1. The workflow is now ready. In Azure OpenAI Studio, you can import this function using the **Add function** feature in the Assistants playground.
89+
90+
91+
## Import your Logic Apps workflows as functions
92+
93+
Here are the steps to import your Logic Apps workflows as function in the Assistants playground in Azure OpenAI Studio:
94+
95+
1. In Azure OpenAI Studio, select **Assistants**. Select an existing Assistant or create a new one. After you have configured the assistant with a name and instructions, you are ready to add a function. Select **+ Add function**.
96+
97+
:::image type="content" source="..\media\how-to\assistants\logic-apps\assistants-playground-add-function.png" alt-text="A screenshot showing the Assistant playground with the add function button." lightbox="..\media\how-to\assistants\logic-apps\assistants-playground-add-function.png":::
98+
99+
1. The **Add function** option opens a screen with two tabs. Navigate to the tab for Logic Apps to browse your workflows with a request trigger. Select the workflow from list and select **Save**.
100+
101+
> [!NOTE]
102+
> This list only shows the consumption SKU workflows and with a request trigger.
103+
104+
105+
:::image type="content" source="..\media\how-to\assistants\logic-apps\import-logic-apps.png" alt-text="A screenshot showing the menu for adding functions." lightbox="..\media\how-to\assistants\logic-apps\import-logic-apps.png":::
106+
107+
You have now successfully imported your workflow and it is ready to be invoked. The function specification is generated based on the logic apps workflow swagger and includes the schema and description based on what you configured in the request trigger action.
108+
109+
:::image type="content" source="..\media\how-to\assistants\logic-apps\edit-function.png" alt-text="A screenshot showing the imported workflow." lightbox="..\media\how-to\assistants\logic-apps\edit-function.png":::
110+
111+
The workflow now will be invoked by the Azure OpenAI Assistants based on the user prompt. Below is an example where the workflow is invoked automatically based on user prompt to get the weather.
112+
113+
:::image type="content" source="..\media\how-to\assistants\logic-apps\playground-weather-example.png" alt-text="A screenshot showing a weather prompt example." lightbox="..\media\how-to\assistants\logic-apps\playground-weather-example.png":::
114+
115+
You can confirm the invocation by looking at the logs as well as your [workflow run history](../../../logic-apps/monitor-logic-apps.md?tabs=consumption.md#review-workflow-run-history).
116+
117+
118+
:::image type="content" source="..\media\how-to\assistants\logic-apps\example-log.png" alt-text="A screenshot showing a logging example." lightbox="..\media\how-to\assistants\logic-apps\example-log.png":::
119+
120+
## FAQ
121+
122+
**What are Logic App connectors?**
123+
124+
Azure Logic Apps has connectors to hundreds of line-of-business (LOB) applications and databases including but not limited to: SAP, Salesforce, Oracle, SQL, and more. You can also connect to SaaS applications or your in-house applications hosted in virtual networks. These out of box connectors provide operations to send and receive data in multiple formats. Leveraging these capabilities with Azure OpenAI assistants, you should be able to quickly bring your data for Intelligent Insights powered by Azure OpenAI.
125+
126+
**What happens when a Logic Apps is imported in Azure OpenAI Studio and invoked**
127+
128+
The Logic Apps swagger file is used to populate function definitions. Azure Logic App publishes an OpenAPI 2.0 definition (swagger) for workflows with a request trigger based on [annotations on the workflow](/rest/api/logic/workflows/list-swagger). Users are able to modify the content of this swagger by updating their workflow. Azure OpenAI Studio uses this to generate the function definitions that the Assistant requires.
129+
130+
**How does authentication from Azure OpenAI Studio to Logic Apps work?**
131+
132+
Logic Apps supports two primary types of authentications to invoke a request trigger.
133+
134+
* Shared Access Signature (SAS) based authentication.
135+
136+
Users can obtain a callback URL containing a SAS using the [list callback URL](/rest/api/logic/workflows/list-callback-url) API. Logic Apps also supports using multiple keys and rotating them as needed. Logic Apps also supports creating SAS URLs with a specified validity period. For more information, see the [Logic Apps documentation](../../../logic-apps/logic-apps-securing-a-logic-app.md#generate-shared-access-signatures-sas).
137+
138+
* Microsoft Entra ID-based OAuth base authentication policy.
139+
140+
Logic Apps also supports authentication trigger invocations with Microsoft Entra ID OAuth, where you can specify authentication policies to be used in validating OAuth tokens. For more information, see the [Logic Apps documentation](../../../logic-apps/logic-apps-securing-a-logic-app.md#generate-shared-access-signatures-sas).
141+
142+
When Azure OpenAI Assistants require invoking a Logic App as part of function calling, Azure OpenAI Studio will retrieve the callback URL with the SAS to invoke the workflow.
143+
144+
## See also
145+
146+
* [Learn more about Assistants](../concepts/assistants.md)

articles/ai-services/openai/how-to/use-your-data-securely.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,4 +378,9 @@ curl -i -X GET https://my-resource.openai.azure.com/openai/extensions/on-your-da
378378
### Inference API
379379

380380
See the [inference API reference article](../references/on-your-data.md) for details on the request and response objects used by the inference API.
381-
381+
382+
## Use Microsoft Defender for Cloud
383+
384+
You can now integrate [Microsoft Defender for Cloud](../../../defender-for-cloud/defender-for-cloud-introduction.md) (preview) with your Azure resources to protect your applications. Microsoft Defender for Cloud protects your applications with [threat protection for AI workloads](../../../defender-for-cloud/ai-threat-protection.md) , providing teams with evidence-based security alerts enriched with Microsoft threat intelligence signals and enables teams to strengthen their [security posture](../../../defender-for-cloud/ai-security-posture.md) with integrated security best-practice recommendations.
385+
386+
Use [this form](https://forms.office.com/pages/responsepage.aspx?id=v4j5cvGGr0GRqy180BHbR9EXzLewuFRArQPJzR1tntlURThQR0hYU1MyRVRNODNMV1hBOUEzVlk3NC4u) to apply for access.

0 commit comments

Comments
 (0)