AIG. - AI Google Gemini Integration

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIG. - Google AI > A.Tools-Configuration >

AIG. - AI Google Gemini Integration

AIG.SetToolsFromArray

Previous Top Next


MiniRobotLanguage (MRL)

 

AIG.SetToolsFromArray
Smart Function Definition with Auto-Mapping

 

Intention

 

To define AI Tools (Functions) using a simple list format in an SPR Array. This command reads the array, constructs the complex JSON required by Google, and optionally automatically links the tool to a Script Label.

 

Smart Detection Logic

 

This command inspects the second column of each row to determine if you are providing a Handler Label:

Format A (Auto-Map): If Column 2 starts with :, it is treated as a Script Label. The system automatically calls AIG.MapToolHandler for you.

Format B (Manual): If Column 2 does not start with :, it is treated as the Description. No mapping is performed.

 

Required Array Formats (Pipe Separated)

 

1. With Auto-Mapping (Recommended):

Name | :Label | Description | Param1 | Param2 ...

 

2. Without Mapping (Definition Only):

Name | Description | Param1 | Param2 ...

 

Parameter Definition Syntax

 

Parameters must be formatted as: Name:Type:Description

str : String / Text

int : Integer / Number

bool : Boolean (True/False)

 

Example Usage

 

' 1. Clear Array 10

ARR.clm|10

 

' 2. Define Tool A (With Auto-Map)

' Name: set_light, Label: :Hnd_Light, Desc: Turn on light

$$T1=set_light|:Hnd_Light|Turn on light|color:str:Color|bright:int:Level

ARR.Set|10|0|$$T1

 

' 3. Define Tool B (Manual / No Label)

' Name: calc, Desc: Add numbers (Note: No :Label in col 2)

$$T2=calc|Add two numbers|a:int:First val|b:int:Second val

ARR.Set|10|1|$$T2

 

' 4. Register Tools

AIG.SetToolsFromArray|10

 

' 5. Use it

AIG.Ask|Turn the light red.

AIG.DoToolCall

ENR.

 

' --- Handlers ---

:Hnd_Light

 AIG.GetToolParam|color|$$COL

 DBP.Light is now $$COL

 RET.

 

Syntax

 

AIG.SetToolsFromArray|P1

AIG.stfa|P1

 

Parameter Explanation

 

P1 - (Integer) The number of the SPR Array (0-32) containing the definitions.

 

See also:

 

? AIG.DoToolCall (Automatic dispatch)

? AIG.MapToolHandler (Manual mapping)

? AIG.SetTools (Manual JSON method)