summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorezerinz <edwinnnzx@gmail.com>2023-04-28 10:36:53 +0200
committerezerinz <edwinnnzx@gmail.com>2023-04-28 10:36:53 +0200
commitf95ace38705df52c0c8a7351fe81283bf51e1365 (patch)
tree528c723378d900616eef3f2a79159df7a09b752d
parentMerge pull request #241 from ethanx40/main (diff)
downloadgpt4free-f95ace38705df52c0c8a7351fe81283bf51e1365.tar
gpt4free-f95ace38705df52c0c8a7351fe81283bf51e1365.tar.gz
gpt4free-f95ace38705df52c0c8a7351fe81283bf51e1365.tar.bz2
gpt4free-f95ace38705df52c0c8a7351fe81283bf51e1365.tar.lz
gpt4free-f95ace38705df52c0c8a7351fe81283bf51e1365.tar.xz
gpt4free-f95ace38705df52c0c8a7351fe81283bf51e1365.tar.zst
gpt4free-f95ace38705df52c0c8a7351fe81283bf51e1365.zip
-rw-r--r--testing/openaihosted_test.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/openaihosted_test.py b/testing/openaihosted_test.py
new file mode 100644
index 00000000..d5a79e52
--- /dev/null
+++ b/testing/openaihosted_test.py
@@ -0,0 +1,14 @@
+import openaihosted
+
+messages = [{"role": "system", "content": "You are a helpful assistant."}]
+while True:
+ question = input("Question: ")
+ if question == "!stop":
+ break
+
+ messages.append({"role": "user", "content": question})
+ request = openaihosted.Completion.create(messages=messages)
+
+ response = request["responses"]
+ messages.append({"role": "assistant", "content": response})
+ print(f"Answer: {response}")