Skip to content

Commit 9762c5d

Browse files
committed
minor #153 [Platform] Enum for Capability instead of class with constants (welcoMattic)
This PR was merged into the main branch. Discussion ---------- [Platform] Enum for Capability instead of class with constants | Q | A | ------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Docs? | no <!-- required for new features --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT Replace #152 Commits ------- 1e06720 Make Capability class an Enum
2 parents 9479d4f + 1e06720 commit 9762c5d

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/platform/src/Capability.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
/**
1515
* @author Christopher Hertel <[email protected]>
1616
*/
17-
class Capability
17+
enum Capability: string
1818
{
1919
// INPUT
20-
public const INPUT_AUDIO = 'input-audio';
21-
public const INPUT_IMAGE = 'input-image';
22-
public const INPUT_MESSAGES = 'input-messages';
23-
public const INPUT_MULTIPLE = 'input-multiple';
24-
public const INPUT_PDF = 'input-pdf';
25-
public const INPUT_TEXT = 'input-text';
20+
case INPUT_AUDIO = 'input-audio';
21+
case INPUT_IMAGE = 'input-image';
22+
case INPUT_MESSAGES = 'input-messages';
23+
case INPUT_MULTIPLE = 'input-multiple';
24+
case INPUT_PDF = 'input-pdf';
25+
case INPUT_TEXT = 'input-text';
2626

2727
// OUTPUT
28-
public const OUTPUT_AUDIO = 'output-audio';
29-
public const OUTPUT_IMAGE = 'output-image';
30-
public const OUTPUT_STREAMING = 'output-streaming';
31-
public const OUTPUT_STRUCTURED = 'output-structured';
32-
public const OUTPUT_TEXT = 'output-text';
28+
case OUTPUT_AUDIO = 'output-audio';
29+
case OUTPUT_IMAGE = 'output-image';
30+
case OUTPUT_STREAMING = 'output-streaming';
31+
case OUTPUT_STRUCTURED = 'output-structured';
32+
case OUTPUT_TEXT = 'output-text';
3333

3434
// FUNCTIONALITY
35-
public const TOOL_CALLING = 'tool-calling';
35+
case TOOL_CALLING = 'tool-calling';
3636
}

src/platform/src/Model.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class Model
1818
{
1919
/**
20-
* @param string[] $capabilities
20+
* @param Capability[] $capabilities
2121
* @param array<string, mixed> $options
2222
*/
2323
public function __construct(
@@ -33,14 +33,14 @@ public function getName(): string
3333
}
3434

3535
/**
36-
* @return string[]
36+
* @return Capability[]
3737
*/
3838
public function getCapabilities(): array
3939
{
4040
return $this->capabilities;
4141
}
4242

43-
public function supports(string $capability): bool
43+
public function supports(Capability $capability): bool
4444
{
4545
return \in_array($capability, $this->capabilities, true);
4646
}

0 commit comments

Comments
 (0)