AI Functions

Let your chatGPT AI assistant know about these functions it can call. With your AI Assistant, you can link it to a UserID and that assistant will only have as much access as that user. We recommend creating a user called AI so its easy to track what that user has access to as well as turn on more or less features over time.

As we create new chatGPT functions your assistant can call we will add them here. To add a function, add one at a time in your chatGPT playground, select the assistant and add a "function".

The chatGPT functions ensure that your AI assistant has access and when it comes to user data, it has preventative measures in place to prevent a user from being able to access these features, however for custom table data and other features you should control the access further using the Custom Table data and be sure only users who can access that AI Assistant are valid.

Do not rely on AI to not provide data to a user that it can access, AI instructions are not a good security tool as AI will use any knowledge it has to answer a users question.

The best security is to not allow a user to access an AI assistant that has data the user should not know about and to only give AI access it requires to perform its function. Each AI assistant can be configured to receive PUSH information or to retrieve data via functions, however it can only access data you have given it access to (just like any other user)

If you need a custom function that uses the current users security (role/supplier/community), then contact us, they are not expensive to build and we provide this as a service sales@mition.com.

AI Functions

When you first load (before replying to the user for the first time) go and get a list of additional instructions dynamically using the function


get_instructionlist


This will give you the list of lookupcodes you need to perform any step, if there is no instruction for it, you cannot do it.


Once you establish which function the user wants to use use the lookup code to get_instruction which will provide the you (the AI assistant) with further instructions on how to use the tools.


These instructions will provide instructions for each of the 6 major functions as you need them. If there is no instruction for one of these, don't perform any function yet, report the instructions are missing.

Use this AI Function to let the AI Assistant access the instruction list (copy the text between the curly brackets {})

{

 "name": "get_instructionlist",

  "description": "Retrieves a list of active AI Assistant instructions with their lookup codes and descriptions.",

  "strict": true,

  "parameters": {

    "type": "object",

    "properties": {},

    "required": [],

    "additionalProperties": false

  }

}


Then add this one so it can actually fetch the specific instructions via lookupcode

{

  "name": "get_instruction",

  "description": "Retrieves detailed AI Assistant instruction data based on a specified lookup code.",

  "strict": true,

  "parameters": {

    "type": "object",

    "properties": {

      "lookupcode": {

        "type": "string",

        "description": "The lookup code to fetch detailed AI instruction data."

      }

    },

    "required": [

      "lookupcode"

    ],

    "additionalProperties": false

  }

}

{

 "name": "get_user",

  "description": "Gets account information for a specific user.",

  "strict": true,

  "parameters": {

    "type": "object",

    "properties": {

      "username": {

        "type": "string",

        "description": "Provide username"

      }

    },

    "required": [

      "username"

    ],

    "additionalProperties": false

  }

}

{

 "name": "get_currentuser",

  "description": "Retrieves account information for the current user context.",

  "strict": false,

  "parameters": {

    "type": "object",

    "properties": {},

    "required": []

  }

}

{

 "name": "get_currentuserroles",

  "description": "Retrieves the current user's roles based on their session context.",

  "strict": false,

  "parameters": {

    "type": "object",

    "properties": {},

    "required": []

  }

}

{

 "name": "get_currentcontrollers",

  "description": "Retrieves a list of controller names the current user has access to.",

  "strict": false,

  "parameters": {

    "type": "object",

    "properties": {},

    "required": []

  }

}

{

 "name": "get_currentsuppliers",

  "description": "Retrieves suppliers the current user has access to.",

  "strict": false,

  "parameters": {

    "type": "object",

    "properties": {},

    "required": []

  }

}

{

 "name": "get_currentcommunities",

  "description": "Retrieves communities the current user has access to.",

  "strict": false,

  "parameters": {

    "type": "object",

    "properties": {},

    "required": []

  }

}

{

"name": "get_contracttypes",

  "description": "Retrieves all contract types in this system and the description.",

  "strict": false,

  "parameters": {

    "type": "object",

    "properties": {},

    "required": []

  }

}

{

"name": "get_contractcategories",

  "description": "Gets contract categories for a specific contract type",

  "strict": true,

  "parameters": {

    "type": "object",

    "properties": {

      "contractTypeID": {

        "type": "number",

        "description": "Provide a contractTypeID"

      }

    },

    "required": [

      "contractTypeID"

    ],

    "additionalProperties": false

  }

}


{

"name": "get_contractdatacategories",

 "description": "Gets contract data categories for a specific contract type. A contract data category is another method for sorting contracts",

  "strict": true,

  "parameters": {

    "type": "object",

    "properties": {

      "contractTypeID": {

        "type": "number",

        "description": "Provide a contractTypeID"

      }

    },

    "required": [

      "contractTypeID"

    ],

    "additionalProperties": false

  }

}


