/PSCopilot

Primary LanguageC#MIT LicenseMIT

Welcome to the AI Shell repository

AI Shell is our latest CLI tool that provides an interactive shell session to chat with large language models. Users can use agents to interact with different AI models, or other assistance providers, in a conversational manner. AI Shell also provides a framework for creating AI agents.

This project is currently in an alpha state. Expect many significant changes to the code as we experiment and refine the user experiences of this tool. We appreciate your feedback and patience as we continue our development.

GIF showing demo of AI Shell

Installing AI Shell

Some prerequisites for building AI Shell

  • Build script requires PowerShell v7.2 or newer versions
  • PowerShell v7.4 is recommended
  • .NET SDK 8 is required to build the project

Here are the steps to install and use AI Shell.

  1. Clone this repository, git clone https://github.com/PowerShell/ProjectMercury
  2. Run ./build.ps1 in the repository's root directory to build the project
  3. After the build is complete, you can find the produced executable aish in the out\debug\app folder within the repository's root directory. You can add the location to the PATH environment variable for easy access. The full path is copied to your clipboard after successful build.

AI Agents

AI Shell provides a framework for creating and registering multiple AI Agents. The agents are libraries that you use to interact with different AI models or assistance providers. Currently, these are the supported agents:

Agent README files:

When you run aish, you are prompted to choose an agent. For more details about each agent, see the README in the each agent folder.

How to use AI Shell

To start a chat session with the LLM, run aish, which starts a new session in your current window. Choose the agent you would like to use. Once you select an agent you can begin your conversation.

We suggest using a split pane approach with the terminal of choice. In Windows Terminal, use the following command to start aish in a new split pane:

wt -w 0 sp aish

You can bind this command to a key like F3 in your PowerShell session. Add the following code to your $PROFILE script:

$PSReadLineSplat = @{
    Chord = 'F3'
    ScriptBlock = {
        wt -w 0 sp --tabColor '#345beb'--size 0.4 -p $env:WT_PROFILE_ID --title 'AIShell' <full-path-to-aish.exe>
    }
}
Set-PSReadLineKeyHandler @PSReadLineSplat

/ commands

By default, aish provides a base set of chat / commands used to interact with the responses from the AI model. To get a list of commands, use the /help command in the chat session.

  Name       Description
────────────────────────────────────────────────────────────
  /agent     Command for agent management.
  /cls       Clear the screen.
  /code      Command to interact with the code generated.
  /dislike   Dislike the last response and send feedback.
  /exit      Exit the interactive session.
  /help      Show all available commands.
  /like      Like the last response and send feedback.
  /refresh   Refresh the chat session.
  /retry     Regenerate a new response for the last query.

Also, agents can implement their own commands. Some commands, such as /like and /dislike, are commands that sends feedback to the agents. It is up to the agents to consume the feedback.

Agent development

To learn more about how to create an agent for yourself please see, Creating an Agent.

Contributing to the project

Please see CONTRIBUTING.md for more details.

Support

For support, see our Support statement.

Code of Conduct

The project follows the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ.

Feedback

We're still in development and value your feedback! Please file issues in this repository for bugs, suggestions, or feedback.