Skip to content

Commit 5cdc81b

Browse files
committed
Refactor tool processing in Invoke-OpenAIProvider to use a generic list for improved performance
1 parent 978f5af commit 5cdc81b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Providers/OpenAI.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ function Invoke-OpenAIProvider {
3838

3939
# Process tools: if strings, register them; then convert to provider schema
4040
if ($Tools) {
41-
$toolDefinitions = @()
41+
$toolDefinitions = New-Object System.Collections.Generic.List[object]
4242
foreach ($tool in $Tools) {
4343
if ($tool -is [string]) {
44-
$toolDefinitions += Register-Tool $tool
44+
$toolDefinitions.Add((Register-Tool $tool))
4545
}
4646
else {
47-
$toolDefinitions += $tool
47+
$toolDefinitions.Add($tool)
4848
}
4949
}
5050
$Tools = ConvertTo-ProviderToolSchema -Tools $toolDefinitions -Provider openai

0 commit comments

Comments
 (0)