• Stars
    star
    689
  • Rank 65,628 (Top 2 %)
  • Language
    PowerShell
  • License
    Apache License 2.0
  • Created almost 2 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PowerShell AI module for OpenAI GPT-3 and DALL-E

OpenAI at your Fingertips! ✨

using PowerShell



• Documentation •

PowerShellAI

A User-Friendly Module for OpenAI's GPT-3 and DALL-E API

PowerShellAI is a community-maintained PowerShell module designed to simplify the use of OpenAI's GPT-3 language model and DALL-E API. It empowers users to effortlessly build complex language-powered applications, regardless of their level of experience.

PowerShellAI is cross-platform and runs seamlessly on Windows, Linux, and MacOS.

Getting started with PowerShellAI is easy. Simply install the module from the gallery using the following command:

Install-Module -Name PowerShellAI

The repository includes a comprehensive list of functions that enable users to interact with GPT-3 and DALL-E, along with examples of how to use them at the command line or in scripts.

The video demos showcase the many possibilities of the module and how you can leverage its functions to best suit your needs.

Whether you're a seasoned developer or just getting started with AI, PowerShellAI is a valuable tool that can help you unlock the full potential of OpenAI's GPT-3 and DALL-E.



Unleash the Power of Artificial Intelligence with PowerShell

Welcome to the PowerShell Artificial Intelligence repository! Here, you will find a collection of powerful PowerShell scripts that will enable you to easily integrate AI into your projects and take them to the next level. Imagine being able to interact directly with OpenAI's GPT AI with just a few simple commands. With this module, it's now possible.

Get Ahead of the Game

By using this module, you'll have the ability to add cutting-edge AI functionality to your projects without needing to have a deep understanding of the underlying technology. This means you can stay focused on what you do best while still being able to work with the latest and greatest.

Start Your AI Journey Today

Installation

In the PowerShell console:

Install-Module -Name PowerShellAI

Get/Create your OpenAI API key from https://platform.openai.com/account/api-keys and then set as secure string with Set-OpenAIKey or as plain text with $env:OpenAIKey.

Examples

Check out these PowerShell scripts to see how easy it is to get started with AI in PowerShell:

PS Script Description Location
ai Experimental AI function that you can pipe all sorts of things into and get back a completion ai.ps1
copilot Makes the request to GPT, parses the response and displays it in a box and then prompts the user to run the code or not. copilot.ps1
Get-GPT3Completion - alias gpt Get a completion from the OpenAI GPT-3 API Get-GPT3Completion.ps1
Invoke-AIErrorHelper Helper function let ChatGPT add more info about errors Invoke-AIErrorHelper.ps1
Invoke-AIExplain Utilizes the OpenAI GPT-3 API to offer explanations for the most recently run command, and more. Invoke-AIExplain.ps1
Get-OpenAIEdit Given a prompt and an instruction, the model will return an edited version of the prompt Get-OpenAIEdit.ps1
Get-DalleImage Get an image from the OpenAI DALL-E API Get-DalleImage.ps1
Set-DalleImageAsWallpaper Set the image from the OpenAI DALL-E API as the wallpaper Set-DalleImageAsWallpaper.ps1
Get-OpenAIUsage Returns a billing summary of OpenAI API usage for your organization
Disable-AIShortCutKey Disable the ctrl+g shortcut key go getting completions Disable-AIShortCutKey.ps1
Enable-AIShortCutKey Enable the ctrl+g Enable-AIShortCutKey.ps1

Polyglot Interactive Notebooks

Notebook Description Location
OpenAI Settings A notebook shows how to get OpenAI dashboard info Settings.ipynb

Demos of the PowerShellAI

Here are some videos of PowerShellAI in action:

Description YouTube Video
Quick Demo of PowerShellAI
Using PowerShell with OpenAI GPT in the console with a shortcut key
PowerShell AI - copilot at the command line
PowerShell AI - new ai function
New-Spreadsheet script: PowerShell + ChatGPT + Excel
Invoke-AIErrorHelper: Lets ChatGPT provide additional information and context about errors
Invoke-AIExplain: Utilizes the OpenAI GPT-3 API to offer explanations for the most recently run command, and more.


