-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathToolChoiceMapTest.php
More file actions
35 lines (27 loc) · 964 Bytes
/
ToolChoiceMapTest.php
File metadata and controls
35 lines (27 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
declare(strict_types=1);
namespace Tests\Schemas\Anthropic\Maps;
use InvalidArgumentException;
use Prism\Bedrock\Schemas\Anthropic\Maps\ToolChoiceMap;
use Prism\Prism\Enums\ToolChoice;
it('returns null when tool choice is null', function (): void {
expect(ToolChoiceMap::map(null))->toBeNull();
});
it('maps a specific tool correctly', function (): void {
expect(ToolChoiceMap::map('search'))
->toBe([
'type' => 'tool',
'name' => 'search',
]);
});
it('maps auto tool correctly', function (): void {
expect(ToolChoiceMap::map(ToolChoice::Auto))
->toBe(['type' => 'auto']);
});
it('maps any tool correctly', function (): void {
expect(ToolChoiceMap::map(ToolChoice::Any))
->toBe(['type' => 'any']);
});
it('throws exception for invalid tool choice', function (): void {
ToolChoiceMap::map(ToolChoice::None);
})->throws(InvalidArgumentException::class, 'Invalid tool choice');