|
11 | 11 | use PhpLlm\LlmChain\Response\Choice; |
12 | 12 | use PhpLlm\LlmChain\Response\Response; |
13 | 13 |
|
14 | | -final readonly class Claude implements LanguageModel |
| 14 | +final class Claude implements LanguageModel |
15 | 15 | { |
16 | 16 | public function __construct( |
17 | | - private ClaudeRuntime $runtime, |
18 | | - private Version $version = Version::SONNET_35, |
19 | | - private float $temperature = 1.0, |
20 | | - private int $maxTokens = 1000, |
| 17 | + private readonly ClaudeRuntime $runtime, |
| 18 | + private ?Version $version = null, |
| 19 | + private readonly float $temperature = 1.0, |
| 20 | + private readonly int $maxTokens = 1000, |
21 | 21 | ) { |
| 22 | + $this->version ??= Version::sonnet35(); |
22 | 23 | } |
23 | 24 |
|
24 | 25 | public function call(MessageBag $messages, array $options = []): Response |
25 | 26 | { |
26 | 27 | $system = $messages->getSystemMessage(); |
27 | 28 | $body = [ |
28 | | - 'model' => $this->version->value, |
| 29 | + 'model' => $this->version->name, |
29 | 30 | 'temperature' => $this->temperature, |
30 | 31 | 'max_tokens' => $this->maxTokens, |
31 | 32 | 'system' => $system->content, |
|
0 commit comments