client
client copied to clipboard
Add responseMimeType and responseSchema to GenerationConfig
This allows structured output usage.
$client = new Client($key);
$clent = $client->withV1BetaVersion()->generativeModel('gemini-2.0-flash');
$config = (new GenerationConfig())
->withResponseMimeType(MimeType::APPLICATION_JSON)
->withResponseSchema([
'type' => 'string',
'enum' => [
'hotdog',
'fries',
'coke'
]
]);
$client->withGenerationConfig($config)->generateContent('....');