{"id":20766,"date":"2025-02-28T12:49:30","date_gmt":"2025-02-28T20:49:30","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/powershell\/?p=20766"},"modified":"2025-03-12T14:14:52","modified_gmt":"2025-03-12T22:14:52","slug":"ai-shell-preview-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/ai-shell-preview-2\/","title":{"rendered":"Announcing AI Shell Preview 2"},"content":{"rendered":"<p><!-- markdownlint-disable MD041 --><\/p>\n<h2>What&#8217;s New in AI Shell Preview 2?<\/h2>\n<p>We&#8217;re excited to announce the <strong>Preview 2 release<\/strong> of <strong>AI Shell<\/strong>! With this update you can expect\nthe following improvements:<\/p>\n<ul>\n<li>Improved support for Azure PowerShell<\/li>\n<li>Broader support for third party OpenAI-compatible models<\/li>\n<li>Refactored code sample for creating an Ollama agent<\/li>\n<li>Improved native command error handling<\/li>\n<li>An easier way to deploy Azure OpenAI instances<\/li>\n<li>Additional bug fixes<\/li>\n<\/ul>\n<p><div class=\"alert alert-info\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>AI Shell Preview 3 is released!<\/strong><\/p>Preview 3 has been released just two weeks after Preview 2 due to a backend issue affecting the Azure Agent. This update addresses the problem, ensuring more reliable interactions with Azure services.<\/div><\/p>\n<h2>Improved support for Azure PowerShell<\/h2>\n<p>The improvements to the <code>azure<\/code> agent are designed to reduce friction when managing Azure resources\nwith the Azure CLI and PowerShell. The agent now offers deeper integration with Azure PowerShell,\nmaking it easier to use AI-created Azure PowerShell scripts.<\/p>\n<ul>\n<li>The <code>\/replace<\/code> command now supports Azure PowerShell. The agent walks you through replacement of\nparameter values in generated Azure PowerShell responses.<\/li>\n<li>The agent now support Azure PowerShell authentication using the <code>Connect-AzAccount<\/code> command.\nPreviously, the agent only supported Azure CLI authentication.<\/li>\n<\/ul>\n<h2>Broader support for third party OpenAI-compatibles models<\/h2>\n<p>With this release, the <code>openai-gpt<\/code> agent extends support to third party models that follow the\nOpenAI API specifications, allowing for a more flexible AI experience. Many of these models are open\nsource tools for running SLMs and LLMs locally. The <code>openai-gpt<\/code> agent nows supports the following\nadditional models:<\/p>\n<ul>\n<li><a href=\"https:\/\/ollama.com\/blog\/openai-compatibility\"><strong>Ollama<\/strong><\/a><\/li>\n<li><a href=\"https:\/\/lmstudio.ai\/docs\/api\/openai-api\"><strong>LM Studio<\/strong><\/a><\/li>\n<li><a href=\"https:\/\/api-docs.deepseek.com\/\"><strong>Deepseek<\/strong><\/a><\/li>\n<li><a href=\"https:\/\/localai.io\/\"><strong>LocalAI<\/strong><\/a><\/li>\n<li><a href=\"https:\/\/ai.google.dev\/gemini-api\/docs\/openai\"><strong>Google Gemini<\/strong><\/a><\/li>\n<li><a href=\"https:\/\/docs.x.ai\/docs\/overview#migrating-from-another-llm-provider\"><strong>Grok<\/strong><\/a><\/li>\n<\/ul>\n<p>To use these models, you only need to configure the <code>endpoint<\/code>, <code>key<\/code> and <code>model name<\/code> in the agent\nconfig file. The following <code>openai.agents.config<\/code> file contains example configurations for two of\nthe new AI providers.<\/p>\n<pre><code class=\"language-json\">{\r\n    \"GPTs\": [\r\n        {\r\n          \"Name\": \"gpt-deepseek\",\r\n          \"Description\": \"A GPT instance using DeepSeek v3.\",\r\n          \"Endpoint\": \"https:\/\/api.deepseek.com\",\r\n          \"ModelName\": \"deepseek-chat\",\r\n          \"Key\": \"&lt;your-deepseek-api-key&gt;\",\r\n          \"SystemPrompt\": \"You are a helpful assistant.\"\r\n        },\r\n\r\n        {\r\n          \"Name\": \"gpt-gemini\",\r\n          \"Description\": \"A GPT instance using Google Gemini.\",\r\n          \"Endpoint\": \"https:\/\/generativelanguage.googleapis.com\/v1beta\/openai\/\",\r\n          \"ModelName\": \"gemini-1.5-flash\",\r\n          \"Key\": \"&lt;your-gemini-api-key&gt;\",\r\n          \"SystemPrompt\": \"You are a helpful assistant.\"\r\n        }\r\n    ]\r\n\r\n    \"Active\": \"gpt-deepseek\"\r\n}<\/code><\/pre>\n<h2>Improved native command error handling<\/h2>\n<p><code>Resolve-Error<\/code> (alias <code>fixit<\/code>) now uses the screen scraper API on Windows to capture the error\noutput of native commands. This allows AI Shell to provide better resolution of error messages that\ncome from native commands rather than from PowerShell.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2025\/02\/native-command-output.png\" alt=\"Resolve Error demo\" \/><\/p>\n<h2>Ollama agent improvements<\/h2>\n<p>We refactored the example code for the agent <code>ollama<\/code>. This example provides the basic structure\nthat you can use to build out your own agent. The refactored code now uses the <strong>OllamaSharp<\/strong>\nlibrary and add the ability to configure the agent using settings files.<\/p>\n<p>The <code>ollama<\/code> agent isn&#8217;t shipped with AI Shell but you can build it yourself. See the instructions\nin the <a href=\"https:\/\/github.com\/PowerShell\/AIShell?tab=readme-ov-file#locally-building-ai-shell\">locally build the repo<\/a> section of the README. Thank you <code>@kborowinski<\/code> on GitHub for\nthis contribution!<\/p>\n<h2>Tools for easy deployment of Azure OpenAI instances<\/h2>\n<p>We added a Bicep template that deploys an Azure OpenAI instance in seconds. Using the template is\nmuch faster than manually creating an instance in the Azure portal. This template includes\ndocumentation with step by step instructions.<\/p>\n<ul>\n<li><a href=\"https:\/\/raw.githubusercontent.com\/PowerShell\/AIShell\/refs\/heads\/main\/docs\/development\/AzureOAIDeployment\/main.bicep\">Bicep template<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/powershell\/utility-modules\/aishell\/developer\/deploy-azure-openai?view=ps-modules\">Documentation<\/a><\/li>\n<\/ul>\n<h2>Additional bug fixes<\/h2>\n<p>There are many bug fixes in this release. For a complete list of changes, see the <a href=\"https:\/\/github.com\/PowerShell\/AIShell\/releases\/tag\/v1.0.0-preview.2\">changelog<\/a>.<\/p>\n<h2>How to get AI Shell Preview 2<\/h2>\n<p>Use the following command in PowerShell 7 to install or upgrade AI Shell:<\/p>\n<pre><code class=\"language-powershell\">Invoke-Expression \"&amp; { $(Invoke-RestMethod 'https:\/\/aka.ms\/install-aishell.ps1') }\"<\/code><\/pre>\n<p>For more information, see <a href=\"https:\/\/learn.microsoft.com\/powershell\/utility-modules\/aishell\/install-aishell\">Install AI Shell<\/a>.<\/p>\n<h2>Automatically start AI Shell<\/h2>\n<p>One piece of feedback we often hear is: <em>How can I have AI Shell automatically start up when I open\nWindows Terminal?<\/em><\/p>\n<p>It&#8217;s easy! Just add <code>Start-AIShell<\/code> to your PowerShell profile script. Here&#8217;s how:<\/p>\n<ol>\n<li>Open your profile in the text editor of your choice.<\/li>\n<li>Add the following code to the end of the file:\n<pre><code class=\"language-powershell\">if ($PSVersionTable.PSVersion -ge ([version]'7.4.6') -and\r\n  (Get-Process -Id $pid).Parent.Name -eq 'WindowsTerminal') {\r\n   Start-AIShell\r\n}<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>Now, AI Shell will automatically start when you open Windows Terminal.<\/p>\n<p><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>NOTE<\/strong><\/p>AI Shell only works with Windows Terminal and requires PowerShell 7.4.6 or higher.<\/div><\/p>\n<p>If you need help creating a profile scripts, see <a href=\"https:\/\/learn.microsoft.com\/powershell\/module\/microsoft.powershell.core\/about\/about_profiles#how-to-create-a-profile\">about_Profiles<\/a>.<\/p>\n<h2>Try it out and share your feedback<\/h2>\n<p>We would love to hear your feedback as we continue improving AI Shell. Join the discussion in our\n<a href=\"https:\/\/github.com\/PowerShell\/AIShell\/issues\">GitHub Issues<\/a> and let us know how AI Shell is helping your automation workflows.<\/p>\n<p>Stay tuned for future updates as we bring more AI-powered capabilities to your CLI experience. \ud83d\ude80<\/p>\n<p>Thanks!<\/p>\n<p>Steven Bucher and Dongbo Wang<\/p>\n<p>AI Shell Team<\/p>\n<p><!-- link references --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are pleased to share a new preview release of AI Shell!<\/p>\n","protected":false},"author":98569,"featured_media":20640,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[3196,3193,3195,3194,248],"class_list":["post-20766","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-ai","tag-ai-shell","tag-azure-openai","tag-copilot-in-azure","tag-powershell"],"acf":[],"blog_post_summary":"<p>We are pleased to share a new preview release of AI Shell!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/20766","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/98569"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=20766"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/20766\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/20640"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=20766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=20766"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=20766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}