diff --git a/README.md b/README.md
index e1dce35..af4e81c 100644
--- a/README.md
+++ b/README.md
@@ -75,7 +75,21 @@ $summary = $conversation->getSummary();
// Result: Famous genius mathematician.
```
-
+
+
+
+ Stop answer generation
+
+If HuggingChat is taking too much time to answer or starts writing too much, you can stop generation in a parallel process/request using this method:
+
+```php
+// See "Resume a conversation"
+$conversation = $ai->resumeChatConversation($identifiers);
+
+$conversation->stopGenerating();
+```
+
+
Handle HuggingChat errors
diff --git a/src/Conversation.php b/src/Conversation.php
index 9f67233..6284491 100644
--- a/src/Conversation.php
+++ b/src/Conversation.php
@@ -184,4 +184,17 @@ public function getSummary()
return trim($data['title'], '"');
}
+
+ public function stopGenerating()
+ {
+ $headers = [
+ 'method: POST',
+ 'accept: */*',
+ "referer: https://huggingface.co/chat/conversation/{$this->id}",
+ 'content-type: application/json',
+ "cookie: hf-chat={$this->cookie}"
+ ];
+
+ $data = Tools::request("https://huggingface.co/chat/conversation/{$this->id}/stop-generating", $headers, '', true);
+ }
}