Integrating with external technologies has become a powerful method to streamline business processes, automating tasks that were once time-consuming or prone to errors. Camunda Marketplace frequently offers new Connectors—developed by both Camunda and our partners—enabling connections to cutting-edge technologies.
You can also access new process blueprints from Marketplace as well. These blueprints provide visual workflows for various business problems, giving your process a jumpstart.
In this post, we’ll use one of those blueprints to showcase our new Azure OpenAI Connector.
Prerequisites: If you want to run this Connector, you must have an API key for Azure OpenAI. Review the documentation for Azure OpenAI for how to obtain that key.
How to automate customer routing with Azure OpenAI
As you’ve probably heard, AI can be a powerful tool for enhancing your business processes. This use case uses AI to determine the correct routing for a customer inquiry. You can see the BPMN for this process below.
To access this particular process, obtain the process blueprint by selecting Browse process blueprints.
You can refine your search with the filters presented.
Under Intelligent Routing with AI, select Use Blueprint, which uses the Azure OpenAI Connector.
This opens the associated process blueprint in Web Modeler as depicted below.
Review the blueprint
Take a look at the process and see what it does before you run it. In Modeler, you see that the first human task is providing a customer inquiry that will be routed using the results of the OpenAI Connector. You can select this step and click the link icon to display what this form looks like for this example.
An example prompt is provided in the form. As you can see, if you review the form JSON configuration, the text field Customer message is stored in the process variable noted by customer_inquiry
.
Most likely, this prompt would come from an SMS text message or an email, or this could also be our Contact Us page for asking questions on our website.
This is then passed to our OpenAI Connector for evaluation and analysis to determine which department would be best for handling this inquiry. The options for the department are:
- Sales
- Technical
- Legal
- Other
Select this Connector element to review the details. Enter your Connector Secret for your OpenAI key where designated. Notice that the Chat operation is selected and you are using the Chat GPT 3.5 Turbo model (there are other models available). Using the Chat operation, you can interact with the OpenAI chat-based language models.
You must also define a Temperature that controls the randomness of the model’s output. For this example, select a temperature of 1, which is the midrange temperature. The lower the temperature, the less random and more deterministic the model will perform. A higher temperature makes the model’s output more random.
Then you need a system message—this example uses a simple one: You are a routing classifier.
The next section is the most important as you need to provide a chat history to assist in obtaining the proper routing in response. The following code block provides this.
[
{
"role": "user",
"content": "Route messages to these departments: 'LEGAL', 'SALES', 'ENGINEERING', 'OTHER'. 'OTHER' is the last resort try hard to match it to 'LEGAL', 'SALES', 'ENGINEERING' first. Your response must only contain one of the existing department names."
}, {
"role": "assistant",
"content": "Understood. My responses will only contain the importance and department name separated by a space."
}, {
"role": "user",
"content": "Your product has bug and crashes on my computer."
}, {
"role": "assistant",
"content": "ENGINEERING"
}, {
"role": "user",
"content": "Your website breaks data privacy laws. I will report you to the authorities."
}, {
"role": "assistant",
"content": "LEGAL"
}, {
"role": "user",
"content": "I need to speak to someone about my account."
}, {
"role": "assistant",
"content": "SALES"
}, {
"role": "user",
"content": "How do I install the software?"
}, {
"role": "assistant",
"content": "ENGINEERING"
}, {
"role": "user",
"content": "We have advertisement space we want to sell you for your marketing campaigns. Contact us today and save 20%."
}, {
"role": "assistant",
"content": "SALES"
}, {
"role": "user",
"content": "I am your biggest customer and have a question about our commercial relationship."
}, {
"role": "assistant",
"content": "SALES"
}
]
Now that you’ve given OpenAI some chat prompts and responses, you need to define the prompt content to send to the Connector in your process and the resulting expression that will provide the route determined by OpenAI.
The prompt being sent to OpenAI for route determination is entered as:
If is defined(feedback) then feedback else customer_inquiry
So, the prompt uses customer_inquiry
if the feedback
process variable is not yet defined. If you look forward in the process, once initially routed, there is an option to route back with additional feedback which will populate the feedback
process variable as shown below.
Run the blueprint
Now that you’ve had a chance to review the workflow and the Azure OpenAI Connector, let’s try it in action.
Deploy your process and then run it. You can open the running instance in Operate or go straight to TaskList to see the Customer Inquiry form. If you review the process instance in Operate, you can click the link to open TaskList from there as shown below.
For this first run, you should work with the provided example text as shown in the form below.
Click Complete Task and go back to Operate so you can review the variables that have been set and what happens with the OpenAI Connector. In Operate, you can see that the inquiry was routed to Sales, which makes sense based on the context. If you check the overall variables, you can see the value of the <em>"</em>SALES"
route.
Open the task associated with this sales interaction in TaskList.
You can provide feedback and send this through OpenAI again, reroute to another department, or resolve the item.
In this case, add some feedback and process the inquiry again.
Reviewing the process instance in Operate, you’ll see that the inquiry was resubmitted with feedback and then repeated processing through the Azure OpenAI Connector path and route through the sales department a second time.
At this point, you can complete the task. You can continue to try different inquiries and feedback to see how the Azure OpenAI Connector might perform.
Try it out
Now would be a great time to test out the Azure OpenAI Connector yourself. You can run the blueprint as is or modify the prompts and/or the workflow to meet a different need. Don’t forget that we have a general OpenAI Connector as well, so you can selection what best fits your requirements.
If you already have a trial and want to continue with the capabilities of the Starter plan, you can ensure a smooth transition by upgrading today.
Start the discussion at forum.camunda.io