The aitoolkit PowerShell module provides a command-line interface for interacting with local AI models through Microsoft's AI Toolkit for Visual Studio Code.
The AI Toolkit for Visual Studio Code is an extension that facilitates working with AI models locally. Key features include:
- Browsing and downloading models from catalogs like Azure AI Studio and Hugging Face
- Local model inference
- Model fine-tuning capabilities
Under the hood, the AI Toolkit uses the Kestrel web server to provide a local API endpoint, which this PowerShell module interacts with.
This PowerShell module wraps functionality provided by the AI Toolkit for Visual Studio Code, allowing users to:
- Start and stop the AI Toolkit server
- Load and unload AI models
- Interact with loaded models for text generation
- Manage model configurations
It's designed to make AI model interactions accessible to PowerShell users, whether for experimentation, learning, or integration into existing PowerShell workflows.
- Install the AI Toolkit for Visual Studio Code extension
- Install this PowerShell module:
Install-Module -Name aitoolkit
- Start the AI Toolkit server:
Start-AITServer
- Load a model:
Mount-AITModel -Model "model-name"
- Generate text:
Request-AITChatCompletion -Message "Your prompt here"
In the context of this module, "loading" a model means bringing it into memory for use, while "unloading" removes it from memory. This allows for efficient resource management, especially when working with multiple large models.
The AI Toolkit provides a local REST API that follows the OpenAI chat completions format. This PowerShell module abstracts interactions with this API, making it easier to use from the command line or in scripts.
Dismount-AITModel
: Unloads a specified modelGet-AITModel
: Lists available modelsGet-AITMountedModel
: Shows currently loaded modelsGet-AITServer
: Retrieves information about the AI Toolkit server processesMount-AITModel
: Loads a specified modelRequest-AITChatCompletion
: Generates text using the loaded modelSet-AITConfig
: Configures settings for the aitoolkit moduleStart-AITServer
: Initiates the AI Toolkit serverStop-AITServer
: Stops the AI Toolkit serverTest-AITServerStatus
: Checks the status of the AI Toolkit server
- Create commands to explore and download models from catalogs