r/Automate 6h ago

Add AI to Your Macros

2 Upvotes

I’ve been working on a tool called AdvantageBuilder that enables AI integration with scripting languages like Powershell, JScript, and JavaScriptV8 (clearscript).

Here’s a small example::

[!POWERSHELLSCRIPT]

# Load AIHelper
using module "[PSModuleLibrary]\AIHelper.psm1"

# Create AIHelper instance
$AIHelper = [AIHelper]::new()

# Configure
$AIHelper.Provider = "google"
$AIHelper.Model    = "gemini-2.0-flash"
$AIHelper.ApiKey   = "YOUR_API_KEY"

# Enable stateful mode if needed
# $AIHelper.Stateful = $true

$AIHelper.SystemPrompt = "You are an assistant helping with AdvantageBuilder macros."

# Send a prompt
$response = $AIHelper.Send("Write a short greeting message.")

# Use the result
write-host $response

[!/POWERSHELLSCRIPT]

I will post a comment with a link to step b step instructions