summaryrefslogtreecommitdiffstats
path: root/gpt4free
diff options
context:
space:
mode:
authorRory Durrant <rory@spun.ga>2023-05-04 18:14:18 +0200
committerGitHub <noreply@github.com>2023-05-04 18:14:18 +0200
commit82a3a039290cded2cc1282647f78ebd91d475b46 (patch)
tree7ae017b4997c1a651e3c43e8d6dd88dcd75dcdc9 /gpt4free
parentUpdate README.md (diff)
downloadgpt4free-82a3a039290cded2cc1282647f78ebd91d475b46.tar
gpt4free-82a3a039290cded2cc1282647f78ebd91d475b46.tar.gz
gpt4free-82a3a039290cded2cc1282647f78ebd91d475b46.tar.bz2
gpt4free-82a3a039290cded2cc1282647f78ebd91d475b46.tar.lz
gpt4free-82a3a039290cded2cc1282647f78ebd91d475b46.tar.xz
gpt4free-82a3a039290cded2cc1282647f78ebd91d475b46.tar.zst
gpt4free-82a3a039290cded2cc1282647f78ebd91d475b46.zip
Diffstat (limited to 'gpt4free')
-rw-r--r--gpt4free/theb/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/gpt4free/theb/__init__.py b/gpt4free/theb/__init__.py
index b162811e..4513ea6e 100644
--- a/gpt4free/theb/__init__.py
+++ b/gpt4free/theb/__init__.py
@@ -46,7 +46,6 @@ class Completion:
Completion.stream_completed = True
@staticmethod
-
def create(prompt: str, proxy: Optional[str] = None) -> Generator[str, None, None]:
Completion.stream_completed = False
@@ -66,3 +65,10 @@ class Completion:
@staticmethod
def handle_stream_response(response):
Completion.message_queue.put(response.decode())
+
+ @staticmethod
+ def get_response(prompt: str, proxy: Optional[str] = None) -> str:
+ response_list = []
+ for message in Completion.create(prompt, proxy):
+ response_list.append(message)
+ return ''.join(response_list)