Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Providers/Groq/Maps/ToolChoiceMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static function map(string|ToolChoice|null $toolChoice): string|array|nul

return match ($toolChoice) {
ToolChoice::Auto => 'auto',
ToolChoice::Any => 'required',
null => $toolChoice,
default => throw new PrismException('Invalid tool choice')
};
Expand Down
6 changes: 2 additions & 4 deletions tests/Providers/Groq/GroqTextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Illuminate\Support\Facades\Http;
use Prism\Prism\Enums\Provider;
use Prism\Prism\Enums\ToolChoice;
use Prism\Prism\Exceptions\PrismException;
use Prism\Prism\Exceptions\PrismRateLimitedException;
use Prism\Prism\Facades\Prism;
use Prism\Prism\Facades\Tool;
Expand Down Expand Up @@ -132,15 +131,14 @@
});

it('throws an exception for ToolChoice::Any', function (): void {
$this->expectException(PrismException::class);
$this->expectExceptionMessage('Invalid tool choice');
FixtureResponse::fakeResponseSequence('v1/chat/completions', 'groq/generate-text-with-required-tool-call');

Prism::text()
->using('groq', 'gpt-4')
->withPrompt('Who are you?')
->withToolChoice(ToolChoice::Any)
->asText();
});
})->throwsNoExceptions();
});

describe('Image support with grok', function (): void {
Expand Down