You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Microsoft.PowerShell.Utility\Write-Verbose"Tool '$($toolCall.function.name)' output was trimmed from $originalLength to $MaxToolcallBackLength characters"
# Handle output trimming with proper length validation
1663
+
if ($maxContentLength-le0) {
1664
+
Microsoft.PowerShell.Utility\Write-Warning"MaxToolcallBackLength ($MaxToolcallBackLength) is too small for trim message ($($trimMessage.Length) chars)"
Microsoft.PowerShell.Utility\Write-Verbose"Tool '$($toolCall.function.name)' output was trimmed from $originalLength to $($outputText.Length) characters"
1643
1670
}
1644
1671
1645
1672
# Add tool response to history
@@ -1684,8 +1711,15 @@ function Invoke-LLMQuery {
1684
1711
$originalLength=$parsedOutput.Length
1685
1712
$trimMessage="TRIMMED JSON OUTPUT (check parameter use!) incomplete json data, AI Agent: don't retry same function without checking parameters! >>"
Microsoft.PowerShell.Utility\Write-Verbose"Tool '$($toolCall.function.name)' JSON output was trimmed from $originalLength to $MaxToolcallBackLength characters (even at minimum depth 2)"
Microsoft.PowerShell.Utility\Write-Warning"MaxToolcallBackLength ($MaxToolcallBackLength) is too small for JSON trim message ($($trimMessage.Length) chars)"
Microsoft.PowerShell.Utility\Write-Verbose"Tool '$($toolCall.function.name)' JSON output was trimmed from $originalLength to $($content.Length) characters (even at minimum depth 2)"
1689
1723
}
1690
1724
} catch {
1691
1725
# If JSON conversion fails, fall back to text with trimming
@@ -1694,8 +1728,15 @@ function Invoke-LLMQuery {
1694
1728
$originalLength=$outputText.Length
1695
1729
$trimMessage="TRIMMED OUTPUT (check parameter use!) invalid json on purpose, AI Agent: don't retry same function without check parameters! >>"
Microsoft.PowerShell.Utility\Write-Verbose"Tool '$($toolCall.function.name)' fallback output was trimmed from $originalLength to $MaxToolcallBackLength characters"
Microsoft.PowerShell.Utility\Write-Warning"MaxToolcallBackLength ($MaxToolcallBackLength) is too small for fallback trim message ($($trimMessage.Length) chars)"
1735
+
$outputText="Fallback output too large to display"
Microsoft.PowerShell.Utility\Write-Verbose"Tool '$($toolCall.function.name)' fallback output was trimmed from $originalLength to $($outputText.Length) characters"
0 commit comments