From c58eab5b69551996a88e3f04cbfc5dd3b4a15132 Mon Sep 17 00:00:00 2001 From: pb30 Date: Mon, 28 Aug 2023 15:10:59 -0500 Subject: [PATCH] Readme: Update example to use Chat/GPT3.5 --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ed2df36..fd58ec6 100644 --- a/README.md +++ b/README.md @@ -43,12 +43,14 @@ Finally, you may use the `OpenAI` facade to access the OpenAI API: ```php use OpenAI\Laravel\Facades\OpenAI; -$result = OpenAI::completions()->create([ - 'model' => 'text-davinci-003', - 'prompt' => 'PHP is', +$result = OpenAI::chat()->create([ + 'model' => 'gpt-3.5-turbo', + 'messages' => [ + ['role' => 'user', 'content' => 'Hello!'], + ], ]); -echo $result['choices'][0]['text']; // an open-source, widely-used, server-side scripting language. +echo $result->choices[0]->message->content; // Hello! How can I assist you today? ``` ## Usage