Plugins to mask specific fields before sending to ChatGPT

friends,
We have quite lot of data (generated from alerts) we want to send to chatgpt via api. They follow normally a pattern and we are doing manually to generate post-steps based on the payload.
The payload is in JSON and has key-value pairs

Is there any plugin or client side softwares to mask certain fields based on

  • a list of key provided per alert
  • generic set of keys which should be always masked

For instance the payload is

{
	"alertType": "operational",
	"alertProduct": "control-m",
	"alertDetails":
		{
			"host": "mySecretHostname",  # Want to mask the field
			"user": "mySecretUser",   # Want to mask the field
			"severity": "error"
			"message": "Incorrect SSH key provided"
		}
}

So was thinking to provide a set of ‘fields’ that needs to be masked as parameter

alertDetails.host
alertDetails.user

So when it reaches GPT, it should be

{
	"alertType": "operational",
	"alertProduct": "control-m",
	"alertDetails":
		{
			"host": "randomHashxxxx",
			"user": "randomHashyyyy",
			"severity": "error"
			"message": "Incorrect SSH key provided"
		}
}

Just clean your data before you send it. Since it’s JSON you just need to clean those keys.
To build the logic will depend on what language you’ve written the tool that sends the data to the OpenAI API.

Below I’m using the command line tool jq. To get rid of those keys from the alertDetails array.

echo '{
  "alertType": "operational",
  "alertProduct": "control-m",
  "alertDetails": {
    "host": "mySecretHostname",
    "user": "mySecretUser",
    "severity": "error",
    "message": "Incorrect SSH key provided"
  }
}' | jq 'del(.alertDetails.host, .alertDetails.user)'

Output:

{
  "alertType": "operational",
  "alertProduct": "control-m",
  "alertDetails": {
    "severity": "error",
    "message": "Incorrect SSH key provided"
  }
}

Also, you might think about deleting everything besides the content from the alerts, that way you are saving on tokens and money.