Skip to content

Commit 6142c53

Browse files
committed
Fix lack of AiModelRequirements in code examples.
1 parent 6f8fe19 commit 6142c53

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

docs/ARCHITECTURE.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ $texts = AiClient::generateTextResult(
5151
```php
5252
$modelsMetadata = AiClient::defaultRegistry()->findProviderModelsMetadataForSupport(
5353
'openai',
54-
AiCapability::IMAGE_GENERATION
54+
new AiModelRequirements([AiCapability::IMAGE_GENERATION])
5555
);
5656
$imageFile = AiClient::generateImageResult(
5757
'Generate an illustration of the PHP elephant in the Carribean sea.',
@@ -66,7 +66,7 @@ $imageFile = AiClient::generateImageResult(
6666

6767
```php
6868
$providerModelsMetadata = AiClient::defaultRegistry()->findModelsMetadataForSupport(
69-
AiCapability::IMAGE_GENERATION
69+
new AiModelRequirements([AiCapability::IMAGE_GENERATION])
7070
);
7171
$imageFile = AiClient::generateImageResult(
7272
'Generate an illustration of the PHP elephant in the Carribean sea.',
@@ -83,7 +83,7 @@ _Note: This does effectively the exact same as [the first code example](#generat
8383

8484
```php
8585
$providerModelsMetadata = AiClient::defaultRegistry()->findModelsMetadataForSupport(
86-
AiCapability::TEXT_GENERATION
86+
new AiModelRequirements([AiCapability::TEXT_GENERATION])
8787
);
8888
$text = AiClient::generateTextResult(
8989
'Write a 2-verse poem about PHP.',
@@ -141,12 +141,14 @@ _Note: Unlike the previous two examples, to require JSON output it is necessary
141141

142142
```php
143143
$providerModelsMetadata = AiClient::defaultRegistry()->findModelsMetadataForSupport(
144-
AiCapability::TEXT_GENERATION,
145-
[
146-
// Make sure the model supports JSON output as well as following a given schema.
147-
AiOption::OUTPUT_MIME_TYPE => 'application/json',
148-
AiOption::OUTPUT_SCHEMA => true,
149-
]
144+
new AiModelRequirements(
145+
[AiCapability::TEXT_GENERATION],
146+
[
147+
// Make sure the model supports JSON output as well as following a given schema.
148+
AiOption::OUTPUT_MIME_TYPE => 'application/json',
149+
AiOption::OUTPUT_SCHEMA => true,
150+
]
151+
)
150152
);
151153
$jsonString = AiClient::generateTextResult(
152154
'Transform the following CSV content into a JSON array of row data.',
@@ -178,7 +180,7 @@ $jsonString = AiClient::generateTextResult(
178180

179181
```php
180182
$providerModelsMetadata = AiClient::defaultRegistry()->findModelsMetadataForSupport(
181-
AiCapability::EMBEDDING_GENERATION
183+
new AiModelRequirements([AiCapability::EMBEDDING_GENERATION])
182184
);
183185
$embeddings = AiClient::generateEmbeddingsResult(
184186
[

0 commit comments

Comments
 (0)