|
<< 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 |
MiniRobotLanguage (MRL)
AIG.SetTools
Define Functions for AI Interaction (Function Calling)
Intention
Enable the AI model to "act" by giving it a list of custom tools (functions) it can request. The AI will analyze the user's prompt, and if it needs data or an action, it will output a structured request to call one of these functions instead of generating text.
This Command takes a JSON string that defines the available functions. This string is stored internally and sent with every subsequent AI request.
{
"function_declarations": [
{
"name": "function_name",
"description": "What it does...",
"parameters": { ...OpenAPI Schema... }
}
]
}
This example defines a suite of tools for Window Finding, Clicking, and Typing.
' 1. Start JSON
$$JSO={ "function_declarations": [
' --- Tool 1: Find Window ---
$$JSO+ { "name": "find_window_by_title",
$$JSO+ "description": "Finds a window handle based on partial title text.",
$$JSO+ "parameters": { "type": "OBJECT", "properties": {
$$JSO+ "title_text": { "type": "STRING", "description": "Text to search for in window title" }
$$JSO+ }, "required": ["title_text"] } },
' --- Tool 2: Mouse Click ---
$$JSO+ { "name": "mouse_click_relative",
$$JSO+ "description": "Clicks the mouse at X,Y coordinates relative to a window handle.",
$$JSO+ "parameters": { "type": "OBJECT", "properties": {
$$JSO+ "hwnd": { "type": "INTEGER", "description": "The window handle to click inside" },
$$JSO+ "x": { "type": "INTEGER", "description": "X position" },
$$JSO+ "y": { "type": "INTEGER", "description": "Y position" }
$$JSO+ }, "required": ["hwnd", "x", "y"] } },
' --- Tool 3: Send Keys ---
$$JSO+ { "name": "send_keys_active",
$$JSO+ "description": "Types text or keys into the currently focused window.",
$$JSO+ "parameters": { "type": "OBJECT", "properties": {
$$JSO+ "text": { "type": "STRING", "description": "The text to type" }
$$JSO+ }, "required": ["text"] } }
' End JSON
$$JSO+ ] }
' 2. Register these tools
AIG.SetTools|$$JSO
' 3. Ask the AI to do something complex
AIG.Ask|Find the Notepad window and type 'Hello World'.
' 4. Handle the AI Response
AIG.IsFuncCall|$$IS_TOOL
IVV.$$IS_TOOL=1
AIG.GetContent|$$DATA
' Likely Response 1: { "name": "find_window_by_title", "args": { "title_text": "Notepad" } }
' (Your script must now run STW.t|Notepad, get the handle, and feed it back to the AI)
EIF.
Syntax
AIG.SetTools|P1
AIG.stl|P1
Parameter Explanation
P1 - (String) The complete JSON string defining the tools.
� �- To Disable: Pass an empty string or `""`.
See also:
? AIG.SetToolChoice (Force usage)
? AIG.IsFuncCall (Check result)