Description
Is your feature request related to a problem? Please describe.
Yes, this feature request addresses limitations in the current "suggestion" feature of the bpmn.io modeler, as documented in issues [#32](https://github.com/bpmn-io/bpmn-ai/issues/32) and [#24](https://github.com/bpmn-io/bpmn-ai/issues/24). The existing solution, which uses OpenAI function calling to suggest Connector templates based on a BPMN element’s name and type, has the following problems:
- Issue Suggestions don't work for Start Events bpmn-io/refactorings#32: Template IDs exceeding 64 characters cause 400 errors, preventing suggestions for Start Events.
- Issue Research using fine-tuned, smaller model for better performance and lower cost bpmn-io/refactorings#24: GPT-3.5 with function calling performs poorly for generic element names (e.g., "Send message") or when multiple templates apply, reducing the discoverability of out-of-the-box (OOTB) Connector templates.
Describe the solution you'd like
We propose a new Cosine Similarity Approach to suggest relevant Connector templates when a user clicks the "Show suggestions" button for a selected BPMN element (e.g., Task, Event). This solution avoids reliance on large language models (LLMs) like OpenAI and involves a two-step process:
- Filtering by Element Type:
- Load a predefined list of templates.
- Filter the list to include only templates applicable to the selected element’s type (e.g., "bpmn:Task").
- Semantic Similarity with Cosine Similarity:
- Use a pre-trained SentenceTransformer model (multi-qa-mpnet-base-dot-v1) to encode:
- The element’s name (e.g., "Send email") into a high-dimensional vector.
- The combined name and description fields of each filtered template into vectors.
- Compute the cosine similarity between the element’s name vector and each template’s vector.
- Return the top 5 templates with the highest similarity scores, applying a threshold cutoff to ensure relevance.
- Use a pre-trained SentenceTransformer model (multi-qa-mpnet-base-dot-v1) to encode:
This solution has been implemented and integrated into a forked repository at , providing more accurate and reliable suggestions compared to the current OpenAI-based approach.
Describe alternatives you've considered
We’ve explored and experimented with several alternative approaches to enhance the suggestion feature:
- Dot Product Similarity:
- Replaces cosine similarity with dot product for potentially faster computation.
- Trade-off: Less normalized than cosine similarity, which may affect consistency.
- TF-IDF Based Similarity:
- Uses TF-IDF vectors instead of transformer embeddings to calculate similarity.
- Trade-off: Simpler but less semantically rich than SentenceTransformer embeddings.
- Expanded Information during Check:
- Includes additional template details (e.g., group labels, property labels/descriptions) in the embedding text for richer context.
- Trade-off: May introduce impurity, reducing suggestion precision.
These alternatives are implemented and available for review in the experimental folder of our forked repository .
Additional context
To demonstrate the effectiveness of the Cosine Similarity Approach, we compared its performance against the existing OpenAI solution using test cases. The table below highlights the differences in suggestion relevance:
Test Case ID | Input Name | Input Type | OpenAI Suggestion | Cosine Suggestions |
---|---|---|---|---|
1 | Send email | bpmn:Task | SendGrid Outbound Connector | SendGrid Outbound Connector (21.09), Microsoft Teams Outbound Connector (17.07), Amazon SQS Outbound Connector (16.11), Amazon SNS Outbound connector (15.61), Microsoft Office 365 Mail Connector (15.04) |
2 | Send message | bpmn:Task | Slack Outbound Connector | SendGrid Outbound Connector (20.71), RabbitMQ Outbound Connector (20.53), Amazon SNS Outbound connector (19.94), Microsoft Teams Outbound Connector (19.74), Slack Outbound Connector (19.63) |
3 | Setup project | bpmn:Task | Asana Outbound Connector | Asana Outbound Connector (19.76), GitLab Outbound Connector (16.18) |
4 | Call REST API | bpmn:Task | REST Outbound Connector | REST Outbound Connector (25.73), Salesforce Outbound Connector (20.63), Camunda Operate Outbound connector (18.05), Twilio Outbound Connector (15.43), AWS Lambda Outbound Connector (15.24) |
5 | Get distance from Google Maps | bpmn:Task | Google Maps Platform Outbound Connector | Google Maps Platform Outbound Connector (19.95) |
6 | Send message on Slack | bpmn:Task | Slack Outbound Connector | Slack Outbound Connector (26.76), RabbitMQ Outbound Connector (21.22), Amazon SQS Outbound Connector (19.40), Microsoft Teams Outbound Connector (18.41), Amazon SNS Outbound connector (18.37) |
7 | Receive order | bpmn:StartEvent | error | Amazon SQS Message Start Event Connector (17.11), Amazon SQS Start Event Connector (16.30), Amazon EventBridge Message Start Event Connector (15.06) |
8 | Wait for approval | bpmn:IntermediateCatchEvent | error | Amazon SQS Intermediate Message Catch Event connector (15.48) |
9 | GitHub issue | bpmn:BoundaryEvent | GitHub Webhook Boundary Event Connector | GitHub Webhook Boundary Event Connector (20.53) |
10 | Create Slack channel | bpmn:Task | Slack Outbound Connector | Slack Outbound Connector (28.21), RabbitMQ Outbound Connector (17.73), GitLab Outbound Connector (15.66), Microsoft Teams Outbound Connector (15.53), GitHub Outbound Connector (15.29) |
11 | Email sender | bpmn:Task | SendGrid Outbound Connector | SendGrid Outbound Connector (18.41), Easy Post Outbound Connector (15.10) |
12 | Order received | bpmn:StartEvent | error | Amazon SQS Message Start Event Connector (15.88), Amazon SQS Start Event Connector (15.50) |
13 | Approval wait | bpmn:IntermediateCatchEvent | error | Amazon SQS Intermediate Message Catch Event connector (15.78) |
14 | Notification sender | bpmn:IntermediateThrowEvent | error | Amazon SQS Intermediate Message Catch Event connector (17.61), Slack Webhook Intermediate Catch Event Connector (15.50), RabbitMQ Intermediate Catch Event Connector (15.06) |
15 | Send email to customer | bpmn:Task | SendGrid Outbound Connector | SendGrid Outbound Connector (19.53), Amazon SQS Outbound Connector (17.09), Amazon SNS Outbound connector (16.32), Microsoft Teams Outbound Connector (16.11), Microsoft Office 365 Mail Connector (15.15) |
16 | Make API request | bpmn:Task | REST Outbound Connector | REST Outbound Connector (22.79), Salesforce Outbound Connector (21.34), Camunda Operate Outbound connector (19.80), AWS Lambda Outbound Connector (16.06), Automation Anywhere Outbound Connector (15.97) |
17 | bpmn:IntermediateCatchEvent | error | No suggestions | |
18 | Receive Email | bpmn:IntermediateCatchEvent | error | Amazon SQS Intermediate Message Catch Event connector (16.37), RabbitMQ Intermediate Catch Event Connector (15.26), Twilio Intermediate Catch Event Connector (15.09) |
19 | Approval | bpmn:Task | No suggestions | No suggestions |
20 | Approval | bpmn:IntermediateCatchEvent | error | No suggestions |
21 | Send Email Notification | bpmn:Task | SendGrid Outbound Connector | SendGrid Outbound Connector (21.07), Amazon SQS Outbound Connector (18.16), Amazon SNS Outbound connector (17.59), Microsoft Teams Outbound Connector (17.52), Slack Outbound Connector (16.17) |
22 | Fire John | bpmn:Task | Slack Outbound Connector | No suggestions |
23 | SEND EMAIL | bpmn:Task | SendGrid Outbound Connector | SendGrid Outbound Connector (21.09), Microsoft Teams Outbound Connector (17.07), Amazon SQS Outbound Connector (16.11), Amazon SNS Outbound connector (15.61), Microsoft Office 365 Mail Connector (15.04) |
24 | Call external API to get data | bpmn:Task | REST Outbound Connector | Salesforce Outbound Connector (23.89), Camunda Operate Outbound connector (23.01), REST Outbound Connector (22.84), Twilio Outbound Connector (18.61), AWS Lambda Outbound Connector (17.35) |
25 | Call Google Maps API | bpmn:Task | Google Maps Platform Outbound Connector | Google Maps Platform Outbound Connector (18.92), Salesforce Outbound Connector (17.58), REST Outbound Connector (17.55), Camunda Operate Outbound connector (15.88), AWS Lambda Outbound Connector (15.05) |
26 | Call some API | bpmn:Task | REST Outbound Connector | Salesforce Outbound Connector (22.36), REST Outbound Connector (22.04), Camunda Operate Outbound connector (19.29), AWS Lambda Outbound Connector (17.18), Automation Anywhere Outbound Connector (16.68) |
27 | Process payment | bpmn:Task | Salesforce Outbound Connector | Salesforce Outbound Connector (15.00) |
28 | User registration | bpmn:StartEvent | error | No suggestions |
29 | Timer-based reminder | bpmn:IntermediateCatchEvent | error | No suggestions |
30 | Log system event | bpmn:IntermediateThrowEvent | error | Amazon SQS Intermediate Message Catch Event connector (15.62), RabbitMQ Intermediate Catch Event Connector (15.26) |
31 | Compensate transaction | bpmn:BoundaryEvent | No suggestions | No suggestions |
32 | Send email with attachment | bpmn:Task | SendGrid Outbound Connector | SendGrid Outbound Connector (20.03), Microsoft Office 365 Mail Connector (15.01) |
33 | Wait for customer approval | bpmn:IntermediateCatchEvent | error | Amazon SQS Intermediate Message Catch Event connector (15.33) |
34 | Error handling mechanism | bpmn:BoundaryEvent | No suggestions | No suggestions |
35 | Compensate failed transaction | bpmn:BoundaryEvent | Webhook Boundary Event Connector | No suggestions |
36 | Log important event | bpmn:IntermediateThrowEvent | error | No suggestions |
37 | Start process on system boot | bpmn:StartEvent | error | Kafka Message Start Event Connector (15.27) |
38 | User logs in successfully | bpmn:StartEvent | error | No suggestions |
39 | Timer event after 24 hours | bpmn:IntermediateCatchEvent | error | No suggestions |
40 | Escalate to manager | bpmn:IntermediateThrowEvent | error | No suggestions |
41 | Validate user input, store results in DB, then trigger notification email | bpmn:Task | REST Outbound Connector | No suggestions |
41 | Validate user input, store results in DB, then trigger notification email | bpmn:Task | SQL Database Connector | No suggestions |
41 | Validate user input, store results in DB, then trigger notification email | bpmn:Task | SendGrid Outbound Connector | No suggestions |
42 | Initiate Payment Process | bpmn:StartEvent | error | Amazon SQS Start Event Connector (15.34) |
43 | Data Synchronization Timeout | bpmn:IntermediateThrowEvent | error | No suggestions |
44 | Boundary Timer for SLA breach | bpmn:BoundaryEvent | No suggestions | Amazon SQS Boundary Event Connector (19.38), HTTP Polling Boundary Catch Event Connector (19.07), Kafka Boundary Event Connector (18.70), Webhook Boundary Event Connector (17.01), Slack Webhook Boundary Event Connector (16.87) |
45 | Review & Approve Contract Documents | bpmn:Task | Google Drive Outbound Connector | Automation Anywhere Outbound Connector (15.04) |
46 | Wait for 2 hours | bpmn:IntermediateCatchEvent | error | Amazon SQS Intermediate Message Catch Event connector (15.35) |
47 | Callback to External System with JSON Payload | bpmn:Task | REST Outbound Connector | Salesforce Outbound Connector (22.08), REST Outbound Connector (21.69), Camunda Operate Outbound connector (18.87), AWS Lambda Outbound Connector (17.80), RabbitMQ Outbound Connector (17.12) |
48 | bpmn:Task | No suggestions | No suggestions | |
49 | bpmn:StartEvent | No suggestions | No suggestions | |
50 | boundary_event_12345!?$ | bpmn:BoundaryEvent | No suggestions | RabbitMQ Boundary Event Connector (19.96), Amazon SQS Boundary Event Connector (19.85), Webhook Boundary Event Connector (18.13), Kafka Boundary Event Connector (17.97), Amazon EventBridge Boundary Event Connector (17.67) |
51 | Fire-and-Forget Notification | bpmn:IntermediateThrowEvent | error | Amazon SQS Intermediate Message Catch Event connector (17.11) |
52 | Escalate to Human Operator if No Response in 24h | bpmn:IntermediateThrowEvent | error | No suggestions |
53 | Check XYZ System’s Health and Retry Connection | bpmn:Task | REST Outbound Connector | Camunda Operate Outbound connector (16.80), Blue Prism Outbound Connector (16.34), Google Sheets Outbound Connector (15.34), Kafka Outbound Connector (15.19), Amazon SQS Outbound Connector (15.12) |
54 | 非常に長い名前のタスク - 国際化テスト (Internationalization Test) | bpmn:Task | No suggestions | No suggestions |
55 | Multiple Approvals from Different Departments Required | bpmn:IntermediateCatchEvent | error | No suggestions |
56 | -------------------- | bpmn:Task | No suggestions | No suggestions |
57 | Generate Monthly Financial Reports & Send PDF to CFO | bpmn:Task | Google Sheets Outbound Connector | No suggestions |
57 | Generate Monthly Financial Reports & Send PDF to CFO | bpmn:Task | SendGrid Outbound Connector | No suggestions |
58 | Initialize Process Flow For Quarterly Audit | bpmn:StartEvent | error | Amazon SQS Start Event Connector (15.09) |
59 | Boundary Error Catching For Database Exception | bpmn:BoundaryEvent | No suggestions | HTTP Polling Boundary Catch Event Connector (18.84), Amazon SQS Boundary Event Connector (18.56), Webhook Boundary Event Connector (18.03), RabbitMQ Boundary Event Connector (17.83), Twilio Boundary Event Connector (16.91) |
60 | Sensor Trigger - Catch Motion Input | bpmn:IntermediateCatchEvent | error | Amazon SQS Intermediate Message Catch Event connector (17.55), Webhook Intermediate Event Connector (16.39), HTTP Polling Intermediate Catch Event Connector (16.37), Kafka Intermediate Catch Event Connector (16.25), Amazon EventBridge Intermediate Catch Event Connector (15.80) |
61 | Signal Throw to Downstream Systems | bpmn:IntermediateThrowEvent | error | Amazon SQS Intermediate Message Catch Event connector (18.18), Amazon EventBridge Intermediate Catch Event Connector (17.63), RabbitMQ Intermediate Catch Event Connector (17.28), Slack Webhook Intermediate Catch Event Connector (16.50), Kafka Intermediate Catch Event Connector (16.20) |
The Cosine Similarity Approach consistently provides a broader, more relevant set of suggestions, addressing the limitations of generic names and providing multiple recommendatons improving discoverability of Connector templates.
While the author mentioned interest in training a small LLM model, our analysis indicates that the Cosine Similarity Approach is effective and efficient for this use case. We haven’t conducted a feasibility study on fine-tuning an LLM for this usecase yet, but it could be explored as a future enhancement.
About Us:
We are a small team of developers based in Bangalore, passionate about solving compelling problems using AI and making AI technologies accessible to all.