The Global Scripts available in Teneo Studio include two script "levels": Session Scripts and Engine Scripts, both are described further in the below Script types section. The scripting language in Teneo Studio is Groovy, and Teneo Studio provides basic support for syntax highlighting.
View of Global Scripts
Global Script window
The Global Scripts are divided between Session Scripts and Engine Scripts:
The Session Scripts all have read and write access to session data, read-only access to solution data and are connected to and occur within the scope of a session, on top of this, with Session Scripts it is possible to control and manipulate the input processing.
The Engine Scripts, on the other hand, have read and write access to solution data and are not connected to nor have access to any particular session.
The Session Scripts and Engine Scripts include different types of scripts, which are all presented in the below table. For each of the different scripts types it is possible to add one or more scripts which are then executed in the order defined by the user in the Script Ordering.
|Script level||Script type||Comment|
|Session Script||Begin dialog||Begin dialog scripts are executed at session start and are the very first global scripts to execute when an end-user talks to the solution.|
|Session Script||New session||New session scripts run following the Begin dialog scripts, subsequent to the beginning of a new session started by a new user. If the session was started by a user whose session was timed out, the Timed-out session scripts are run instead.|
|Session Script||Timed-out session||These scripts run when an end-user, whose session timed out, resumes the dialogue with the AI application. Usually, a session times out after 10 minutes of inactivity.|
|Session Script||Pre-processing||Pre-processing scripts run on each transaction before a sentence in a user input is separated for processing (before simplification). In these scripts, a user input can be manipulated before the input and dialogue processing begin and before Engine tests it against Flow triggers or transitions. A more common use of the Pre-processing scripts is to access other elements of the incoming http request than the user input string.|
|Session Script||Pre-matching||These scripts execute before matching, but after the input is separated into words (after sentence segmentation and tokenization).|
|Session Script||Post-processing||The Post-processing scripts are executed after the Engine has created a response (Output answer), but before the response is given to the end-user. The scripts allow to change the response data, i.e. Output text, Emotion and Output parameters.|
|Session Script||End dialog||The End dialog scripts execute once, at the end of each session/dialogue.|
|Session Script||Pre-logging||The Pre-logging scripts allow for (partial) access to the dialogue history through |
|Session Script||On top||The On top scripts are executed whenever a Flow reaches the top of the flow stack (either by being triggered or by regaining the top position after being interrupted by the triggering of another Flow).|
|Session Script||On drop||These scripts execute when a Flow is dropped (finished or "stuck").|
|Engine Script||Solution loaded||The Solution loaded scripts execute subsequent to loading of the solution; they usually contain definitions of utility functions that are called from other script locations. General scripting functionalities are usually written in Solution loaded scripts.|
|Engine Script||Solution unloaded||The Solution unloaded scripts run once directly before the solution is unloaded.|