|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIG. - Google AI > 6. Core Operations > AIG. - AI Google Gemini Integration |
MiniRobotLanguage (MRL)
AIG.ListModels
Retrieve Available Google AI Models
Intention
Query the Google Generative AI API to retrieve a list of models that are currently available for use with your configured API Key and the currently selected Base Endpoint URL (v1 or v1beta). This helps determine valid model IDs for use with AIG.setmodel.
This Command performs an HTTP GET request to the models endpoint (derived from the current Base URL set by AIG.setbaseurl) using your API Key for authentication. It parses the JSON response returned by Google and formats it into a human-readable multi-line string listing the available models and their key details (ID, display name, version, token limits, description, supported methods).
Use this Command to:
�Discover Available Models: See exactly which models (stable, preview, experimental) your API key can access on the target endpoint (v1 or v1beta).
�Verify Model IDs: Get the correct short Model ID string needed for the AIG.setmodel Command.
�Check Supported Methods: See which generation methods (like `generateContent`, `embedContent`) are listed for each model.
�Understand Model Capabilities: View descriptions and token limits.
Ensure your API key is set using AIG.setkey. Select the desired API endpoint version (v1 or v1beta) using AIG.setbaseurl (optional, defaults to v1). Then, simply call the Command. You can optionally provide a variable name (P1) to store the resulting formatted string.
Example Usage
// Ensure API key is set first
// AIG.Set Key|YourApiKeyHere
// List models available on the default v1 endpoint
AIG.SetBaseUrl|"" // Ensure default v1
AIG.ListModels|$$ModelListV1
DBP. @$$ModelListV1
// List models available on the v1beta endpoint
AIG.SetBaseUrl|https://generativelanguage.googleapis.com/v1beta/models
AIG.ListModels|$$ModelListBeta
DBP. @$$ModelListBeta
Syntax
AIG.ListModels[|P1]
AIG.lsm[|P1]
Parameter Explanation
P1 - (Optional) The name of the variable (e.g., `$$MYL`) where the retrieved formatted model list string should be stored.
Remarks
- Requires a valid API key to be set via AIG.setkey.
- The list returned depends on the currently set Base URL (see AIG.setbaseurl).
- If the API call fails or returns an error, the result stored in P1 (or returned implicitly) will be an error message string starting with `"Error:"`.
See also: