Configuring Private AI Mode in Issue AI Analytics for Jira: A Step-by-Step Guide

Configuring Private AI Mode in Issue AI Analytics for Jira A Step-by-Step Guide

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.

Step 1: Understanding Private AI Mode

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.

Private AI Mode - Architecture

Step 2: Prerequisites

Before configuring Private AI Mode, ensure you have the following:

  • Jira Data Center: Private AI Mode is compatible with Jira Data Center.
  • Private AI Model: You need access to a Private AI model hosted within your data center. This could be a custom AI model or an on-premises deployment of an AI service.

Step 3: Installing Issue AI Analytics for Jira

If you haven’t already, install the Issue AI Analytics for Jira app from the Atlassian Marketplace. Follow these steps:

  1. Navigate to the Atlassian Marketplace: Go to the Jira administration panel and select “Find new apps.”
  2. Search for Issue AI Analytics: Type “Issue AI Analytics for Jira” in the search bar.
  3. Install the App: Click “Get it now” and follow the on-screen instructions to complete the installation.

Step 4: Configuring Private AI Mode

Once the app is installed, follow these steps to configure Private AI Mode:

  1. Access the Configuration Page: Navigate to the configuration page of Issue AI Analytics for Jira within the Jira administration settings.
  2. Select Private AI Mode: In the configuration options, under “Integration mode”, select “Private AI”
  3. Configure the Groovy Script: Modify the provided Groovy script, under “Integration script”, to communicate with your Private AI model.

Step 5: Writing the Groovy Script

Here’s an example Groovy script to integrate with OpenAI GPT-3.5, which you can modify for your AI model:

import com.atlassian.jira.util.json.*
def aiQuery = issueSummary + "\\r\\n" + issueDescription + "\\r\\n---\\r\\n" + query // Build the query that will be sent for analysis
def payload = new JSONObject() // Prepare body as per API specification
    .put("model", "gpt-3.5-turbo")
    .put("messages", new JSONArray()
        .put(new JSONObject()
            .put("role", "user")
            .put("content", aiQuery)))
    .put("temperature", 1.0)
def post = new URL("<>").openConnection() // Create a new request to specified URL
logger.debug("Preparing POST body: " + payload)
post.setConnectTimeout(60000) // Set a timeout to 60 seconds - make sure to always set timeouts
post.setReadTimeout(60000) // Set a timeout to 60 seconds - make sure to always set timeouts
post.setRequestMethod("POST") // Specify HTTP method
post.setDoOutput(true) // Specify our HTTP request has a body
post.setRequestProperty("Content-Type", "application/json") // Set HTTP header
post.setRequestProperty("Authorization", "Bearer YOUR_TOKEN") // Set HTTP header
post.getOutputStream().write(payload.getBytes("UTF-8")) // Set HTTP body
def postRC = post.getResponseCode() // Send POST request
def response = post.getInputStream().getText() // Read response body
logger.debug("Response code is: " + postRC + "; Response body is: " + response)
if (postRC.equals(200)) { // Verify request is successful
    def json = new JSONObject(response) // Read as JSON
    def result = json.getJSONArray("choices").getJSONObject(0).getJSONObject("message").get("content") // Traverse JSON tree
    return result // This script must always return the produced analytics
throw new Exception("Unsuccessful request! HTTP response code is " + postRC + "; Response body is: " + response) // Throw error due to unsuccessful request

Step 6: Best Practises

When writing the script, please ensure you follow the best practises:

  • The script must always return the analytics as a String result
  • In case an error occur, an Exception should be thrown. Example: throw new Exception(“An error has occured…”)
  • Always ensure you put a timeout to all blocking operations, especially HTTP calls.
  • Use the issueSummary and issueDescription variables to access the issue content
  • The script will be executed once for every analytics tab you have enabled (4 times by default)
  • It’s recommended to also process the analyticsLanguage variable, in case its value is different from “Default”. In this case you should add an additional sentence to the query you send to your AI model, such as: “Respond in ” + analyticsLanguage

Step 7: Testing and Debugging

After configuring Private AI Mode, it’s crucial to test the setup:

  1. Create a Test Issue: Create a new issue in Jira with a detailed description.
  2. Enable AI Analytics: Click the “Enable AI Analytics” button on the issue view page to trigger the Groovy script.
  3. Review AI Insights: Verify that the AI-generated insights are accurate and that the data processing is successful. If you get a message “Unable to generate AI Analytics – this could be caused by slower analysis or busy AI servers. Please try again in a bit.”, there might be an error in the script – please reference the logs.

Troubleshooting Tips:

  • Enable DEBUG logs while you develop the script: To enable logging for Issue AI Analytics, go to Jira Adminsitration -> System -> Logging and Profiling and click on Configure under Default loggers. Add the following entry: com.deview_studios.atlassian.jira.dc.issue_ai_analytics and set the logging level to DEBUG.
  • Check Logs: Use logger.debug to log messages in the script and check the Jira logs for any errors.
  • Verify Endpoint and Authentication: Ensure the AI model’s endpoint URL and authentication credentials are correct.
  • Set Timeouts: Always set timeouts for HTTP requests to prevent hanging operations.

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!

Deview Studios Logo

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.

Recent Posts


Contact Us

Copyright © 2022 Deview Studios