File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,19 @@ function Get-FunctionJson {
1717
1818 # generate a json object based on the help content of the function
1919 $help = Get-Help $functionName
20+
21+ # if the help doesn't include description, return null
22+ if (-not $help.description ) {
23+ Write-Warning " Function $functionName does not have a description."
24+ return $null
25+ }
26+
27+ # if any parameters don't include description, return null
28+ if ($help.parameters.parameter | Where-Object { -not $_.description }) {
29+ Write-Warning " Function $functionName has parameters without description."
30+ return $null
31+ }
32+
2033 $json = [pscustomobject ]@ {
2134 type = " function"
2235 function = @ {
Original file line number Diff line number Diff line change @@ -296,9 +296,8 @@ function New-ChatGPTConversation {
296296 if ($functions ) {
297297 $tools = @ (Get-PredefinedFunctions - names $functions )
298298
299- Write-Verbose ($tools | ConvertTo-Json - Depth 10 )
300-
301299 if ($tools.Count -gt 0 ) {
300+ Write-Verbose ($tools | ConvertTo-Json - Depth 10 )
302301 if ($null -eq $config ) {
303302 $config = @ {}
304303 }
You can’t perform that action at this time.
0 commit comments