Skip to content

Commit d27082c

Browse files
authored
Readme: Update example to use Chat/GPT3.5 (#56)
1 parent 93fbee8 commit d27082c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ Finally, you may use the `OpenAI` facade to access the OpenAI API:
4343
```php
4444
use OpenAI\Laravel\Facades\OpenAI;
4545

46-
$result = OpenAI::completions()->create([
46+
$result = OpenAI::chat()->create([
4747
'model' => 'gpt-3.5-turbo-instruct',
48-
'prompt' => 'PHP is',
48+
'messages' => [
49+
['role' => 'user', 'content' => 'Hello!'],
50+
],
4951
]);
5052

51-
echo $result['choices'][0]['text']; // an open-source, widely-used, server-side scripting language.
53+
echo $result->choices[0]->message->content; // Hello! How can I assist you today?
5254
```
5355

5456
## Configuration

0 commit comments

Comments
 (0)