AIU. - Artificial Intelligence Utility

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > !Session and Storage Management >

AIU. - Artificial Intelligence Utility

AIU.GetUser

Previous Top Next


MiniRobotLanguage (MRL)

 

AIU.GetUser
Retrieve the Current User Identifier

 

Intention

 

GetUser Command: Retrieve Session Identity
 
The GetUser command retrieves the current user identifier set for the AI session.

This helps verify or utilize the user ID in your script for tracking or logic purposes.

It’s part of the AIU - OpenAI API suite.

 

What is the GetUser Command?

 

The GetUser command returns the user identifier previously set by AIU.SetUser, or an empty string if none is set.

The result is returned as a string to an optional variable or the Top of Stack (TOS). It reflects metadata sent with API requests, not affecting response content or token usage directly.

 

Why Do You Need It?

 

Retrieving the user identifier is useful for:

Verification: Confirm the current user ID before making API calls.

Logic: Use the ID in script conditions or logging.

Debugging: Check if the correct user is associated with session activity.

 

How to Use the GetUser Command?

 

Call the command with an optional variable to store the result; if omitted, the value is pushed to the stack.

The user ID is metadata for operations like AIU.Chat, with no significant token cost impact (e.g., gpt-4o-mini: $0.60/1M output tokens).

 

Example Usage

 

AIU.SetUser|alice

AIU.GetUser|$$USR

DBP.Current User: $$USR

 

Sets the user ID to "alice" and retrieves it, storing "alice" in $$USR.

 

Illustration

 

┌──────────────┬──────────────┐

│ Set User     │ Retrieved    │

├──────────────┼──────────────┤

│ alice        │ alice        │

├──────────────┼──────────────┤

│ (unset)      │ ""           │

└──────────────┴──────────────┘

Illustration of retrieving the user ID, including unset state.

 

Syntax

 

AIU.GetUser[|P1]

AIU.Get_User[|P1]

 

Parameter Explanation

 

P1 - (Optional) The variable where the user identifier is stored. If omitted, the value is placed on the Top of Stack (TOS).

 

Example

 

AIU.SetUser|user456

AIU.GetUser|$$ID

DBP.User ID: $$ID

ENR.

 

Remarks

 

- Returns an empty string ("") if no user ID has been set.

- Reflects the last value set by AIU.SetUser in the session.

 

Limitations

 

- Accepts zero or one parameter; extra parameters trigger an error (%IC_ER_PA).

- Does not validate the user ID’s format or existence.

 

See also:

 

AIU.Set_User

AIU.Chat

AIU.Responses

User Configuration