Skip to content

Commit

Permalink
Lecture 11 - Block with a timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
nibblebits committed Dec 28, 2023
1 parent aae1a11 commit 3303e8f
Show file tree
Hide file tree
Showing 31 changed files with 285 additions and 161 deletions.
5 changes: 4 additions & 1 deletion chat.php
Expand Up @@ -2,6 +2,7 @@
use Dragonzap\OpenAI\ChatGPT\APIConfiguration;
use Dragonzap\OpenAI\ChatGPT\Assistant;
use Dragonzap\OpenAI\ChatGPT\Exceptions\ThreadRunResponseLastError;
use Dragonzap\OpenAI\ChatGPT\Exceptions\TimeoutException;
use Dragonzap\OpenAI\ChatGPT\UnknownAssistant;

require './vendor/autoload.php';
Expand Down Expand Up @@ -64,7 +65,9 @@ public function saveConversationIdentificationData(Dragonzap\OpenAI\ChatGPT\Conv
$input_line = fgets(STDIN);
$conversation->sendMessage($input_line);
try {
$conversation->blockUntilResponded();
$conversation->blockUntilResponded(1);
} catch(TimeoutException $ex) {
echo "Timed out\n";
} catch (ThreadRunResponseLastError $ex) {
throw $ex;
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
@@ -1,6 +1,6 @@
{
"require": {
"dragonzap/openai-chatgpt-assistant": "^2.0"
"dragonzap/openai-chatgpt-assistant": "^2.1"
},
"config": {
"allow-plugins": {
Expand Down
66 changes: 33 additions & 33 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3303e8f

Please sign in to comment.