Skip to content

Commit 8cde241

Browse files
author
Mohamed Khaled
committed
Fix test expectations for new exception hierarchy with indexed field names
1 parent 436549f commit 8cde241

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

tests/unit/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleImageGenerationModelTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,8 @@ public function testParseResponseChoiceToCandidateMissingUrlOrB64Json(): void
826826

827827
$this->expectException(ResponseException::class);
828828
$this->expectExceptionMessage(
829-
'Unexpected TestProvider API response: Missing the "url or b64_json" key in choice data.'
829+
'Unexpected TestProvider API response: Each choice must contain either a url or b64_json key with a ' .
830+
'string value.'
830831
);
831832

832833
$model->exposeParseResponseChoiceToCandidate($choiceData);

tests/unit/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleTextGenerationModelTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ public function testParseResponseChoiceToCandidateMissingMessage(): void
10331033

10341034
$this->expectException(ResponseException::class);
10351035
$this->expectExceptionMessage(
1036-
'Unexpected TestProvider API response: Missing the "message" key in choice data.'
1036+
'Unexpected TestProvider API response: Missing the "choices[0].message" key.'
10371037
);
10381038

10391039
$model->exposeParseResponseChoiceToCandidate($choiceData);
@@ -1054,7 +1054,7 @@ public function testParseResponseChoiceToCandidateInvalidMessageType(): void
10541054

10551055
$this->expectException(ResponseException::class);
10561056
$this->expectExceptionMessage(
1057-
'Unexpected TestProvider API response: Missing the "message" key in choice data.'
1057+
'Unexpected TestProvider API response: Missing the "choices[0].message" key.'
10581058
);
10591059

10601060
$model->exposeParseResponseChoiceToCandidate($choiceData);
@@ -1077,7 +1077,7 @@ public function testParseResponseChoiceToCandidateMissingFinishReason(): void
10771077

10781078
$this->expectException(ResponseException::class);
10791079
$this->expectExceptionMessage(
1080-
'Unexpected TestProvider API response: Missing the "finish_reason" key in choice data.'
1080+
'Unexpected TestProvider API response: Missing the "choices[0].finish_reason" key.'
10811081
);
10821082

10831083
$model->exposeParseResponseChoiceToCandidate($choiceData);

tests/unit/Providers/OpenAiCompatibleImplementation/MockOpenAiCompatibleTextGenerationModel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ public function exposePrepareResponseFormatParam(?array $outputSchema): array
158158
return $this->prepareResponseFormatParam($outputSchema);
159159
}
160160

161-
public function exposeParseResponseChoiceToCandidate(array $choiceData): Candidate
161+
public function exposeParseResponseChoiceToCandidate(array $choiceData, int $index = 0): Candidate
162162
{
163-
return $this->parseResponseChoiceToCandidate($choiceData);
163+
return $this->parseResponseChoiceToCandidate($choiceData, $index);
164164
}
165165

166166
public function exposeParseResponseChoiceMessage(array $messageData): Message

0 commit comments

Comments
 (0)