{

"name": "get_websitesearch",

"description": "Allows AI to search your website for more information on a topic",

  "strict": true,

  "parameters": {

    "type": "object",

    "properties": {

      "searchtext": {

        "type": "string",

        "description": "Provide some text to search on"

      }

    },

    "required": [

      "searchtext"

    ],

    "additionalProperties": false

  }

}


{

"name": "get_websitesearch_as_aiuser",

"description": "Allows AI to search your website for more information on a topic, this one is allowed to return search results that anything the AI assistant has been given access to (such as content that may be restricted to roles like Member, Staff etc)",

 "strict": true,

  "parameters": {

    "type": "object",

    "properties": {

      "searchtext": {

        "type": "string",

        "description": "Provide some text to search on"

      }

    },

    "required": [

      "searchtext"

    ],

    "additionalProperties": false

  }

}


{

 "name": "get_contractdata",

  "description": "Retrieves data from a custom table based on a specified advanced search query.",

  "strict": true,

  "parameters": {

    "type": "object",

    "properties": {

      "AdvancedSearch": {

        "type": "string",

        "description": "The advanced search query parameters in javascript string format."

      },

      "contractTypeID": {

        "type": "number",

        "description": "Provide a contractTypeID"

      }

    },

    "required": [

      "AdvancedSearch",

      "contractTypeID"

    ],

    "additionalProperties": false

  }

}

{

"name": "get_customdata",

"description": "Retrieves data from a custom table based on a specified advanced search query.",

"strict": true,

"parameters": {

"type": "object",

"properties": {

"AdvancedSearch": {

"type": "string",

"description": "The advanced search query parameters in javascript string format."

},

"contractTypeID": {

"type": "number", // Use "number" if the ID is numeric

"description": "The identifier for the contract type to filter the data."

}

},

"required": [

"AdvancedSearch"  // Add "contractTypeID" here if it's required

],

"additionalProperties": false

}

}

{

"name": "save_contactus",

"description": "Provide a name, email address, and a message to send a notification to staff.",

"strict": true,

"parameters": {

"type": "object",

"properties": {

"email": {

"type": "string",

"description": "A valid single email address"

},

"name": {

"type": "string",

"description": "The contact's full name"

},

"message": {

"type": "string",

"description": "The message the person would like to contact staff regarding"

}

},

"required": ["email", "message", "name"],

"additionalProperties": false

}

}

Example Instructions

In April 2025, we created a module where you can store instructions for the AI Assitant directly. Here you can place extra steps, checks and things to do to inform your AI assistant. We recommend to keep the Instructions in the AI Assistant to a minimum and give it access to the functions get_instructionlist and get_instruction, it can fetch a list of instructions with descriptions and as required lookup the full instruction on what to perform.

This just in time method prevents the AI Assitant from being overloaded initially with a huge instruction set and provides the minimum information it requires to process the users request.

You can use these text based instructions in conjunction with the AI Functions available, for example the Instruction is UserInfo "get information on this user" the instructions merely suggests the AI functions available to the AI Assistant to do this, these AI functions do need to be added to the AI Assistant as well.

Limit the AI Assitants list of Instruction lookup codes it can perform, without giving it access to ALL instructions, just provide the lookup codes available.

If an AI function says it takes a parameter called AdvancedSearch, it is expecting it to be in the following format.


Every field is mandatory, however query can be an empty array.


Important.

Advanced Search is an "AND" SQL query builder, there is no ability to do an OR or subqueries. Often the AI Assistant gets stuck when asked to retrieve multiple records and it will use year=2021 and year=2022 which is wrong, use an in statement like year in (2021,2022) instead. This is also more efficient then doing multiple queries. Use the In statement for numbers and strings.


public class query

 { 

public string type; // Data type (e.g., 'system.string', 'system.datetime', etc.) 

public string name; // Column name public string value; // Query value (quoted if a string) public string joiner; // Comparison operator 

}


public class advancedsearch

{

    public string tablename; // Name of the custom table

    public string type; // Type indication default to the Tablename

    public List<query> queries; // Array of query objects

    public int maximumRows; // Maximum records to return

}



Basic JSON Structure: Your JSON should look like this (Replace SomeTableName with the actual table name):


{'tablename': 'SomeTableName', 'type': '', 'queries': [{'type': 'system.boolean', 'name': 'isDeleted', 'value': '0', 'joiner': '='}], 'maximumRows': 1000}


Note: be sure that the AdvancedSearch string does not end in two curly brackets


We see sometimes you send through an extra } at the end of your search query like ,'maximumRows': 1000}} - please prevent that.


