Skip to content

Commit

Permalink
Fix parameterset issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mkht committed Mar 24, 2024
1 parent 5f79753 commit e0a7bf7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Public/Runs/Start-ThreadRun.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ function Start-ThreadRun {
[Parameter()]
[System.Collections.IDictionary]$MetaData,

[Parameter(ParameterSetName = 'Run_Stream')]
[Parameter(ParameterSetName = 'ThreadAndRun_Stream')]
[Parameter(Mandatory = $true, ParameterSetName = 'Run_Stream')]
[Parameter(Mandatory = $true, ParameterSetName = 'ThreadAndRun_Stream')]
[switch]$Stream,

[Parameter()]
Expand Down
16 changes: 16 additions & 0 deletions Tests/Runs/Start-ThreadRun.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ Describe 'Start-ThreadRun' {
Should -Invoke Invoke-OpenAIAPIRequest -ModuleName $script:ModuleName
}

It 'Start thread run without thread' {
{ $script:Result = Start-ThreadRun -Assistant $assistant -Message 'TEST' -ea Stop } | Should -Not -Throw
Should -Invoke Invoke-OpenAIAPIRequest -ModuleName $script:ModuleName
$Result.id | Should -BeExactly 'run_abc123'
$Result.object | Should -BeExactly 'thread.run'
$Result.created_at | Should -BeOfType [datetime]
$Result.started_at | Should -BeOfType [datetime]
$Result.completed_at | Should -BeOfType [datetime]
}

It 'raw_response format' {
{ $script:Result = Start-ThreadRun -Thread 'thread_abc123' -Assistant 'asst_abc123' -Format 'raw_response' -ea Stop } | Should -Not -Throw
Should -Invoke Invoke-OpenAIAPIRequest -ModuleName $script:ModuleName
$Result | Should -BeOfType [string]
}

It 'Pipeline input' {
$thread = [PSCustomObject]@{
id = 'thread_abc123'
Expand Down

0 comments on commit e0a7bf7

Please sign in to comment.