What it looks like

Note: You can use the gpt alias for Get-GPT3Completion

Get-GPT3Completion "list of planets only names as json"

[
    "Mercury",
    "Venus",
    "Earth",
    "Mars",
    "Jupiter",
    "Saturn",
    "Uranus",
    "Neptune"
]

As XML

Get-GPT3Completion "list of planets only names as xml"


<?xml version="1.0" encoding="UTF-8"?>
<planets>
  <planet>Mercury</planet>
  <planet>Venus</planet>
  <planet>Earth</planet>
  <planet>Mars</planet>
  <planet>Jupiter</planet>
  <planet>Saturn</planet>
  <planet>Uranus</planet>
  <planet>Neptune</planet>
</planets>

As Markdown

 Get-GPT3Completion "first 5 US presidents and terms as markdown table"


| President | Term |
|----------|------|
| George Washington | 1789-1797 |
| John Adams | 1797-1801 |
| Thomas Jefferson | 1801-1809 |
| James Madison | 1809-1817 |
| James Monroe | 1817-1825 |

Copy and pasted into this README.md:

President Term
George Washington 1789-1797
John Adams 1797-1801
Thomas Jefferson 1801-1809
James Madison 1809-1817
James Monroe 1817-1825

ai function

The ai function calls that allows piping and prompting text. This is useful for chaining commands together.

ai "list of planets only names as json"
[
    "Mercury",
    "Venus",
    "Earth",
    "Mars",
    "Jupiter",
    "Saturn",
    "Uranus",
    "Neptune"
]
ai "list of planets only names as json" | ai 'convert to  xml'
<?xml version="1.0" encoding="UTF-8"?>
<Planets>
    <Planet>Mercury</Planet>
    <Planet>Venus</Planet>
    <Planet>Earth</Planet>
    <Planet>Mars</Planet>
    <Planet>Jupiter</Planet>
    <Planet>Saturn</Planet>
    <Planet>Uranus</Planet>
    <Planet>Neptune</Planet>
</Planets>
ai "list of planets only names as json" | ai 'convert to  xml' | ai 'convert to  powershell'
[xml]$xml = @"
<?xml version="1.0" encoding="UTF-8"?>
<Planets>
    <Planet>Mercury</Planet>
    <Planet>Venus</Planet>
    <Planet>Earth</Planet>
    <Planet>Mars</Planet>
    <Planet>Jupiter</Planet>
    <Planet>Saturn</Planet>
    <Planet>Uranus</Planet>
    <Planet>Neptune</Planet>
</Planets>
"@

$xml.Planets.Planet

Use ai with git

Pipe the output of git status to ai to create a commit message.

git status | ai "create a detailed git message"
Commit message:
Added PowerShellAI.psd1, README.md, changelog.md, and Public/ai.ps1 to dcf-spike-piping-to-ai-function branch. Updated PowerShellAI.psd1 and README.md with new changes. Added changelog.md to track changes. Added Public/ai.ps1 to enable piping to AI function.

Copilot at the PowerShell Console

Thank you to Clem Messerli for posting a great prompt to show copilot in action.

Alt text

Check out the video of copilot in action

Ask ChatGPT for help with an error message

If you get an error after executing some PowerShell. You can now ask ChatGPT for help. The new Invoke-AIErrorInsights function will take the last error message and ask ChatGPT for help.

You can also use the alias ieh.

Alt text

Code editing example

Unlike completions, edits takes two inputs: the text to edit and an instruction. Here the model is set to code-davinci-edit-001 because we're working with PowerShell code.

  • Here you're passing in the string (InputText) that is a PowerShell function.
  • The instruction is to add a comment-based help detailed description
Get-OpenAIEdit -InputText @'
function greet {
    param($n)

    "Hello $n"
}
'@ -Instruction 'add comment-based help detailed description'

The GPT AI returns:

