summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorhp256 <971748116@qq.com>2023-05-23 11:03:26 +0200
committerhp256 <971748116@qq.com>2023-05-23 11:03:26 +0200
commitf545f4b479d3d8732828f758efaac20152b4c104 (patch)
tree2c3ae6ce2d7c16c3c00010e72a3d9c8cb54c832e /testing
parentadd hpgptai (diff)
downloadgpt4free-f545f4b479d3d8732828f758efaac20152b4c104.tar
gpt4free-f545f4b479d3d8732828f758efaac20152b4c104.tar.gz
gpt4free-f545f4b479d3d8732828f758efaac20152b4c104.tar.bz2
gpt4free-f545f4b479d3d8732828f758efaac20152b4c104.tar.lz
gpt4free-f545f4b479d3d8732828f758efaac20152b4c104.tar.xz
gpt4free-f545f4b479d3d8732828f758efaac20152b4c104.tar.zst
gpt4free-f545f4b479d3d8732828f758efaac20152b4c104.zip
Diffstat (limited to '')
-rw-r--r--testing/gptworldai_test.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/testing/gptworldai_test.py b/testing/gptworldai_test.py
new file mode 100644
index 00000000..3dfb32ce
--- /dev/null
+++ b/testing/gptworldai_test.py
@@ -0,0 +1,18 @@
+import gptworldAi
+
+# single completion
+for chunk in gptworldAi.Completion.create("你是谁", "127.0.0.1:7890"):
+ print(chunk, end="", flush=True)
+print()
+
+# chat completion
+message = []
+while True:
+ prompt = input("请输入问题:")
+ message.append({"role": "user", "content": prompt})
+ text = ""
+ for chunk in gptworldAi.ChatCompletion.create(message, '127.0.0.1:7890'):
+ text = text + chunk
+ print(chunk, end="", flush=True)
+ print()
+ message.append({"role": "assistant", "content": text})