- Sitecorepunk 2077
"FREE FOR ALL" [ Sitecore PowerShell Extensions + OpenAI ]
The SPExAI Report Generator is a Sitecore PowerShell Extensions (SPE) module that integrates OpenAI LLMs to dynamically generate Sitecore PowerShell reports based on natural language input and pre-defined rules.
Creating SPE reports traditionally requires technical expertise, knowledge of Sitecore’s API, and familiarity with SPE scripting. This can be a barrier for content authors, marketers, or non-developer teams who need reports but lack coding skills.
Without a user-friendly way to generate reports, organizations may miss out on valuable insights, struggle to track content performance, or waste time on manual data extraction.
The SPExAI Report Generator module streamlines the process of creating Sitecore reports by allowing users to describe their reporting needs in plain English, which in turn, generates a structured PowerShell script following Sitecore best practices. The generated script is saved to the tree for future use and can be executed immediately or modified before running.
The hope is that it can serve as a valuable tool for developers interested in rapid SPE report prototyping, and eventually become a go-to resource for content authors, marketers, and other non-technical users who need to generate reports quickly and efficiently.
- ✨ AI-Generated Reports
- 🔗 Seamless Integration
- 🚅 Immediate Execution or Customization
-
⚙ Flexible API Configuration
-
👍 Predefined Best Practices
- Ensures generated scripts adhere to Sitecore PowerShell standards, maintaining structure, validation, and efficiency.
- 🚀 Empowers both Technical and Non-Technical Users
- Reduces development effort while enabling content authors and marketers to generate reports effortlessly.
Before installing the SPExAI Report Generator, please make sure the following requirements are met:
-
⭕ Sitecore 10.x or later
- Tested on Sitecore
10.0and,10.3and10.4but should work with earlier versions. - Untested on XM Cloud, but also likely compatible.
- Tested on Sitecore
-
🚀 Sitecore PowerShell Extensions (SPE)
7.0
- 🌎 Internet access
- Sitecore must be able to connect to OpenAI’s API.
- 🔑 OpenAI API Key
- Required for AI-powered script generation.
- AI services are not completely cost-free, so you'll need to sign up for an API key at OpenAI.
- The module is pre-configured to use the
o3-mini-2025-01-31model. - The model can be changed within in the
API Settingsitem, but because outputs may vary, I recommend retaining this model for consistency. - For reference,
109requests (711,419total tokens) against theo3-mini-2025-01-31during the development of this model cost$1.15USD.
- Required for AI-powered script generation.
👨⚖️ Judges: I've excluded my API key from the Sitecore package. If you don't have an OpenAI account, and need a way to test this without signing up, please reach out to me on Slack and I can lend you a key!
- Use the
Sitecore Installation Wizardto install the SPExAI Report Generator-1.zip
- After the package has completed installing, navigate to the
Desktop>Start Button>PowerShell Toolbox>Rebuild script integration points
Navigate to /sitecore/system/Modules/PowerShell/Script Library/SPExAI Report Generator/API Settings and set the API Key key field with your OpenAI secret key generated in the prerequisites.
- Navigate to an item in the
Content Editor. This will be treated as the root path for the script.
- A dialog will appear:
- Populate the
Report Namefield - Select an item in the
Report Scope (Root Location)field. - Provide a description of the report you want to generate in the
Describe Your Report.
- Populate the
- After the script is generated, choose one of the options:
-
Open Script Item(opens the PowerShell script item in theContent Editor) -
Run Report(executes the script) -
Close(takes no action, closes the dialog)
-
- The Generated report will appear in the
SPExAI Generatedfolder from thePowerShell Reportssection of theStart Menu:
While the Ribbon button is the primary method of generating reports, the SPExAI Report Generator can also be accessed via the right-click context menu in the Content Editor on any item:
The raw PowerShell script defined in the SPExAI Report Generator PowerShell Module can be reviewed here:
Included in the src folder is the System Prompt (which is integrated into the API Settings item) used to the achieve one-shot prompting result.
Finally, the supplemental Knowledgebase file that's dynamically included in the System Prompt before the request is sent to OpenAI can also be found in the src folder. The file contains some general SPE documentation plus script examples which the model refers to in order generate reports relatively consistent format.
I see future iterations of this module including more advanced features such as:
- Regenerating / iterating on existing reports/scripts.
- Improved stability and response consistency following the more advanced OpenAI (or other LLM provider) models.
- More advanced configuration options for the AI model and knowledgebase.















