AIU. - Artificial Intelligence Utility

<< 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

AIU.GetResponseFormat

Previous Top Next


MiniRobotLanguage (MRL)

 

AIU.GetResponseFormat
Retrieve the Current Response Format

 

Intention

 

GetResponseFormat Command: Verify Response Structure
 
The GetResponseFormat command retrieves the current format setting for AI responses, such as "text", "json", or "b64_json".

This helps confirm or adjust how responses are structured in your script.

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

 

What is the GetResponseFormat Command?

 

The GetResponseFormat command returns the current response format set by AIU.SetResponseFormat.

Possible values are "text", "json", or "b64_json", returned as a string to a variable or the Top of Stack (TOS). The format influences response parsing but not core token count or cost directly.

 

Why Do You Need It?

 

Retrieving the response format is valuable for:

Verification: Confirm the format before processing responses.

Debugging: Check if parsing issues relate to the format setting.

Dynamic Handling: Adjust script logic based on the current format.

 

How to Use the GetResponseFormat Command?

 

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

The format applies to operations like AIU.Chat, with minor token overhead for structured formats (e.g., gpt-3.5-turbo: $1.50/1M output tokens).

 

Example Usage

 

AIU.SetResponseFormat|json

AIU.GetResponseFormat|$$FMT

DBP.Response Format: $$FMT

AIU.GetResponseFormat

POP.$$FMT

DBP.Format from Stack: $$FMT

 

Sets the format to "json" and retrieves it (returns "json").

 

Illustration

 

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

│ Set Format   │ Retrieved    │

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

│ json         │ json         │

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

│ b64_json     │ b64_json     │

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

Illustration of retrieving different response format settings.

 

Syntax

 

AIU.GetResponseFormat[|P1]

AIU.Get_ResponseFormat[|P1]

 

Parameter Explanation

 

P1 - (Optional) The variable where the response format will be stored. If omitted, the value is placed on the Top of Stack (TOS).

 

Example

 

AIU.SetResponseFormat|text

AIU.GetResponseFormat|$$FMT

DBP.Response Format: $$FMT

ENR.

 

Remarks

 

- Returns a string (e.g., "text", "json", "b64_json").

- Reflects the last setting from AIU.SetResponseFormat or the default (usually "text").

 

Limitations

 

- Only accepts zero or one parameter; extra parameters cause an error.

- Does not validate model compatibility with the format.

 

See also:

 

AIU.Set_ResponseFormat

AIU.Chat

AIU.Responses

AIU.Get_TotalTokens

Response Format Configuration