As businesses navigate the end of BizTalk and seek potent data transformation solutions, Azure Logic Apps has surged to the forefront, offering an agile, serverless platform that simplifies workflow automation. My enthusiasm for Azure Logic Apps is fueled by its ease of use and its pivotal role in modernizing business processes. The integration of Azure OpenAI into Logic Apps is heralding a new era of AI-enhanced automation. This post explores the transformative potential of Azure Logic Apps, enhanced by AI, for businesses eager to leverage the latest in cloud and AI technologies.
Understanding Azure Logic Apps
Azure Logic Apps is a cloud-based service that helps you automate and orchestrate tasks, workflows, and business processes. It provides a visual designer to build workflows that integrate apps, data, services, and systems by automating tasks and business processes as “workflows.” Logic Apps is part of the Azure App Service suite, offering scalability, availability, and security, making it an ideal solution for integrating cloud resources and external services.
Key Features of Azure Logic Apps
- Visual Designer: Offers a drag-and-drop interface for building workflows, making it accessible to users with varying technical expertise.
- Connectors: Comes with a vast library of pre-built connectors, facilitating integration with various services and applications, such as Office 365, Salesforce, Dropbox, and now, Azure OpenAI and Azure AI Search. Which makes connecting and transforming data easy to multiple systems and SaaS providers.
- Scalability: Being serverless, it scales automatically to meet demand, ensuring high performance without the need to manage infrastructure.
- Condition-based Logic: Supports conditional statements, loops, and branches to create complex business logic.
Integrating Azure OpenAI with Logic Apps
The recent public preview of Azure OpenAI and Azure AI Search connectors marks a significant advancement in the capabilities of Logic Apps. These connectors bridge the gap between Logic Apps workflows and AI, enabling enterprises to harness the power of generative AI models like GPT-4 and AI-driven search functionalities within their automated workflows.
Azure OpenAI Connector
This connector allows Logic Apps to interact directly with Azure OpenAI services, enabling functionalities such as:
- Generating text completions or responses to queries based on your data.
- Extracting embeddings for data analysis and processing.
Azure AI Search Connector
With the AI Search connector, Logic Apps can:
- Index documents and data, making them searchable.
- Perform vector searches across indexed data, utilizing AI to understand the context and content of documents.
How to Use Azure Logic Apps with Azure OpenAI
Required AI Services
Access to an Azure OpenAI Service
If you already have an existing OpenAI Service and model you can skip these steps.
- Go to the Azure portal
- Click
Create a resource
- In the search box type:
OpenAI
. - In the search results list, click
Create
onAzure OpenAI
. - Follow the prompts to create the service in your chosen subscription and resource group.
- Once your OpenAI service is created you will need to create a deployments for generating embeddings and chat completions.
- Go to your OpenAI service, under the
Resource Management
menu pane, clickModel deployments
- Click
Manage Deployments
- On the
Deployments
page clickCreate new deployment
- Select an available embedding
model
e.g.text-embedding-ada-002
,model version
, anddeployment name
. Keep track of thedeployment name
, it will be used in later steps. - Ensure your model is successfully deployed by viewing it on the
Deployments
page - On the
Deployments
page clickCreate new deployment
- Select an available chat
model
e.g.gpt-35-turbo
,model version
, anddeployment name
. Keep track of thedeployment name
, it will be used in later steps. - Ensure your model is successfully deployed by viewing it on theย
Deployments
ย page
- Go to your OpenAI service, under the
Access to an Azure AI Search Service
If you already have an existing AI Search Service you can skip to step 5.
- Go to the Azure portal.
- Click
Create a resource
. - In the search box type:
Azure AI Search
. - In the search results list, click
Create
onAzure AI Search
. - Follow the prompts to create the service in your chosen subscription and resource group.
- Once your AI Search service is created you will need to create an index to store your document content and embeddings.
- Go to your search service on the
Overview
page, at the top clickAdd index (JSON)
- Go up one level to the root folder
ai-sample
and open theDeployment
folder. Copy the entire contents of the fileaisearch_index.json
and paste them into the index window. You can change the name of the index in thename
field if you choose. This name will be used in later steps. - Ensure your index is created by viewing in on theย
Indexes
ย page
- Go to your search service on the
Follow these steps to create the Azure Standard Logic Apps project and deploy it to Azure:
- Open Visual Studio Code.
- Go to the Azure Logic Apps extension.
- Click
Create New Project
then navigate to and select theSampleAIWorkflows
folder. - Follow the setup prompts:
- Choose Stateful Workflow
- Press Enter to use the default
Stateful
name. This can be deleted later - Select
Yes
if asked to overwrite any existing files
- Update yourย
parameters.json
ย file:- Open the
parameters.json
file - Go to your Azure OpenAI service in the portal
- Under theย
Resource Management
ย menu clickยKeys and Endpoint
- Copy the
KEY 1
value and place its value into thevalue
field of theopenai_api_key
property - Copy the
Endpoint
value and place its values into thevalue
field of theopenai_endpoint
property
- Copy the
- Under theย
Resource Management
ย menu clickยModel deployments
- Click
Manage Deployments
- Copy the
Deployment name
of the embeddings model you want to use and place its value into thevalue
field of theopenai_embeddings_deployment_id
property - Copy the
Deployment name
of the chat model you want to use and place its value into thevalue
field of theopenai_chat_deployment_id
property
- Click
- Under theย
- Go to your Azure AI Search service in the portal
- On the
Overview
page copy theUrl
value. Place its value in thevalue
field of theaisearch_endpoint
property - Under the
Settings
menu clickKeys
. Copy either thePrimary
orSecondary
admin key and place its value into thevalue
field of theaisearch_admin_key
property
- On the
- Go to your Tokenize Function App
- On the
Overview
page. Copy theURL
value and place its value into thevalue
field of thetokenize_function_url
property. Then append/api/tokenize_trigger
to the end of the url.
- On the
- Open the
- Deploy your Logic App:
- Go to the Azure Logic Apps extension
- Click
Deploy to Azure
- Select a Subscription and Resource Group to deploy your Logic App
- Go to the Azure portal to verify your app is up and running.
- Verify your Logic Apps contains two workflows. They will be named:ย
chat-workflow
ย andยingest-workflow
.
Run your workflows
Now that the Azure Function and Azure Logic App workflows are live in Azure. You are ready to ingest your data and chat with it.
Ingest Workflow
- Go to your Logic App in the Azure portal.
- Go to your
ingest
workflow. - On the
Overview
tab click the drop downRun
then selectRun with payload
. - Fill in the JSON
Body
section with yourfileUrl
anddocumentName
. For example:{ "fileUrl": "https://mydata.enterprise.net/file1.pdf", "documentName": "file1" }
NOTE: The expected file type is pdf. - Click
Run
, this will trigger theingest
workflow. This will pull in your data from the above file and store it in your Azure AI Search Service. - View theย
Run History
ย to ensure a successful run.
Chat Workflow
- Go to your Logic App in the Azure portal.
- Go to your
chat
workflow. - On the
Overview
tab click the drop downRun
then selectRun with payload
. - Fill in the JSON
Body
section with yourprompt
. For example:{ "prompt": "Ask a question about your data?" }
- Click
Run
, This will trigger thechat
workflow. This will query your data stored in your Azure AI Search Service and respond with an answer. - View the
Run History
to see the Response from your query.
Benefits of Using Azure Logic Apps with OpenAI
- Enhanced Efficiency: Automates repetitive tasks, freeing up valuable time for strategic work.
- Innovation: Enables businesses to leverage AI capabilities, fostering innovation and providing insights that were previously unattainable.
- Scalability and Flexibility: Easily scales with your business needs, and workflows can be modified as requirements change.
- Cost-Effective: You pay only for what you use, making it a cost-effective solution for businesses of all sizes.
Conclusion
The integration of Azure OpenAI and Azure AI Search with Azure Logic Apps represents a leap forward in the automation of business processes, allowing enterprises to seamlessly incorporate AI capabilities into their workflows. This not only enhances operational efficiency but also paves the way for innovative solutions to complex business challenges. By leveraging these advanced tools, businesses can stay ahead in the competitive landscape, making informed decisions, and driving growth through intelligent automation.
As Azure continues to expand its offerings, the potential for Logic Apps to revolutionize business processes grows exponentially. Embracing these technologies today can position your business as a leader in the digital transformation journey tomorrow.
Check the full logic app ai-sample at GitHub.