AIG. - AI Google Gemini Integration

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

AIG. - AI Google Gemini Integration

AIG.SetEndpointAction

Previous Top Next


MiniRobotLanguage (MRL)

 

AIG.Set EndpointAction (Alias: AIG.SetEndpoint)
Set the API Endpoint Action Suffix for Google Gemini API

 

Intention

 

Specify the action suffix (e.g., :generateContent, :embedContent) used when constructing the full API endpoint URL for Google Gemini requests. This suffix is dynamically combined with the base URL and the selected model name. It allows targeting different API operations for the chosen model. Part of the AIG - Google Gemini API suite.

 

What is the SetEndpointAction Command?

 

This command sets the AIG_EndpointAction global variable. This variable holds the string that defines the specific operation to be performed on the model, typically starting with a colon (`:`).

 

The full endpoint URL used for API requests is always constructed dynamically by the AIG.Get Endpoint function, which combines:

The Base URL ($AIG_BaseEndpoint)

The selected Model Name (from AIG.Get Model)

The current Action Suffix (from AIG_EndpointAction, set by this command)

 

By default, after AIG.Initialize, the action suffix is set to $AIG_Def_EndpointAction (usually `":generateContent"`).

 

If you provide an empty string ("") as the parameter, it resets the AIG_EndpointAction variable back to this default value.

 

Why Do You Need It?

 

Use this command to:

Target Different API Operations: Switch from generating content (`:generateContent`) to other operations like embedding content (`:embedContent`), batch processing (`:batchEmbedContents`), or streaming (`:streamGenerateContent`) if supported by the API and model.

Adapt to Future API Changes: If Google adds new actions, you can target them by setting the appropriate suffix.

Reset to Default: Ensure the standard `:generateContent` action is used by passing an empty string.

 

How to Use

 

1. Setting a Specific Action:

Provide the desired action suffix string (including the leading colon) as parameter P1.
AIG.Set EndpointAction|:embedContent
DBP.Endpoint action set to :embedContent.

 

2. Resetting to Default Action:

Provide an empty string ("") as parameter P1.
AIG.Set EndpointAction|""
DBP.Endpoint action reset to default (:generateContent).

 

The dynamically constructed URL can be verified using AIG.Get Endpoint.

 

Example Usage

 

// Set the action to embed content

AIG.Set EndpointAction|:embedContent

DBP.Endpoint action set for embedding.

 

// Reset action back to default

AIG.Set EndpointAction|""

DBP.Endpoint action reset to default.

 

Syntax

 

AIG.SetEndpointAction|P1

AIG.Set EndpointAction|P1

Alias: AIG.SetEndpoint|P1

 

Parameter Explanation

 

P1 - (Optional) The action suffix string (including the leading colon ':') to append to the model endpoint URL.
   - If a non-empty string like `":embedContent"` is provided, it sets the action.
   - If an empty string (`""`) is provided (or the parameter is omitted), the action resets to the default (`$AIG_Def_EndpointAction`, usually `":generateContent"`).

 

Example

 

// Use the alias to set the action for embedding

AIG.Set Endpoint|:embedContent

DBP.Endpoint action set for embedding.

ENR.

 

Remarks

 

- The action suffix typically starts with a colon (`:`).

- This command does not change the selected model (`AIG_Model`). Use AIG.Set Model for that.

- Ensure the chosen action suffix is valid for the selected model and intended API operation.

- Use AIG.Get EndpointAction to retrieve the current suffix, or AIG.Get Endpoint to verify the full constructed URL.

 

Limitations

 

- No validation is performed on whether the provided action suffix is actually supported by the Google API or the currently selected model.

- Using an incorrect action suffix will likely cause API calls to fail.

 

See also:

 

AIG.Get Endpoint (Returns the fully constructed URL)

AIG.Get EndpointAction (Returns the current action suffix string)

AIG.Set Model

AIG.Get Model

Endpoint Management (Conceptual Overview)

AIG. Commands Overview