|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > !Output Formatting and Delivery > AIU. - Artificial Intelligence Utility |
MiniRobotLanguage (MRL)
AIU.GetStream
Retrieve the Current Streaming Mode Setting
Intention
GetStream Command: Verify Streaming Configuration
The GetStream command retrieves the current streaming mode setting, indicating whether responses are delivered in real-time chunks or as a complete unit.
This helps confirm or adjust how AI output is handled in your script.
It’s part of the AIU - OpenAI API suite.
The GetStream command returns the current streaming mode status set by AIU.SetStream: 1 for enabled (streaming) or 0 for disabled (batch).
The value can be stored in a variable or pushed to the Top of Stack (TOS). Streaming affects delivery timing, not token usage, which incurs costs per token (e.g., words or symbols).
Retrieving the streaming mode is useful for:
•Verification: Confirm whether streaming is active before an operation.
•Debugging: Check if response delivery issues relate to streaming settings.
•Dynamic Control: Adjust script logic based on the current mode.
Call the command with an optional variable to store the result (1 or 0). If omitted, the value is placed on the stack.
Streaming mode impacts operations like AIU.Chat, with token costs unchanged (e.g., gpt-4o-mini: $0.60/1M output tokens).
Example Usage
AIU.SetStream|1
AIU.GetStream|$$STR
DBP.Streaming Enabled: $$STR
AIU.GetStream
POP.$$STR
DBP.Stream from Stack: $$STR
Sets streaming on and verifies the setting (returns "1").
Illustration
┌──────────────┬──────────────┐
│ Stream Mode │ Returned │
├──────────────┼──────────────┤
│ Enabled (1) │ 1 │
├──────────────┼──────────────┤
│ Disabled (0) │ 0 │
└──────────────┴──────────────┘
Illustration of possible streaming mode values retrieved.
Syntax
AIU.GetStream[|P1]
AIU.Get_Stream[|P1]
Parameter Explanation
P1 - (Optional) The variable where the streaming mode (1 or 0) will be stored. If omitted, the value is placed on the Top of Stack (TOS).
Example
AIU.SetStream|0
AIU.GetStream|$$MOD
DBP.Streaming Disabled: $$MOD
ENR.
Remarks
- Returns "1" for streaming enabled, "0" for disabled.
- Reflects the last setting from AIU.SetStream or the default (typically 0).
Limitations
- Only accepts zero or one parameter; extra parameters cause an error.
- Does not indicate endpoint compatibility with streaming.
See also:
• AIU.Chat