dfinke / PSAI

PowerShell AI module. Brings OpenAI to the console and scripts
MIT License
80 stars 9 forks source link

New-OAIThread is not recognized as a cmdlet #16

Closed Rorymon closed 2 months ago

Rorymon commented 3 months ago

'New-OAIThread' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Rorymon commented 3 months ago

Apologies, I should have added that I received this when trying the example cmdlet in the documentation. This is on a Windows 10 machine that did have the PowerShellAI Module previously. It appears that the new module did install and I see the New-OAIThread.ps1 file but the call to New-OAIThread results in the above error. The cmdlet also does not appear to be found in a regular PowerShell window.

dfinke commented 3 months ago

Thanks for trying this out. The PowerShellAI module has been replaced by this new one PSAI which is more advanced version.

Please:

  1. Uninstall-Module PowerShellAI
  2. Install-Module PSAI
Rorymon commented 3 months ago

Unfortunately, it appears to still fail after explicitly uninstalling and installing the new module. I also tried on a VM that never had PowerShellAI installed.

As you can see, it appears the script for New-OAIThread does exist but Invoke-OAIChat, ai or some of the other cmdlets fail.

AIError

cmdlets and error:

PS C:\Windows\system32> $env:OpenAIKey = '<APIKeyRemovedtoProtectit>'
PS C:\Windows\system32> ai "What is TechSmith Camtasia in 30 words or less."
New-OAIThread : The term 'New-OAIThread' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\PSAI\0.2.1\Public\New-OAIThreadQuery.ps1:33 char:15
+     $thread = New-OAIThread
+               ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (New-OAIThread:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Unknown parameter: 'content'.
At C:\Program Files\WindowsPowerShell\Modules\PSAI\0.2.1\Private\Invoke-OAIBeta.ps1:137 char:9
+         throw $targetError
+         ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Unknown parameter: 'content'.:String) [], RuntimeException
    + FullyQualifiedErrorId : Unknown parameter: 'content'.
dfinke commented 3 months ago

Bummer, works for me

PS C:\> ai "What is TechSmith Camtasia in 30 words or less."
TechSmith Camtasia is a software suite for creating video tutorials and presentations via screencast or direct recording. It offers video editing, audio enhancement, and interactive elements to enhance multimedia content.

Try

Uninstall-Module PSAI
Uninstall-Module PowerShellAI.Functions

Install-Module PSAI

I think you installed a later PowerShellAI when I started expanding it to do Function Calling.

If that doesn't work, happy to get on a zoom and walk thru to see the issue.

Rorymon commented 3 months ago

Issue still persists. If you have the time for a Zoom call that would be awesome, I can snapshot the VM and park it for now. If you are off this week for the holiday, no sweat.

dfinke commented 3 months ago

@Rorymon send me an email finked hotmail. I have some time Friday between 2 and 3.

adenyes commented 1 month ago

I had this same issue. I see that the problem was that this module was written for PowerShell 7+, but I was misled by the listing on powershellgallery, which claims minimum version is 5.1 https://www.powershellgallery.com/packages/PSAI/0.2.7

dfinke commented 1 month ago

@adenyes sorry for the confusion. Next release will update the PowerShell Gallery that minimum version is 7+.