AIG. - AI Google Gemini Integration

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

AIG. - AI Google Gemini Integration

AIG.GetContent

Previous Top Next


MiniRobotLanguage (MRL)

 

AIG.Get Content
Retrieve the Content of the AI’s Response

 

Intention

 

GetContent Command: Access AI Response Data
 
The GetContent command retrieves the AI-generated content from the most recent Google Gemini API response, stored in the AIG_GrokContent global variable.

This enables you to process or display the AI’s output after querying it with AIG.Ask.

It’s part of the AIG - Google Gemini API suite.

 

What is the GetContent Command?

 

The GetContent command fetches the text or JSON content generated by the Gemini API from the AIG_GrokContent variable, populated after an API call via AIG_ChatCompletion or AIG.Ask.

It can return plain text or tool call JSON, depending on the response format, and stores the result in a specified variable or on the Top of Stack (TOS).

 

Why Do You Need It?

 

Accessing the AI’s response content is essential for:

Display: Show the AI’s response to the user (e.g., via DBP.).

Processing: Use the response in further script logic or function calls.

Debugging: Verify the output matches expectations or troubleshoot issues.

 

How to Use the GetContent Command?

 

Call the command after an API request to retrieve the response content. Use an optional variable to store the result; if omitted, it’s placed on the TOS.

The content depends on the last API call and can be text (up to 8192 tokens) or JSON (e.g., for tool calls), based on the AIG_ResponseFormat setting.

Supported Gemini models (as of March 19, 2025):

Gemini 1.0 Pro: 32,768 input tokens, 2,048 output tokens.

Gemini 1.5 Pro: 2M input tokens (128K stable), 8,192 output tokens.

Gemini 1.5 Flash: 1M input tokens, 8,192 output tokens.

Gemini 2.0 Flash: 2M input tokens (experimental), 8,192 output tokens.

 

Example Usage

 

AIG.Ask|What is the meaning of life?

AIG.Get Content|$$RES

DBP.AI Response: $$RES

 

Retrieves and displays the AI’s response to the query.

 

Illustration

 

┌───────────────┐

│ AI Response   │

├───────────────┤

│ Life’s meaning│

└───────────────┘

Extracts the latest AI response content.

 

Syntax

 

AIG.GetContent[|P1]

AIG.Get_Content[|P1]

 

Parameter Explanation

 

P1 - (Optional) Variable to store the response content. If omitted, the content is placed on the Top of Stack (TOS).

 

Example

 

AIG.Set Model|gemini-1.5-flash

AIG.Ask|Summarize quantum physics

AIG.Get Content|$$SUM

DBP.Summary: $$SUM

ENR.

 

Remarks

 

- Requires a prior API call (e.g., AIG.Ask) to populate AIG_GrokContent.

- Content is overwritten with each new API response.

- Supports Unicode text up to 1MB (if copied to clipboard via AIG_ClipboardOutput).

 

Limitations

 

- Returns empty if no prior API call has been made since initialization.

- Limited to the last response; historical responses are not retained.

 

See also:

 

AIG.Ask

AIG.Get MaxToken

Response Analysis