AIU. - Artificial Intelligence Utility

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > !Tool and Function Management >

AIU. - Artificial Intelligence Utility

AIU.SetToolChoice

Previous Top Next


MiniRobotLanguage (MRL)

 

AIU.SetToolChoice
Set the Preferred Tool Choice for the AI

 

Intention

 

SetToolChoice Command: Specify Tool Preference
 
The SetToolChoice command configures the AI’s preference for using tools (e.g., functions like calculators or search) during response generation.

This allows tailored responses for tasks requiring specific tools.

It’s part of the AIU - OpenAI API suite.

 

What is the SetToolChoice Command?

 

The SetToolChoice command sets the AI’s tool usage preference for operations like AIU.Chat.

Options include "auto" (AI chooses), "none" (no tools), or a specific tool name (e.g., "calculator"). Tools process tasks via tokens (words or symbols), potentially increasing token usage and cost depending on the tool’s complexity.

 

Why Do You Need It?

 

Setting tool choice is essential for:

Precision: Force specific tools for tasks like calculations or data retrieval.

Simplicity: Disable tools for text-only responses to reduce complexity.

Cost Control: Manage token usage by limiting tool calls.

 

How to Use the SetToolChoice Command?

 

Provide a string parameter: "auto", "none", or a specific tool name.

Tool usage impacts token costs. Pricing (as of March 18, 2025, from OpenAI’s pricing page) includes:

gpt-4o: $5.00/1M input tokens, $15.00/1M output tokens (128K context).

gpt-4o-mini: $0.15/1M input tokens, $0.60/1M output tokens (128K context).

gpt-3.5-turbo: $0.50/1M input tokens, $1.50/1M output tokens (16K context).

A tool call might add ~50-100 tokens, increasing costs slightly (e.g., $0.00003-$0.00006 for gpt-4o-mini).

 

Example Usage

 

AIU.SetToolChoice|calculator

AIU.Chat|What is 42 * 17?|$$RES

DBP.Calculation Result: $$RES

 

Sets the tool choice to "calculator" for precise math responses.

 

Illustration

 

┌──────────────┬────────────────────┐

│ Tool Choice  │ Response Example   │

├──────────────┼────────────────────┤

│ none         │ "Estimate: ~700"   │

├──────────────┼────────────────────┤

│ calculator   │ "Exact: 714"       │

└──────────────┴────────────────────┘

Illustration of how tool choice affects response precision.

 

Syntax

 

AIU.SetToolChoice|P1

AIU.Set_ToolChoice|P1

 

Parameter Explanation

 

P1 - A string specifying the tool choice: "auto", "none", or a tool name (e.g., "calculator"). Required.

 

Example

 

AIU.SetToolChoice|auto

AIU.Chat|What’s the weather?|$$WEA

DBP.Weather Info: $$WEA

ENR.

 

Remarks

 

- Default is typically "auto"; specific tools depend on model capabilities.

- Tool calls may increase token usage and API costs.

 

Limitations

 

- Requires exactly one parameter; omitting or adding extra parameters causes an error.

- Invalid tool names may result in errors or default behavior.

 

See also:

 

AIU.Get_ToolChoice

AIU.Chat

AIU.Get_Model

AIU.Get_TotalTokens

Tool Configuration