Skip to content

Commit b236852

Browse files
committed
readme for structured output is updated
1 parent 2bf8e5e commit b236852

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,8 @@ $content = Arr::get($response->choices[0], 'message.content');
392392
```
393393

394394
- #### Structured Output
395-
If you want to receive the response in a structured format, you can specify the `response_format` property in the `ChatData` object.
396-
And also setting `require_parameters` to **true** in provider preferences (in `ProviderPreferencesData` DTO object) is advised for structured output.
395+
If you want to receive the response in a structured format, you can specify the `type` property for `response_format` (ResponseFormatData) as `json_object` in the `ChatData` object.
396+
Additionally, it's recommended to set the `require_parameters` property for `provider` (ProviderPreferencesData) to `true` in the `ChatData` object.
397397

398398
(Please also refer to [OpenRouter Document Structured Output](https://openrouter.ai/docs/structured-outputs) for models supporting structured output, also more details)
399399
```php
@@ -408,16 +408,16 @@ $chatData = new ChatData([
408408
'response_format' => new ResponseFormatData([
409409
'type' => 'json_object',
410410
]),
411-
'provider' => new ProviderPreferencesData([
411+
'provider' => new ProviderPreferencesData([
412412
'require_parameters' => true,
413413
]),
414414
]);
415415
```
416416

417-
You can also specify the `response_format` property as `json_schema` to receive the response in a specified schema format (set `'strict' => true` in `json_schema` array for strict schema):
417+
You can also specify the `response_format` as `json_schema` to receive the response in a specified schema format (Advisable to set `'strict' => true` in `json_schema` array for strict schema):
418418
```php
419419
$chatData = new ChatData([
420-
'messages' => [
420+
'messages' => [
421421
new MessageData([
422422
'role' => RoleType::USER,
423423
'content' => 'Tell me a story about a rogue AI that falls in love with its creator.',

0 commit comments

Comments
 (0)