|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIX. - Grok / X - API > !Output Formatting and Delivery > AIX - Artificial Intelligence and X Platform Utility |
MiniRobotLanguage (MRL)
AIX.Get Content
Retrieve the Content of the AI’s Response
Intention
Get Content Command: Access Response Text or Data
The Get Content command retrieves the content of the latest response from the Grok API, as processed by the HTP_AnalyzeGrokResponse subroutine.
This provides the raw text or tool call data generated by the AI.
It’s part of the AIX - Grok / X - API suite.
The Get Content command returns the value of the AIX_GrokContent global variable, which contains the unescaped content of the latest response.
For text or vision responses, this is the AI-generated text; for function call responses, it includes the tool_calls JSON data.
Retrieving the response content is essential for:
•Content Use: Utilizes the AI’s output in applications or scripts.
•Function Handling: Processes tool call data for execution.
•Verification: Reviews the raw response for accuracy or debugging.
Use the command to retrieve the content after executing an AI query with AIX.Ask or AIX.AskVision.
Store the result in a variable for further processing, display, or clipboard copying if enabled.
Example Usage
AIX.SetKey|""your_api_key_here""
AIX.SetModel|""grok-3""
AIX.SetTools|""{""name"": ""get_time"", ""description"": ""Get current time""}""
AIX.Ask|""What time is it now?""
AIX.Get Content|$$CONTENT
IF AIX.Get IsFunctionCall|$$IS_CALL AND $$IS_CALL = 1 THEN
DBP.Content is a function call: $$CONTENT
ELSE
DBP.Content is text: $$CONTENT
END IF
This example sets up the system, sends a query, retrieves the content, and checks if it’s a function call or text response.
Illustration
┌────────────────────┐
│ Content Retrieval │
├────────────────────┤
│ Input: Response │
│ Process: Extract │
│ Output: Content │
└────────────────────┘
A visual of extracting the content from the response.
Syntax
AIX.Get Content|$$variable
AIX_Get_Content|$$variable
Parameter Explanation
$$variable - (Required) A variable (e.g., $$CONTENT) of type WSTRING where the response content will be stored.
Remarks
- The content is extracted from the choices[0].message.content field for text/vision responses or tool_calls for function call responses, unescaped by W_JSON_UnescapeString.
- Requires a prior call to AIX.Ask or AIX.AskVision to populate the response data.
Limitations
- Returns an error message (e.g., "Error: No content found in response") if the response lacks content or fails to parse.
- Reflects only the latest response analysis; previous content is overwritten.
See also:
• AIX.Ask