Skip to content

Commit 9668be9

Browse files
refactor: rename supports methods (#13)
* Rename method * refactor: supports method names --------- Co-authored-by: Christopher Hertel <[email protected]>
1 parent d67c5e7 commit 9668be9

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/Anthropic/Model/Claude.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public function call(MessageBag $messages, array $options = []): Response
3737
return new Response(new Choice($response['content'][0]['text']));
3838
}
3939

40-
public function hasToolSupport(): bool
40+
public function supportsToolCalling(): bool
4141
{
4242
return false; // it does, but implementation here is still open.
4343
}
4444

45-
public function hasStructuredOutputSupport(): bool
45+
public function supportsStructuredOutput(): bool
4646
{
4747
return false;
4848
}

src/Chain.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public function call(MessageBag $messages, array $options = []): string|object
2727
{
2828
$llmOptions = $options;
2929

30-
if (!array_key_exists('tools', $llmOptions) && null !== $this->toolRegistry && $this->llm->hasToolSupport()) {
30+
if (!array_key_exists('tools', $llmOptions) && null !== $this->toolRegistry && $this->llm->supportsToolCalling()) {
3131
$llmOptions['tools'] = $this->toolRegistry->getMap();
3232
}
3333

34-
if (array_key_exists('output_structure', $llmOptions) && null !== $this->responseFormatFactory && $this->llm->hasStructuredOutputSupport()) {
34+
if (array_key_exists('output_structure', $llmOptions) && null !== $this->responseFormatFactory && $this->llm->supportsStructuredOutput()) {
3535
$llmOptions['response_format'] = $this->responseFormatFactory->create($llmOptions['output_structure']);
3636
unset($llmOptions['output_structure']);
3737
}

src/LanguageModel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface LanguageModel
1414
*/
1515
public function call(MessageBag $messages, array $options = []): Response;
1616

17-
public function hasToolSupport(): bool;
17+
public function supportsToolCalling(): bool;
1818

19-
public function hasStructuredOutputSupport(): bool;
19+
public function supportsStructuredOutput(): bool;
2020
}

src/OpenAI/Model/Gpt.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ public function call(MessageBag $messages, array $options = []): Response
3434
return new Response(...array_map([$this, 'convertChoice'], $response['choices']));
3535
}
3636

37-
public function hasToolSupport(): bool
37+
public function supportsToolCalling(): bool
3838
{
3939
return true;
4040
}
4141

42-
public function hasStructuredOutputSupport(): bool
42+
public function supportsStructuredOutput(): bool
4343
{
44-
return $this->version->hasStructuredOutputSupport();
44+
return $this->version->supportsStructuredOutput();
4545
}
4646

4747
/**

src/OpenAI/Model/Gpt/Version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ enum Version: string
1313
case GPT_4o = 'gpt-4o';
1414
case GPT_4o_MINI = 'gpt-4o-mini';
1515

16-
public function hasStructuredOutputSupport(): bool
16+
public function supportsStructuredOutput(): bool
1717
{
1818
return self::GPT_4o === $this || self::GPT_4o_MINI === $this;
1919
}

0 commit comments

Comments
 (0)