|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > !Response Behavior Settings > AIU. - Artificial Intelligence Utility |
MiniRobotLanguage (MRL)
AIU.SetStop
Set the Stop Sequence for Response Generation
Intention
SetStop Command: Define Response Termination
The SetStop command allows you to specify a stop sequence that tells the AI when to end its response generation.
This helps tailor the AI's output to your needs by stopping at a predefined point.
It’s part of the AIU - OpenAI API suite.
The SetStop command configures a sequence (e.g., a word or phrase) that, when encountered, signals the AI to stop generating further text.
This is particularly useful for controlling response length or ensuring the AI halts at a logical point in your script.
Setting a stop sequence is essential for:
•Precision: Limit responses to relevant content by stopping at a specific marker.
•Efficiency: Prevent unnecessary token usage by halting generation early.
•Customization: Tailor AI behavior to fit specific use cases or workflows.
Provide a string as the stop sequence, such as a word, phrase, or symbol, that the AI will recognize as the end point.
This setting applies to subsequent AI operations like AIU.Chat or AIU.Responses.
Available models and their prices (as of March 18, 2025, from OpenAI’s pricing page) include:
•gpt-4o: $5.00/1M input tokens, $15.00/1M output tokens (multimodal, 128K context).
•gpt-4o-mini: $0.15/1M input tokens, $0.60/1M output tokens (cost-effective, 128K context).
•gpt-4-turbo: $10.00/1M input tokens, $30.00/1M output tokens (high performance, 128K context).
•gpt-3.5-turbo: $0.50/1M input tokens, $1.50/1M output tokens (dialog-optimized, 16K context).
•o1-preview: $15.00/1M input tokens, $60.00/1M output tokens (advanced reasoning, 128K context).
•o1-mini: $3.00/1M input tokens, $12.00/1M output tokens (reasoning, cost-effective, 128K context).
Example Usage
AIU.SetStop|END
AIU.Chat|Tell me a story|$$RES
DBP.Story stops at 'END': $$RES
In this example, the AI stops generating the story when it encounters 'END'.
Illustration
┌────────────────────┐
│ Stop Sequence │
├────────────────────┤
│ "END" │
└────────────────────┘
The AI halts output when it detects the stop sequence "END".
Syntax
AIU.SetStop|P1
AIU.Set_Stop|P1
Parameter Explanation
P1 - The stop sequence (string) that the AI will recognize as the termination point for response generation.
Example
AIU.SetStop|STOP_HERE
AIU.Chat|Describe a scene|$$OUT
DBP.Scene: $$OUT
ENR.
Remarks
- The stop sequence is case-sensitive and must match exactly in the AI's output.
- Use AIU.GetStop to verify the current stop sequence.
Limitations
- Only one stop sequence can be set at a time; multiple sequences are not supported.
- The effectiveness depends on the AI model's ability to recognize the sequence.
See also:
• AIU.Chat