|
| 1 | +# Getting Started with AIShell |
| 2 | + |
| 3 | +AIShell was created to help command line users find the right commands to use, recover from errors, |
| 4 | +and better understand the commands and the output they produce. Follow along and walk through some |
| 5 | +examples to get started with AIShell. |
| 6 | + |
| 7 | +## What is AIShell? |
| 8 | + |
| 9 | +AIShell is a command line interface (CLI) tool that allows you to interact with different AI |
| 10 | +assistants within your CLI. You can choose which agent to use when you start AIShell. And you can |
| 11 | +switch between them when you're using AIShell. |
| 12 | + |
| 13 | +Each AI assistant is known as an agent. In this version of AIShell, we include two agents, one |
| 14 | +talking to an **Azure OpenAI** instance of **gpt-4o** and an Azure agent that can assist with Azure |
| 15 | +CLI commands. During this initial development period, we provide you with access to Azure OpenAI. |
| 16 | +When AIShell formally releases, you must provide your own Azure OpenAI deployment and update |
| 17 | +the configuration to use your instance. |
| 18 | + |
| 19 | +The AIShell executable (`aish.exe`) can be run in your command shell for a full-screen experience. |
| 20 | +If you're using Windows Terminal and PowerShell 7, you can use the **AIShell** PowerShell module to |
| 21 | +create a split-screen or sidecar experience. This is the recommended way to use AIShell because |
| 22 | +you get deeper integration with the shell. These features include: |
| 23 | + |
| 24 | +- Inserting code from the sidecar response directly into the working shell |
| 25 | +- Multi-step commands are put into the Predictive IntelliSense buffer for quick acceptance |
| 26 | +- Easy, single-command error recovery |
| 27 | + |
| 28 | +## Starting AIShell |
| 29 | + |
| 30 | +Use the `Start-AIShell` command in the **AIShell** module to open a split pane experience in Windows |
| 31 | +Terminal. When AIShell starts, it prompts you to choose an agent. |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +## Using AIShell |
| 36 | + |
| 37 | +Now that you have selected an agent, you can begin chatting with it. The installed Azure OpenAI |
| 38 | +agent is configured to be a PowerShell expert. This means we've modified the system prompt |
| 39 | +to say it should act like a PowerShell expert. It's not trained on any specific PowerShell code or |
| 40 | +documentation. In the final version, you must configure the agent with your endpoint, API keys, |
| 41 | +and system prompt before using it. For this walkthrough, we've performed these steps for you. |
| 42 | + |
| 43 | +The Azure agent is designed to bring the Copilot in Azure experience directly to your command line. It |
| 44 | +provides assistance for Azure CLI and Azure PowerShell commands. Typically, you need to sign into |
| 45 | +Azure using the `az login` or `Connect-AzAccount` commands. However, for this walkthrough, we've done |
| 46 | +that for you. |
| 47 | + |
| 48 | +## Use AIShell to interact with the agents |
| 49 | + |
| 50 | +Use these sample queries with each agent. |
| 51 | + |
| 52 | +Azure OpenAI Agent |
| 53 | + |
| 54 | +- "How do I create a text file named helloworld in PowerShell?" |
| 55 | +- "What is the difference between a switch and a parameter in PowerShell?" |
| 56 | +- How do I get the top 10 most CPU intensive processes on my computer? |
| 57 | + |
| 58 | +Azure Agent |
| 59 | + |
| 60 | +- "How do I create a new resource group with Azure CLI?" |
| 61 | +- "How can I list out the storage accounts I have in Azure PowerShell?" |
| 62 | +- "What is Application Insights?" |
| 63 | +- "How to create a web app with Azure CLI?" |
| 64 | + |
| 65 | +Here's a quick demo showing the Azure Agent in action: |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +### Switching Agents |
| 70 | + |
| 71 | +You can switch between agents using the `@<agentName>` syntax in your chat messages. For example, |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +You can also use a chat command to switch agents. For example, to switch to the `openai-gpt` agent, |
| 76 | +use `/agent use openai-gpt`. |
| 77 | + |
| 78 | +### Chat commands |
| 79 | + |
| 80 | +By default, `aish` provides a base set of chat commands used to interact with the AI model. To get a |
| 81 | +list of commands, use the `/help` command in the chat session. |
| 82 | + |
| 83 | +``` |
| 84 | + Name Description Source |
| 85 | +────────────────────────────────────────────────────────────────────── |
| 86 | + /agent Command for agent management. Core |
| 87 | + /cls Clear the screen. Core |
| 88 | + /code Command to interact with the code generated. Core |
| 89 | + /dislike Dislike the last response and send feedback. Core |
| 90 | + /exit Exit the interactive session. Core |
| 91 | + /help Show all available commands. Core |
| 92 | + /like Like the last response and send feedback. Core |
| 93 | + /refresh Refresh the chat session. Core |
| 94 | + /render Render a markdown file, for diagnosis purpose. Core |
| 95 | + /retry Regenerate a new response for the last query. Core |
| 96 | +``` |
| 97 | + |
| 98 | +### Inserting code |
| 99 | + |
| 100 | +When chatting with the agent, you can use the `/code post` command to automatically insert |
| 101 | +the code from the response into the working shell. This is the simplest way to quickly get the code |
| 102 | +you need to run in your shell. You can also use the hot key <kbd>Ctrl</kbd>+<kbd>d</kbd>, |
| 103 | +<kbd>Ctrl</kbd>+<kbd>d</kbd> to insert the code into the working shell. |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +### Key bindings for commands |
| 109 | + |
| 110 | +AIShell has key bindings for the `/code` command. They key bindings are currently hard-coded, but |
| 111 | +custom key bindings will be supported in future releases. |
| 112 | + |
| 113 | +| Key bindings | Command | Functionality | |
| 114 | +| -------------------------------------------------------- | ---------------- | ------------------------------------------------------------------- | |
| 115 | +| <kbd>Ctrl+d</kbd><kbd>Ctrl</kbd>+<kbd>c</kbd> | `/code copy` | Copy _all_ the generated code snippets to clipboard | |
| 116 | +| <kbd>Ctrl</kbd>+<kbd>\<n\></kbd> | `/code copy <n>` | Copy the _n-th_ generated code snippet to clipboard | |
| 117 | +| <kbd>Ctrl</kbd>+<kbd>d</kbd><kbd>Ctrl</kbd>+<kbd>d</kbd> | `/code post` | Post _all_ the generated code snippets to the connected application | |
| 118 | +| <kbd>Ctrl</kbd>+<kbd>d</kbd><kbd>\<n\></kbd> | `/code post <n>` | Post the _n-th_ generated code snippet to the connected application | |
| 119 | + |
| 120 | +### Resolving Errors |
| 121 | + |
| 122 | +If you encounter an error in your working terminal, you can use the `Resolve-Error` cmdlet to send |
| 123 | +that error to the open AIShell window for resolution. This command asks the AI model to help you |
| 124 | +resolve the error. |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | +### Invoking AIShell |
| 129 | + |
| 130 | +You can use the `Invoke-AIShell` cmdlet to send queries to the current agent in the open AIShell window. |
| 131 | +This command allows you to interact with the AI model from your working terminal. |
| 132 | + |
| 133 | + |
| 134 | + |
0 commit comments