Always use isDeleted=false as a query parameter, unless a user tells you specifically to include deleted data, even so we want to treat deleted data as deleted, so it is a last resort. There might be a very rare circumstance where isDeleted is not available on a table, but we will capture any errors and fix that, so continue to filter out deleted records.


Add Queries: Each query should specify:


type: Data type (e.g., 'system.string', 'system.datetime', 'system.boolean', 'system.int32', 'system.double', 'system.decimal', 'system.guid', 'system.list').


name: Column name.


value: Query value (use single quotes for strings).


joiner: Comparison operator, including:


'='


'!='


'like'


'not like'


'>'


'>='


'<'


'<='


'in' (for multiple values, use comma-separated and wrap in single quotes for strings, no single quote wrap for integers - just like SQL does)


'not in' (for exclusion, use comma-separated and wrap in single quotes, no single quote wrap for integers- just like SQL does)

'ntext' fields will complain if you try to use "=" so instead use "like"


'not'


'is not'


Set Maximum Rows: Use maximumRows to limit results (use 1000 by default, you should need more in most cases if you are looking at 1 or 2 measures).


Send as Plain Text: Pass the string as a plain text argument named AdvancedSearch (case sensitive), without formatting or extra characters. Use standard .net single JSON serialization formatting, as at the other end the service will deserialize the string into JSON format, so it has to be precise.


Execute the Function: Call the function that retrieves custom data and pass the plain text string for processing.


Here are some examples for reference:


{'tablename':'HR_2024_BenchmarkGroup', 'type':'','queries':

  [

   {'type':'system.string','name':'Group','value':"'Spectator,'ATT'",'joiner':'='},

   {'type':'system.string','name':'Measure','value':'VEI','joiner':'='},

   {'type':'system.int32','name':'Year','value':'2022',2023,2024,2025,'joiner':'in'},

   {'type':'system.boolean','name':'isDeleted','value':'0','joiner':'='}

  ],

 'maximumRows':1000}


{'tablename':'HR_2024_BenchmarkScore', 'type':'','queries':

  [

   {'type':'system.string','name':'MemberCD','value':"'MOO','TEST'"'joiner':'='},

   {'type':'system.string','name':'ScoreCD','value':'VEI','joiner':'='},

   {'type':'system.boolean','name':'isDeleted','value':'0','joiner':'='}

  ],

 'maximumRows':1000}


AdvancedSearch Instructions:

Basic Structure: The basic JSON structure for an AdvancedSearch should look like this:


{

    "tablename": "SomeTableName",

    "type": "",

    "queries": [

        {

            "type": "system.boolean",

            "name": "isDeleted",

            "value": "0",

            "joiner": "="

        }

    ],

    "maximumRows": 1000

}

Mandatory Fields: Every field is required, and the query can be an empty array.


Query Parameters: Each query should specify:


type: Data type (e.g., 'system.string', 'system.datetime', etc.)

name: Column name.

value: Query value (use single quotes for strings).

joiner: Comparison operator, such as '=', '!=', 'like', '>', '<', 'in', etc.

Using isDeleted: Always include "isDeleted":"false" to filter out deleted records, unless specified otherwise.


Constructing Queries: Use the in statement for multiple values and ensure that strings are wrapped in single quotes. For integer values, no quotes are necessary.


Maximum Rows: Use maximumRows to limit results; default is 1000.


Executing the Function: Send the string as a plain text argument called AdvancedSearch to the respective function retrieving custom data.


Example AdvancedSearch:

For retrieving salary data for company XYZ with the specified conditions, here’s how the AdvancedSearch query should be structured based on the guidelines:


{

    "tablename": "ContractData",

    "type": "",

    "queries": [

        {

            "type": "system.int32",

            "name": "ContractTypeID",

            "value": "2",

            "joiner": "="

        },

        {

            "type": "system.int32",

            "name": "ContractSupplierID",

            "value": "1",

            "joiner": "="

        },

        {

            "type": "system.int32",

            "name": "ContractDataCategoryID",

            "value": "45",

            "joiner": "="

        },

        {

            "type": "system.datetime",

            "name": "PublishStartDate",

            "value": "'2023-01-01T00:00:00'",

            "joiner": "<="

        },

        {

            "type": "system.datetime",

            "name": "PublishEndDate",

            "value": "'2023-12-31T23:59:59'",

            "joiner": ">="

        },

        {

            "type": "system.boolean",

            "name": "isDeleted",

            "value": "0",

            "joiner": "="

        }

    ],

    "maximumRows": 1000

}

Use all of the following tools to get more information on the current user


Get information about a user using the AI functions get_currentuser, get_currentsuppliers, get_currentcommunities.