Skip to content

Commit

Permalink
fixes #23
Browse files Browse the repository at this point in the history
  • Loading branch information
dfinke committed Aug 11, 2024
1 parent cd2336e commit 9b57c33
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
2 changes: 1 addition & 1 deletion PSAI.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
RootModule = 'PSAI.psm1'
ModuleVersion = '0.2.7'
ModuleVersion = '0.2.8'
GUID = '68662d19-a8f1-484f-b1b7-3bf0e8a436df'
Author = 'Douglas Finke'
CompanyName = 'Doug Finke'
Expand Down
21 changes: 16 additions & 5 deletions Public/New-OAIThread.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,22 @@ function New-OAIThread {
$url = $baseUrl + '/threads'
$Method = 'Post'

$body = (Get-OAIProvider) -eq 'OpenAI' ? @{
messages = $Messages
tool_resources = $ToolResources
metadata = $Metadata
} : ''
# $body = (Get-OAIProvider) -eq 'OpenAI' ? @{
# messages = $Messages
# tool_resources = $ToolResources
# metadata = $Metadata
# } : ''

if ((Get-OAIProvider) -eq 'OpenAI') {
$body = @{
messages = $Messages
tool_resources = $ToolResources
metadata = $Metadata
}
}
else {
$body = ''
}

Invoke-OAIBeta -Uri $url -Method $Method -Body $body
}
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v0.2.8

- For users on an older version of PowerShell
- Don't use ternary the operator or parallel processing

## v0.2.7

- Added new OpenAI model
Expand Down
14 changes: 12 additions & 2 deletions examples/quickstarts/06-ChatWithDocs/PSChatDocs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,20 @@ function PSChatDocs {
)

Write-Host "Uploading files..." -ForegroundColor Cyan
$files = Get-ChildItem $Path | ForEach-Object -Parallel {
Invoke-OAIUploadFile -Path $_.FullName

if ($PSVersionTable.PSVersion.Major -lt 7) {
# slower sequential upload
# use a newer version of PowerShell for parallel processing
$files = Get-ChildItem $Path | ForEach-Object {
Invoke-OAIUploadFile -Path $_.FullName
}
} else {
$files = Get-ChildItem $Path | ForEach-Object -Parallel {
Invoke-OAIUploadFile -Path $_.FullName
}
}


Write-Host "Creating Assistant..." -ForegroundColor Cyan
$ToolResources = @{
file_search = @{
Expand Down

0 comments on commit 9b57c33

Please sign in to comment.