<#
    .SYNOPSIS
        Greet someone
    .DESCRIPTION
        This function greets someone
    .PARAMETER n
        The name of the person to greet
    .EXAMPLE
        greet -n "John"
    .NOTES
        This is a note
#>
function greet {
    param($n)

    "Hello $n"
}

New-Spreadsheet

Creates a new spreadsheet from a prompt

Note: This requires the ImportExcel module to be installed

Install-Module -Name ImportExcel

In action:

New-Spreadsheet 'population of india, china, usa, euroupe'

Alt text

Try it out: New-Spreadsheet "list of first 5 US presidents name, term"

Check out the Video

DALL-E

The DALL-E API is a new API from OpenAI that allows you to generate images from text

Use this function to generate an image from text and set it as your desktop background.

Set-DalleImageAsBackground "A picture of a cat"

You can also use the Get-DalleImage function to get the image and it saves to a temp file, ready to use.

Get-DalleImage "A picture of a cat"

More Repositories

1

ImportExcel

PowerShell module to import/export Excel spreadsheets, without Excel
PowerShell
2,215
star
2

Tiny-PowerShell-Projects

Learning PowerShell through test-driven development of games and puzzles
PowerShell
368
star
3

powershell-for-developers

PowerShell examples for the book "PowerShell for Developers"
C#
158
star
4

NameIT

PowerShell module for randomly generating data
PowerShell
131
star
5

PowerShellHumanizer

PowerShell Humanizer wraps Humanizer: meets all your .NET needs for manipulating and displaying strings, enums, dates, times, timespans, numbers and quantities
Jupyter Notebook
120
star
6

vscode-pandoc

Visual Studio Code extension lets you render markdown to pdf, word doc or html with pandoc
TypeScript
120
star
7

powershell-algorithms

Algorithms and data structures implemented in PowerShell with explanations and links to further readings - port of https://github.com/trekhleb/javascript-algorithms
PowerShell
117
star
8

PSharp

Productivity tool that makes PowerShell ISE better
PowerShell
110
star
9

PowerShellNotebook

Let's you automate PowerShell Notebooks with PowerShell at the command line, exports to Excel and more. On the gallery
PowerShell
110
star
10

powershell-notebooks

Get started learning PowerShell with PowerShell notebooks powered by .NET Interactive and VS Code.
PowerShell
92
star
11

InstallModuleFromGitHub

Install PowerShell Modules from GitHub
PowerShell
80
star
12

OutTabulatorView

PowerShell - Sending output to an interactive table in a browser
PowerShell
71
star
13

PSFuzzySearch

PowerShell Fuzzy search applies fuzzy searching to text
PowerShell
58
star
14

PoShLucene

PowerShell WPF GUI over Lucene.NET
PowerShell
52
star
15

PSAI

PowerShell AI module. Brings OpenAI to the console and scripts
PowerShell
51
star
16

PSStringScanner

Provides lexical scanning operations on a String
PowerShell
49
star
17

OneGetGistProvider

Gist-as-a-Package - PackageManagement PowerShell Provider to interop with Github Gists
PowerShell
45
star
18

PowerShellAIAssistant

Enhance PowerShell scripting with AI using PowerShell AI Assistant module.
PowerShell
43
star
19

edge-powershell

Run Powershell in node.js
C#
42
star
20

PSAdvantage

GitHub Actions at your Fingertips! ✨ - via PowerShell
PowerShell
40
star
21

PowerShellJson

Query JSON with PowerShell
PowerShell
38
star
22

Posh-Gist

PowerShell cmdlets for interacting with GitHub Gist
PowerShell
38
star
23

PSKit

A suite of command-line tools for working with PowerShell Arrays. From querying to doing array statistics.
PowerShell
37
star
24

edge-ps

PowerShell compiler for edge.js
JavaScript
37
star
25

IsePester

Module to integrate PowerShell Pester into ISE
PowerShell
34
star
26

PowerShellMicroservice

A PowerShell REST API running as a microservice in a Docker container.
PowerShell
32
star
27

ConvertToClass

PowerShell module to convert JSON or CSV to a PowerShell class definition
PowerShell
30
star
28

