Skip to content

Commit 8e2437b

Browse files
committed
Merge branch 'main' of github.com:mastashake08/laravel-openai-api into main
2 parents a53c40b + 32500f3 commit 8e2437b

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,32 @@ echo $laravelOpenaiApi->generateResult($type, $data);
6161
php artisan laravel-openai-api:generate-result
6262
```
6363
### Via API
64-
You set the OPENAI_API_URL in the .env file
64+
You set the OPENAI_API_URL in the .env file if a value is not set then it defaults to /api/generate-result
6565
```
6666
/api/generate-result POST {openai_data}
6767
```
68+
The data object requires a ```type``` property that is either set to text or image. Depending on which type then provide the JSON referenced in the [OpenAI API Reference](https://platform.openai.com/docs/api-reference/images/create)
6869

70+
#### Text Example
71+
```
72+
{
73+
"type": "text",
74+
"prompt": "Rust is",
75+
"n": 1,
76+
"model": "text-davinci-003",
77+
"max_tokens": 16
78+
}
79+
```
6980

81+
#### Image Example
82+
```
83+
{
84+
"type": "image",
85+
"prompt": "A cute baby sea otter",
86+
"n": 1,
87+
"size": "1024x1024"
88+
}
89+
```
7090
## Testing
7191

7292
```bash

0 commit comments

Comments
 (0)