|
2 | 2 | Part of PowerShell module : GenXdev.Queries.AI |
3 | 3 | Original cmdlet filename : Open-CloudLLMChat.ps1 |
4 | 4 | Original author : René Vaessen / GenXdev |
5 | | -Version : 1.276.2025 |
| 5 | +Version : 1.278.2025 |
6 | 6 | ################################################################################ |
7 | 7 | MIT License |
8 | 8 |
|
@@ -203,7 +203,8 @@ function Open-CloudLLMChat { |
203 | 203 | 'DeepSearch', |
204 | 204 | 'GithubCopilot', |
205 | 205 | 'GoogleGemini', |
206 | | - 'XGrok' |
| 206 | + 'XGrok', |
| 207 | + 'All' |
207 | 208 | )] |
208 | 209 | [parameter( |
209 | 210 | Mandatory = $false, |
@@ -652,64 +653,77 @@ function Open-CloudLLMChat { |
652 | 653 | } |
653 | 654 | } |
654 | 655 |
|
655 | | - # access the dynamic parameter endpoint value |
656 | | - $endpointValue = $Endpoint |
657 | | - |
658 | | - # ensure queries parameter is in bound parameters |
659 | | - if (-not $PSBoundParameters.ContainsKey('Queries')) { |
660 | | - |
661 | | - $null = $PSBoundParameters.Add('Queries', $Queries) |
662 | | - } |
| 656 | + $endPoints = @( |
| 657 | + 'BingCopilot', |
| 658 | + 'ChatGPT', |
| 659 | + 'DeepSearch', |
| 660 | + 'GithubCopilot', |
| 661 | + 'GoogleGemini', |
| 662 | + 'XGrok' |
| 663 | + ) |
663 | 664 |
|
664 | | - # ensure query parameter is in bound parameters |
665 | | - if (-not $PSBoundParameters.ContainsKey('Query')) { |
| 665 | + if ($EndPoint -ne 'All') { |
666 | 666 |
|
667 | | - $null = $PSBoundParameters.Add('Query', $null) |
| 667 | + $endPoints = @($EndPoint) |
668 | 668 | } |
669 | | - |
670 | | - # get the command object for the specified endpoint |
671 | | - $command = Microsoft.PowerShell.Core\Get-Command ` |
672 | | - -Name "GenXdev.Queries\Open-$($endpointValue)Query" ` |
673 | | - -ErrorAction SilentlyContinue |
674 | | - |
675 | | - # output verbose information about the selected endpoint |
676 | | - Microsoft.PowerShell.Utility\Write-Verbose ` |
677 | | - "Using endpoint: $endpointValue" |
678 | 669 | } |
679 | 670 |
|
680 | 671 | process { |
681 | 672 |
|
682 | 673 | # process each query provided by the user |
683 | 674 | foreach ($query in $Queries) { |
| 675 | + foreach ($endpointValue in $endPoints) { |
684 | 676 |
|
685 | | - # update bound parameters with current query |
686 | | - $PSBoundParameters['Queries'] = @($query) |
687 | | - $PSBoundParameters['Query'] = $query |
688 | | - |
689 | | - # copy identical parameters to the endpoint-specific function |
690 | | - $invocationArguments = GenXdev.Helpers\Copy-IdenticalParamValues ` |
691 | | - -BoundParameters $PSBoundParameters ` |
692 | | - -FunctionName "GenXdev.Queries\Open-$($endpointValue)Query" ` |
693 | | - -DefaultValues ( |
694 | | - Microsoft.PowerShell.Utility\Get-Variable ` |
695 | | - -Scope Local ` |
696 | | - -ErrorAction SilentlyContinue |
697 | | - ) |
| 677 | + # ensure queries parameter is in bound parameters |
| 678 | + if (-not $PSBoundParameters.ContainsKey('Queries')) { |
698 | 679 |
|
699 | | - # verify that the endpoint command exists |
700 | | - if ($null -eq $command) { |
| 680 | + $null = $PSBoundParameters.Add('Queries', $Queries) |
| 681 | + } |
701 | 682 |
|
702 | | - Microsoft.PowerShell.Utility\Write-Error ` |
703 | | - 'The endpoint could not be found' |
704 | | - } |
| 683 | + # ensure query parameter is in bound parameters |
| 684 | + if (-not $PSBoundParameters.ContainsKey('Query')) { |
705 | 685 |
|
706 | | - # output verbose information about the query being processed |
707 | | - Microsoft.PowerShell.Utility\Write-Verbose ` |
708 | | - "Processing query: $query" |
| 686 | + $null = $PSBoundParameters.Add('Query', $null) |
| 687 | + } |
709 | 688 |
|
710 | | - # invoke the endpoint-specific function with the arguments |
711 | | - & $command @invocationArguments |
712 | | - } |
| 689 | + # get the command object for the specified endpoint |
| 690 | + $command = Microsoft.PowerShell.Core\Get-Command ` |
| 691 | + -Name "GenXdev.Queries\Open-$($endpointValue)Query" ` |
| 692 | + -ErrorAction SilentlyContinue |
| 693 | + |
| 694 | + # output verbose information about the selected endpoint |
| 695 | + Microsoft.PowerShell.Utility\Write-Verbose ` |
| 696 | + "Using endpoint: $endpointValue" |
| 697 | + |
| 698 | + # update bound parameters with current query |
| 699 | + $PSBoundParameters['Queries'] = @($query) |
| 700 | + $PSBoundParameters['Query'] = $query |
| 701 | + |
| 702 | + # copy identical parameters to the endpoint-specific function |
| 703 | + $invocationArguments = GenXdev.Helpers\Copy-IdenticalParamValues ` |
| 704 | + -BoundParameters $PSBoundParameters ` |
| 705 | + -FunctionName "GenXdev.Queries\Open-$($endpointValue)Query" ` |
| 706 | + -DefaultValues ( |
| 707 | + Microsoft.PowerShell.Utility\Get-Variable ` |
| 708 | + -Scope Local ` |
| 709 | + -ErrorAction SilentlyContinue |
| 710 | + ) |
| 711 | + |
| 712 | + # verify that the endpoint command exists |
| 713 | + if ($null -eq $command) { |
| 714 | + |
| 715 | + Microsoft.PowerShell.Utility\Write-Error ` |
| 716 | + 'The endpoint could not be found' |
| 717 | + } |
| 718 | + |
| 719 | + # output verbose information about the query being processed |
| 720 | + Microsoft.PowerShell.Utility\Write-Verbose ` |
| 721 | + "Processing query: $query" |
| 722 | + |
| 723 | + # invoke the endpoint-specific function with the arguments |
| 724 | + & $command @invocationArguments |
| 725 | + } |
| 726 | + } |
713 | 727 | } |
714 | 728 |
|
715 | 729 | end { |
|
0 commit comments