ConvertFromMarkdown

From your Markdown to generated chapters, run ScriptAnalyzer on your examples and generate HTML, a Word Doc or PDF. Table of Contents included
PowerShell
29
star
29

PSMatcher

PSMatcher is a test utility, that lets you easily test responses and json, when some part of the response is something out of your control (autogenerated id, guid, datetime etc). (And More)
PowerShell
29
star
30

PSWeave

PSWeave: a PowerShell module bringing OpenAI's GPT to your fingertips, and simplified prompt engineering
PowerShell
28
star
31

awesome-powershell-azure-functions

Curating the Best PowerShell Resources for Azure Functions
27
star
32

PSDataFrame

Use PowerShell to make data exploration easy
PowerShell
26
star
33

ServerlessPowerShell

PowerShell module that let's you rapidly deploy PowerShell scripts as Azure http trigger functions
PowerShell
25
star
34

OneGetGitHubProvider

GitHub-as-a-Package - PackageManagement PowerShell Provider to interop with Github
PowerShell
25
star
35

PowerShellAI-ContentGenerator

A versatile content generator using GPT and PowerShell
PowerShell
24
star
36

powershellScripts

PowerShell Scripts
JavaScript
24
star
37

PowerShellScottPlot

Jupyter Notebook
23
star
38

PSProse

PowerShell module for the Microsoft Program Synthesis SDK https://github.com/Microsoft/prose
PowerShell
23
star
39

dfinke

Use automation to increase bandwidth in order to address technical debt
PowerShell
21
star
40

PowerShellPivot

PowerShell
20
star
41

ODataExplorer

An 'OData Explorer' PowerShell application designed to allow ad-hoc browsing of OData Services
PowerShell
18
star
42

PowerShellCombinations

Using PowerShell Classes & Script to generate and manipulate combinations and permutations
PowerShell
18
star
43

PSPx

PowerShell module that can execute scripts written in markdown that can be accessed either locally or via a URL
PowerShell
17
star
44

PSYamlQuery

PowerShell wrapper for `yq`, enables a better PowerShell pipeline experience
PowerShell
16
star
45

SharePowerShell

Easily share (and get) PowerShell Scripts from ISE or the command line!
PowerShell
15
star
46

PowerShellCheatSheets

15
star
47

PowerShellConsole

Create a PowerShell Console using the AvalonEdit control
C#
14
star
48

PowerShellGemini

PowerShell integration for Google's versatile Gemini Pro API
PowerShell
14
star
49

PSDuckDB

PSDuckDB is a PowerShell module that provides seamless integration with DuckDB, enabling efficient execution of analytical SQL queries directly from the PowerShell environment.
PowerShell
14
star
50

openai-powershell-samples

Jupyter Notebook
13
star
51

SortingAlgorithms

Sorting in PowerShell
PowerShell
12
star
52

PowerShellAI.Functions

PowerShell module bridging PowerShell functions and OpenAI
Jupyter Notebook
12
star
53

PowerShellPhantomJS

PowerShell over PhantomJS, a headless WebKit scriptable with a JavaScript API
PowerShell
12
star
54

WebScraping

PowerShell
11
star
55

PowerShellASTDemo

PowerShell - Showing Tokenization and the Abstract Syntax Tree
PowerShell
11
star
56

PSJsonTerm

PowerShell UI for exploring and querying JSON
PowerShell
10
star
57

PowerShellJsonObject

PowerShell
10
star
58

PowerShellArrayMethods

Use PowerShell's Extended Type System and Ruby language methods
PowerShell
10
star
59

config-ps

Write your .NET configuration files in PowerShell
C#
10
star
60

PowerShellKV

A key value store that allows you to save snippets of text that you can later find and copy to your clipboard
PowerShell
10
star
61

PasteJSONasPowerShell

Converting your JSON objects into PowerShell functions
PowerShell
10
star
62

SimplePSHttpServer

Simple PowerShell Http Server
10
star
63

dfinke.github.io

https://dfinke.github.io/
Ruby
10
star
64

PowerShellExcel-Snippets

