Ensuring data privacy while leveraging AI-powered analytics in Jira is essential for many organizations. The Private AI Mode in Issue AI Analytics for Jira Data Center allows you to use your own AI model as an analytics engine, ensuring that sensitive data remains within your controlled environment. This guide will walk you through the steps to configure Private AI Mode using a Groovy script for the integration.
Private AI Mode enables you to integrate your own AI model, hosted within your data center, to handle analytics. This setup ensures that all data processing happens internally, enhancing data privacy and security. This mode is particularly useful for organizations with stringent data privacy requirements. The integration is achieved through a Groovy script that defines the communication protocol with the AI engine.
Before configuring Private AI Mode, ensure you have the following:
If you haven’t already, install the Issue AI Analytics for Jira app from the Atlassian Marketplace. Follow these steps:
Once the app is installed, follow these steps to configure Private AI Mode:
Here’s an example Groovy script to integrate with OpenAI GPT-4o, which you can modify for your AI model:
import com.atlassian.jira.util.json.*
import org.apache.http.entity.StringEntity
def messagesArray = new JSONArray();
if(type.equals("chat")) {
// This is an AI Assistant request
messagesArray.put(new JSONObject().put("role", "system").put("content", issueContext)); // Set issue context
messages.each { messageObj ->
messagesArray.put(new JSONObject().put("role", messageObj.getRole()).put("content", messageObj.getMessage())); // Put all chat messages
}
} else if(type.equals("analytics")) {
// This is an AI Analytics request
def aiQuery = issueSummary + "\r\n" + issueDescription + "\r\n---\r\n" + query; // Build the query that will be sent for analysis
messagesArray.put(new JSONObject().put("role", "user").put("content", aiQuery));
}
def payload = new JSONObject() // Prepare body as per API specification
.put("model", "gpt-4o")
.put("messages", messagesArray)
.put("temperature", 1.0)
.toString();
def post = httpClient.newPost("https://api.openai.com/v1/chat/completions"); // Create a new request to specified URL
post.setEntity(new StringEntity(payload, java.nio.charset.StandardCharsets.UTF_8)); // Set HTTP payload
post.addHeader("Content-Type", "application/json"); // Set HTTP header
post.addHeader("Authorization", "Bearer REPLACE_ME"); // Set HTTP header
JSONObject json = new JSONObject(httpClient.sendRequest(post)); // Parse response as JSON
def result = json.getJSONArray("choices").getJSONObject(0).getJSONObject("message").getString("content"); // Traverse JSON tree
return result; // This script must always return the produced result
When writing the script, please ensure you follow the best practises:
After configuring Private AI Mode, it’s crucial to test the setup:
Troubleshooting Tips:
logger.debug
to log messages in the script and check the Jira logs for any errors.Configuring Private AI Mode in Issue AI Analytics for Jira enhances data privacy and security by ensuring all AI processing occurs within your infrastructure. By following these steps and using the provided Groovy script, you can integrate your own AI model seamlessly. For more detailed documentation and support, visit the Issue AI Analytics for Jira documentation page. Good luck!
We extend various collaboration platforms by developing native integrations and applications. Our mission is to create best-in-class productivity tools for small and large businesses.