Hands on: Microsoft just added ChatGPT AI to Windows Terminal on Windows 11
AI Comes to Windows Terminal: Revolutionizing Developer Productivity with ChatGPT and GitHub Copilot Integration
AI is everywhere. Microsoft meant it when it said it was bringing AI to all of its apps and services to make people more productive. I just reported about a new Copilot UI in Microsoft Word, and now there’s another app, “Windows Terminal,” getting full-fledged ChatGPT and Github Copilot integration. It’s now available on Windows 11 and Windows 10.
Microsoft first teased the “AI Chat” integration in Windows Terminal in September, and it seems to have shipped in a new update for Windows Terminal (Canary) on October 29. I tried it out today, and it works as expected. You can chat within the Windows Terminal and ask for commands when you’re clueless or when you’re trying to fix bugs.
I will go through many examples and use cases with AI in ChatGPT, but before that, let's talk about the integration. First off, it's not free. You will have to come up with your API key. It might be your GitHub Copilot API, Azure's OpenAI API, or even OpenAI's API.
As soon as you connect terminal chat to an AI service, upon entering a question into the window of Terminal Chat, your request gets sent to the AI and that's the query being processed, giving a suggestion right away. According to Microsoft, it does not retain chat history, and integration is specifically engineered to work with all of its shells, such as
Command Prompt
PowerShell
WSL Ubuntu
Azure Cloud Shell
and more.
In case you want to establish AI in Windows Terminal, use the following steps that I tried on my device:
Open Settings in Windows Terminal.
Click on the Terminal Chat (Experimental) tab.
Choose an AI Service Provider: Github Copilot, OpenAI by Azure and OpenAI.
Once the AI provider is selected add the API key.
Later, Terminal Chat allows interaction with the favourite AI model right within the terminal. Open up a regular tab in the Terminal and tap "Terminal Chat."
Hands-on with AI inside Windows Terminal
I am using the ChatGPI API directly from OpenAI because it does not require me to set up the endpoint in the Terminal. You will have to add an AI endpoint in Terminal when you are using Azure API, but that is not the case when you connect a Github Copilot subscription to Windows Terminal or when you are getting the API directly from OpenAI.
Added the ChatGPT API key into Terminal, and opened up a new tab where it picked "Terminal Chat." When this is opened, there is a window with a chatbox and a delete history button, as an export button.
It is sort of like the default interface for ChatGPT, but compact enough to fit into a Windows Terminal environment.
Windows Latest reports that Terminal AI is context-aware, and it knows whether you've opened it from within a PowerShell terminal. This will be reflected at the top left corner in the form of the name and icon of the main shell within the Terminal. For example, if you open a new tab of Command Prompt, Terminal AI will remember that.
I believe this helps with prompt engineering because Microsoft has set up various system prompts for every shell.
In my experiments, for some questions, I used to play around with Terminal AI. Start with the most simple one. As an example, I asked Terminal AI "How do I create a folder?" in PowerShell. Terminal Chat responded back with a suggestion New-Item -ItemType Directory, which actually is the correct one.
The copy button was provided with this suggestion so I could put it straight into the Shell.
This implies that in a Linux environment, such as WSL, mkdir was demonstrated. Why? It's context-aware. It knew I wasn't trying to write that command to Windows but within WSL.
I even tried asking the same query through an Azure shell. Terminal AI immediately came across as something that sensed what it did in switching a PowerShell over an Azure.
Through Context, It is aware of my deed as it would relate with the Shell in previous actions;
There are no set barriers in how one will deploy Terminal AI in applications but will work just so far as it might deal with the terminal and Shell of its application.
This thing I shared above, is how to do an action such as creating a folder you can ask it and the right command will be offered for your shell whether you have PowerShell or Linux. Translation of commands between systems with this showing ls in Linux is Get-ChildItem in PowerShell.
If it is incorrect, you can copy and paste it into Terminal Chat, which will explain what went wrong and how to fix it.
It is also good for getting quick code snippets for text editors like Nano or Vim. For PowerShell users, it can explain cmdlets like Get-Process.
Once one clicks on the suggestion, AI puts forth code that is then copied into the terminal; however, it doesn't run.
Terminal AI doesn't retain any data once you are out of the session, but it will give you the choice to download the conversation in a .txt file. Plus, you can empty out the chat before closing out of the Terminal shell.
It does not come with a native UI yet to emphasize the history, and I don't think it's coming any time soon.
The new experimental AI feature is only available in Windows Terminal (Canary) and can be downloaded from GitHub.
Like it? Let us know in the comments below.