Contains the code snippets for PowerShell Excel development in the VS Code editor
PowerShell
10
star
65

GPT-FunctionCalling

Jupyter Notebook
9
star
66

NPMTabCompletion

Enables tab completion for npm commands
PowerShell
9
star
67

PowerShellScaffold

Quickly create a suite of PowerShell functions
PowerShell
8
star
68

PSPulumi

PowerShell module for Pulumi: Program the Cloud
PowerShell
8
star
69

PowerShell_Roslyn_Code_Quoter

PowerShell Roslyn Code Quoter Tool - generating syntax tree API calls that result in a given C# program.
PowerShell
8
star
70

PowerShellSlackathon

Stupid ideas for the PowerShell Slackathon
PowerShell
7
star
71

known-calendar

PowerShell wrapper for nChronic, a natural language date/time parser
PowerShell
7
star
72

PowerShellContextSplit

The Invoke-ContextSplit command copies the specified file and separates the copy into segments.
PowerShell
7
star
73

PSRunFromZip

PowerShell script to deploy Azure Functions from the command line using Run-From-Zip
PowerShell
7
star
74

PowerShellTools

Collection of PowerShell modules and scirpts to make things simpler
PowerShell
7
star
75

PoShDotNet

.NET Core PowerShell wrapper for dotnet
PowerShell
7
star
76

PowerShellAylien

PowerShell Module to interact with AYLIEN Text Analysis API - a package consisting of eight different Natural Language Processing, Information Retrieval and Machine Learning APIs that can be adapted to your processes and applications with relative ease
PowerShell
7
star
77

SpellingCorrector

PowerShell Spelling Corrector
PowerShell
6
star
78

PSSpeak

HTML
6
star
79

PowerShellSequenceUtils

Jupyter Notebook
6
star
80

SlackDSCResource

PowerShell Slack DSC Provider lets you send messages to Slack
PowerShell
6
star
81

PSGitHubCLICrescendo

PowerShell
5
star
82

VSCETabCompletion

Enables tab completion for vsce commands
PowerShell
5
star
83

powershell-azure-function-stockdata

PowerShell Azure Function for displaying stock information
PowerShell
5
star
84

PowerShell_Highlighter

Reads a PowerShell Script, writes it to the screen and color encodes it
5
star
85

PowerShellTranslate

PowerShell Invoke-Translate and New-TranslationTable typically used in substitution ciphers
PowerShell
5
star
86

StartPowerShellDemo

Start PowerShell demo from a Markdown file
PowerShell
5
star
87

PowerShell_Search_Bing

PowerShell function to interact with the new Bing Web Search API on Azure
PowerShell
5
star
88

GetBingPics

PowerShell script for searching and downloading images from the Bing API
PowerShell
5
star
89

HtmlPageFromPowerShellAzureFunction

PowerShell
5
star
90

PSCargoCompletion

PowerShell - Two for one. Auto complete for ruts's 'cargo' command and the script that does the code generation for it
PowerShell
5
star
91

PowerShellISE

A PowerShell module that lists all the ISE shortcut keys
PowerShell
4
star
92

PSGitQL

A PowerShell git query language
PowerShell
4
star
93

PowerShellNancy

PowerShell using the Nancy framework for building HTTP based
PowerShell
4
star
94

vscode-PSStackoverflow

From VS Code Search for selected text + the PowerShell tag on Stack Overflow
TypeScript
4
star
95

BladePS

Implementation of mustache.js for PowerShell
PowerShell
4
star
96

powershell-azure-function-mashup-dad-jokes-cat-pics

Powershell Azure Function Mashup - Dad Jokes and Cat Pics
PowerShell
4
star
97

PowerShell_And_Microsoft_Roslyn

Integrating PowerShell and Roslyn,the next generation of language object models for code generation, analysis, and refactoring
4
star
98

PowerShellShorts

PowerShell
3
star
99

AzureFunctions

PowerShell module for Azure Functions
PowerShell
3
star
100

PSGistIT

Create Github gists of files using one single command, Export-Gist
PowerShell
3
star