AIU. - Artificial Intelligence Utility

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > !Response Analysis >

AIU. - Artificial Intelligence Utility

AIU.GetContent

Previous Top Next


MiniRobotLanguage (MRL)

 

AIU.GetContent
Retrieve the Content of the AI’s Response

 

Intention

 

GetContent Command: Access Response Text
 
The GetContent command retrieves the textual content of the AI’s most recent response generated by commands like AIU.Responses or AIU.ResponsesVision.

It provides direct access to the response text for further processing.

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

 

What is the GetContent Command?

 

The GetContent command fetches the text content of the last AI response, typically from a completion operation.

It can return the content to an optional variable or push it to the Top of Stack (TOS), reflecting the response stored in the session, possibly tied to AIU.SetPreviousResponseId.

 

Why Do You Need It?

 

Retrieving the response content is useful for:

Processing: Extract the raw text for further manipulation or display.

Verification: Confirm the AI’s output matches expectations.

Logging: Store or analyze the response independently of initial variables.

 

How to Use the GetContent Command?

 

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

It works with responses from models like gpt-4o ($15.00/1M output tokens) or gpt-3.5-turbo ($1.50/1M output tokens), with no additional token cost for retrieval as of March 18, 2025.

 

Example Usage

 

AIU.Responses|Tell me a story|$$STO

AIU.GetContent|$$TXT

DBP.Story: $$TXT

 

Generates a story and retrieves its content into $$TXT (e.g., "Once upon a time...").

 

Illustration

 

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

│ Response     │ Retrieved Content  │

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

│ Hello world  │ "Hello world"      │

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

│ (unset)      │ ""                 │

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

Illustration of retrieving response content, including unset state.

 

Syntax

 

AIU.GetContent[|P1]

AIU.Get_Content[|P1]

 

Parameter Explanation

 

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

 

Example

 

AIU.Responses|What’s 2+2?|$$ANS

AIU.GetContent|$$RES

DBP.Result: $$RES

ENR.

 

Remarks

 

- Returns an empty string ("") if no response content is available.

- Reflects the last response from a completion command in the session.

 

Limitations

 

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

- Only retrieves the most recent response; older responses require specific IDs.

 

See also:

 

AIU.Responses

AIU.ResponsesVision

AIU.Get_WordCount

Responses API Configuration