AIX. - Artificial Intelligence Extended Utility

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIX. - Grok / X - API > !Response Behavior Settings >

AIX. - Artificial Intelligence Extended Utility

AIX.SetStream

Previous Top Next


MiniRobotLanguage (MRL)

 

AIX.SetStream
Set the Streaming Mode for Responses

 

Intention

 

SetStream Command: Enable or Disable Streaming
 
The SetStream command sets the streaming mode for Grok API responses in the AIX framework, determining whether responses are delivered incrementally or all at once.

This allows users to control the response delivery method for better interactivity or performance.

It’s part of the AIX - Grok / X - API suite.

 

What is the SetStream Command?

 

The SetStream command updates the AIX_Stream global variable, which is used in the Grok API JSON payload to enable or disable streaming.

It accepts an optional LONG parameter: non-zero values enable streaming (set to 1), 0 disables it, and -1 resets to the default (0, disabled). Streaming mode delivers responses incrementally, which is useful for real-time applications but may affect how results are processed in the AIX framework.

 

Why Do You Need It?

 

Setting the streaming mode is valuable for:

Interactivity: Enable streaming for real-time response display.

Performance: Disable streaming for faster batch processing.

Compatibility: Adjust delivery method to suit script requirements.

 

How to Use the SetStream Command?

 

Provide an optional LONG value: 1 to enable streaming, 0 to disable, or -1 to reset to the default (0, disabled).

The setting affects subsequent AIX.Ask or AIX.AskVision calls. No additional API costs are incurred for setting as of March 18, 2025, though streaming may impact response handling.

 

Example Usage

 

AIX.SetStream|1

AIX.Ask|Tell a story|$$STO

DBP.Story (streaming): $$STO

 

Enables streaming for incremental story delivery.

 

Illustration

 

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

│ Stream Value │ Delivery Method    │

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

│ 1            │ Incremental        │

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

│ 0            │ All at once        │

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

Illustration of streaming mode effects on response delivery.

 

Syntax

 

AIX.SetStream[|P1]

AIX.Set_Stream[|P1]

 

Parameter Explanation

 

P1 - (Optional) A LONG value: 1 to enable streaming, 0 to disable, or -1 to reset to default (0, disabled). If omitted, the setting remains unchanged.

 

Example

 

AIX.SetStream|0

AIX.Ask|Explain quantum physics|$$EXP

DBP.Explanation (non-streaming): $$EXP

AIX.SetStream|-1

DBP.Streaming reset to default

ENR.

 

Remarks

 

- Streaming mode is included in the API payload via AIX_CreateGrokJSONPayload as a boolean ("true" or "false").

- Takes effect on the next API call; existing responses are unaffected.

 

Limitations

 

- Accepts zero or one parameter; extra parameters may cause an error depending on the interpreter.

- Streaming may not be supported by all Grok API endpoints or models.

 

See also:

 

AIX.Get_Stream

AIX.Ask

AIX.Ask_Vision

AIX.Get_Content