{"id":18048106,"url":"https://github.com/startautomating/powershellai","last_synced_at":"2025-04-10T09:49:16.936Z","repository":{"id":80535917,"uuid":"588351115","full_name":"StartAutomating/PowerShellAI","owner":"StartAutomating","description":"PowerShell meets GPT - Artificial Intelligence ","archived":false,"fork":false,"pushed_at":"2023-03-01T21:44:53.000Z","size":933,"stargazers_count":25,"open_issues_count":0,"forks_count":107,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T08:46:07.203Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"dfinke/PowerShellAI","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StartAutomating.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-12T22:59:13.000Z","updated_at":"2025-03-10T04:22:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"9ec6497d-f80a-4432-9d5e-1213d864b373","html_url":"https://github.com/StartAutomating/PowerShellAI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FPowerShellAI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FPowerShellAI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FPowerShellAI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FPowerShellAI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StartAutomating","download_url":"https://codeload.github.com/StartAutomating/PowerShellAI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248197459,"owners_count":21063619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-30T20:11:38.354Z","updated_at":"2025-04-10T09:49:16.916Z","avatar_url":"https://github.com/StartAutomating.png","language":"PowerShell","readme":"# PowerShellAI\n## A User-Friendly Module for OpenAI's GPT-3 and DALL-E API\n\n`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.\n\n`PowerShellAI` is cross-platform and runs seamlessly on Windows, Linux, and MacOS.\n\nGetting started with `PowerShellAI` is easy. Simply install the module from the gallery using the following command: \n\n`Install-Module -Name PowerShellAI`\n\nThe 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. \n\nThe video demos showcase the many possibilities of the module and how you can leverage its functions to best suit your needs.\n\nWhether 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.\n\n\u003cbr/\u003e\n\u003cbr/\u003e\n\n\u003e![](./media/AIReplace.png)\n\n# Unleash the Power of Artificial Intelligence with PowerShell\nWelcome 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.\n\n## Get Ahead of the Game\nBy 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.\n\n## Start Your AI Journey Today\n\n### Installation\n\nIn the PowerShell console:\n\n```powershell\nInstall-Module -Name PowerShellAI\n```\n\nGet/Create your OpenAI API key from [https://beta.openai.com/account/api-keys](https://beta.openai.com/account/api-keys) and then set as *secure string* with `Set-OpenAIKey` or as *plain text* with `$env:OpenAIKey`.\n\n## Examples\nCheck out these PowerShell scripts to see how easy it is to get started with AI in PowerShell:\n\n|PS Script | Description | Location\n|--|--|--|\n| Disable-AIShortCutKey | Disable the \u003ckbd\u003ectrl+g\u003c/kbd\u003e shortcut key go getting completions | [Disable-AIShortCutKey.ps1](./Public/Disable-AIShortCutKey.ps1) |\n| Enable-AIShortCutKey | Enable the \u003ckbd\u003ectrl+g\u003c/kbd\u003e | [Enable-AIShortCutKey.ps1](./Public/Enable-AIShortCutKey.ps1) |\n| Get-OpenAIEdit | Given a prompt and an instruction, the model will return an edited version of the prompt | [Get-OpenAIEdit.ps1](./Public/Get-OpenAIEdit.ps1)\n| Get-GPT3Completion | Get a completion from the OpenAI GPT-3 API | [Get-GPT3Completion.ps1](./Public/Get-GPT3Completion.ps1)\n| Get-DalleImage | Get an image from the OpenAI DALL-E API | [Get-DalleImage.ps1](./Public/Get-DalleImage.ps1)\n| ai | Experimental AI function that you can pipe all sorts of things into and get back a completion | [ai.ps1](./Public/ai.ps1)\n| 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](./Public/copilot.ps1)\n| Get-DalleImage | Get an image from the OpenAI DALL-E API | [Get-DalleImage.ps1](./Public/Get-DalleImage.ps1)\n| Set-DalleImageAsWallpaper | Set the image from the OpenAI DALL-E API as the wallpaper | [Set-DalleImageAsWallpaper.ps1](./Public/Set-DalleImageAsWallpaper.ps1)\n\n\u003cbr/\u003e\n\n## Demos of the PowerShellAI\n\nHere are some vidoes of `PowerShellAI` in action:\n\n| Description | YouTube Video |\n|--|--|\n| Quick Demo of PowerShellAI | \u003ca href=\"https://youtu.be/fpq9TDpaCuU\"\u003e\u003cimg src=\"https://img.youtube.com/vi/fpq9TDpaCuU/0.jpg\" width=\"200\"\u003e |\n| Using PowerShell with OpenAI GPT in the console with a shortcut key | \u003ca href=\"https://youtu.be/Y2fJki6r4mI\"\u003e\u003cimg src=\"https://img.youtube.com/vi/Y2fJki6r4mI/0.jpg\" width=\"200\"\u003e |\n| PowerShell AI - `copilot` at the command line | \u003ca href=\"https://youtu.be/JrNBvEm6E7Q\"\u003e\u003cimg src=\"https://img.youtube.com/vi/JrNBvEm6E7Q/0.jpg\" width=\"200\"\u003e |\n| PowerShell AI - new `ai` function | \u003ca href=\"https://youtu.be/-mlkUVUPZHU\"\u003e\u003cimg src=\"https://img.youtube.com/vi/-mlkUVUPZHU/0.jpg\" width=\"200\"\u003e |\n| New-Spreadsheet script: PowerShell + ChatGPT + Excel | \u003ca href=\"https://youtu.be/Aehsgtll1CA\"\u003e\u003cimg src=\"https://img.youtube.com/vi/Aehsgtll1CA/0.jpg\" width=\"200\"\u003e |\n\n\u003cbr/\u003e\n\u003cbr/\u003e\n\n## What it looks like\n\n\u003e ***Note:*** You can use the `gpt` alias for `Get-GPT3Completion`\n\n```powershell\nGet-GPT3Completion \"list of planets only names as json\"\n\n[\n    \"Mercury\",\n    \"Venus\",\n    \"Earth\",\n    \"Mars\",\n    \"Jupiter\",\n    \"Saturn\",\n    \"Uranus\",\n    \"Neptune\"\n]\n```\n\n### As XML\n\n```powershell\nGet-GPT3Completion \"list of planets only names as xml\"\n\n\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cplanets\u003e\n  \u003cplanet\u003eMercury\u003c/planet\u003e\n  \u003cplanet\u003eVenus\u003c/planet\u003e\n  \u003cplanet\u003eEarth\u003c/planet\u003e\n  \u003cplanet\u003eMars\u003c/planet\u003e\n  \u003cplanet\u003eJupiter\u003c/planet\u003e\n  \u003cplanet\u003eSaturn\u003c/planet\u003e\n  \u003cplanet\u003eUranus\u003c/planet\u003e\n  \u003cplanet\u003eNeptune\u003c/planet\u003e\n\u003c/planets\u003e\n```\n\n### As Markdown\n\n```powershell\n\n Get-GPT3Completion \"first 5 US presidents and terms as markdown table\"\n\n\n| President | Term |\n|----------|------|\n| George Washington | 1789-1797 |\n| John Adams | 1797-1801 |\n| Thomas Jefferson | 1801-1809 |\n| James Madison | 1809-1817 |\n| James Monroe | 1817-1825 |\n```\n\nCopy and pasted into this README.md:\n\n| President | Term |\n|----------|------|\n| George Washington | 1789-1797 |\n| John Adams | 1797-1801 |\n| Thomas Jefferson | 1801-1809 |\n| James Madison | 1809-1817 |\n| James Monroe | 1817-1825 |\n\n\n## `ai` function\n\nThe `ai` function calls that allows `piping` and `prompting` text. This is useful for chaining commands together.\n\n```powershell\nai \"list of planets only names as json\"\n```\n\n```json\n[\n    \"Mercury\",\n    \"Venus\",\n    \"Earth\",\n    \"Mars\",\n    \"Jupiter\",\n    \"Saturn\",\n    \"Uranus\",\n    \"Neptune\"\n]\n```\n\n\n```powershell\nai \"list of planets only names as json\" | ai 'convert to  xml'\n```\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cPlanets\u003e\n    \u003cPlanet\u003eMercury\u003c/Planet\u003e\n    \u003cPlanet\u003eVenus\u003c/Planet\u003e\n    \u003cPlanet\u003eEarth\u003c/Planet\u003e\n    \u003cPlanet\u003eMars\u003c/Planet\u003e\n    \u003cPlanet\u003eJupiter\u003c/Planet\u003e\n    \u003cPlanet\u003eSaturn\u003c/Planet\u003e\n    \u003cPlanet\u003eUranus\u003c/Planet\u003e\n    \u003cPlanet\u003eNeptune\u003c/Planet\u003e\n\u003c/Planets\u003e\n```\n\n```powershell\nai \"list of planets only names as json\" | ai 'convert to  xml' | ai 'convert to  powershell'\n```\n\n```powershell\n[xml]$xml = @\"\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cPlanets\u003e\n    \u003cPlanet\u003eMercury\u003c/Planet\u003e\n    \u003cPlanet\u003eVenus\u003c/Planet\u003e\n    \u003cPlanet\u003eEarth\u003c/Planet\u003e\n    \u003cPlanet\u003eMars\u003c/Planet\u003e\n    \u003cPlanet\u003eJupiter\u003c/Planet\u003e\n    \u003cPlanet\u003eSaturn\u003c/Planet\u003e\n    \u003cPlanet\u003eUranus\u003c/Planet\u003e\n    \u003cPlanet\u003eNeptune\u003c/Planet\u003e\n\u003c/Planets\u003e\n\"@\n\n$xml.Planets.Planet\n```\n\n## Use `ai` with `git`\n\nPipe the output of `git status` to `ai` to create a commit message.\n\n```powershell\ngit status | ai \"create a detailed git message\"\n```\n\n```\nCommit message:\nAdded 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.\n```\n\n# Copilot at the PowerShell Console\n\nThank you to [Clem Messerli](https://twitter.com/ClemMesserli/status/1616312238209376260?s=20\u0026t=KknO2iPk3yrQ7x42ZayS7g) for posting a great prompt to show `copilot` in action.\n\n![Alt text](media/Copilot-GPT-At-The-CLI.png)\n\nCheck out the [video of `copilot` in action]()\n\n# Code editing example\n\nUnlike 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.\n\n- Here you're passing in the string that is a PowerShell function.\n- The `instruction` is to `add a comment-based help detailed description`\n\n```powershell\nGet-OpenAIEdit @'\nfunction greet {\n    param($n)\n\n    \"Hello $n\"\n}\n'@ -Instruction 'add comment-based help detailed description'\n```\n\nThe GPT AI returns:\n\n```powershell\n\u003c#\n    .SYNOPSIS\n        Greet someone\n    .DESCRIPTION\n        This function greets someone\n    .PARAMETER n\n        The name of the person to greet\n    .EXAMPLE\n        greet -n \"John\"\n    .NOTES\n        This is a note\n#\u003e\nfunction greet {\n    param($n)\n\n    \"Hello $n\"\n}\n```\n\n# New-Spreadsheet\n\nCreates a new spreadsheet from a prompt\n\n*Note*: This requires the ImportExcel module to be installed\n\n```powershell\nInstall-Module -Name ImportExcel\n```\n\nIn action:\n\n```powershell\nNew-Spreadsheet 'population of india, china, usa, euroupe'\n```\n\n![Alt text](media/NewSpreadsheet.png)\n\nTry it out: `New-Spreadsheet \"list of first 5 US presidents name, term\"`\n\n## Check out the Video\n\n\u003ca href=\"https://youtu.be/Aehsgtll1CA\"\u003e\u003cimg src=\"https://img.youtube.com/vi/Aehsgtll1CA/0.jpg\" width=\"200\"\u003e\n\n# DALL-E\n\nThe [DALL-E](https://openai.com/blog/dall-e/) API is a new API from OpenAI that allows you to generate images from text. The API is currently in beta and is free to use.\n\nUse this function to generate an image from text and set it as your desktop background.\n\n```powershell\nSet-DalleImageAsBackground \"A picture of a cat\"\n```\n\nYou can also use the `Get-DalleImage` function to get the image and it saves to a temp file, ready to use.\n\n```powershell\nGet-DalleImage \"A picture of a cat\"\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstartautomating%2Fpowershellai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstartautomating%2Fpowershellai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstartautomating%2Fpowershellai/lists"}