@@ -51,7 +51,7 @@ $texts = AiClient::generateTextResult(
51
51
``` php
52
52
$modelsMetadata = AiClient::defaultRegistry()->findProviderModelsMetadataForSupport(
53
53
'openai',
54
- AiCapability::IMAGE_GENERATION
54
+ new AiModelRequirements([ AiCapability::IMAGE_GENERATION])
55
55
);
56
56
$imageFile = AiClient::generateImageResult(
57
57
'Generate an illustration of the PHP elephant in the Carribean sea.',
@@ -66,7 +66,7 @@ $imageFile = AiClient::generateImageResult(
66
66
67
67
``` php
68
68
$providerModelsMetadata = AiClient::defaultRegistry()->findModelsMetadataForSupport(
69
- AiCapability::IMAGE_GENERATION
69
+ new AiModelRequirements([ AiCapability::IMAGE_GENERATION])
70
70
);
71
71
$imageFile = AiClient::generateImageResult(
72
72
'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
83
83
84
84
``` php
85
85
$providerModelsMetadata = AiClient::defaultRegistry()->findModelsMetadataForSupport(
86
- AiCapability::TEXT_GENERATION
86
+ new AiModelRequirements([ AiCapability::TEXT_GENERATION])
87
87
);
88
88
$text = AiClient::generateTextResult(
89
89
'Write a 2-verse poem about PHP.',
@@ -141,12 +141,14 @@ _Note: Unlike the previous two examples, to require JSON output it is necessary
141
141
142
142
``` php
143
143
$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
+ )
150
152
);
151
153
$jsonString = AiClient::generateTextResult(
152
154
'Transform the following CSV content into a JSON array of row data.',
@@ -178,7 +180,7 @@ $jsonString = AiClient::generateTextResult(
178
180
179
181
``` php
180
182
$providerModelsMetadata = AiClient::defaultRegistry()->findModelsMetadataForSupport(
181
- AiCapability::EMBEDDING_GENERATION
183
+ new AiModelRequirements([ AiCapability::EMBEDDING_GENERATION])
182
184
);
183
185
$embeddings = AiClient::generateEmbeddingsResult(
184
186
[
0 commit comments