Skip to content

Commit 694fa42

Browse files
author
miroslav
committed
Update readme & codefix
1 parent 103ef43 commit 694fa42

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ OPENAI_API_KEY=sk-*
4343
* Models
4444
* [List models](https://platform.openai.com/docs/api-reference/models/list)
4545
* [Retrieve model](https://platform.openai.com/docs/api-reference/models/retrieve)
46-
46+
* Images
47+
* [Create image](https://platform.openai.com/docs/api-reference/images/create)
4748

4849
#### Coming soon:
4950
* Images
50-
* Create image
5151
* Create image edit
5252
* Audio
5353
* Create transcription
@@ -79,6 +79,21 @@ $result->getChoices(); // Choices from OpenAI.
7979

8080
```
8181

82+
#### Create image:
83+
84+
```php
85+
$openAI = $this->container->make(\Itsimiro\OpenAI\Services\OpenAI::class);
86+
87+
88+
$result = $openAI->getDalle()->createImage(new CreateImageParameters(
89+
'dog with a bone',
90+
2,
91+
responseFormat: ImageResponseFormatEnum::URL
92+
));
93+
94+
$result->getImages(); // Generated images
95+
```
96+
8297
#### See the [documentation](https://platform.openai.com/docs/api-reference) for more details on using OpenAI.
8398

8499
## Testing

src/Services/DataTransferObjects/CreateImageParameters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function __construct(
1313
public int $imageCount = 1,
1414
public ImageSizeEnum $size = ImageSizeEnum::LARGE,
1515
public ImageResponseFormatEnum $responseFormat = ImageResponseFormatEnum::URL,
16-
public ?string $user = null
16+
public string $user = ''
1717
)
1818
{}
1919

0 commit comments

Comments
 (0)