diff options
author | xtekky <98614666+xtekky@users.noreply.github.com> | 2023-05-24 18:30:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-24 18:30:41 +0200 |
commit | 362f9877cedd92681dec32997f9ea555d0f8d228 (patch) | |
tree | 2c53994b4f4796067e458d0fea0786270b129cde /testing/gptworldai_test.py | |
parent | Merge pull request #590 from ezerinz/main (diff) | |
parent | add gptworldai (diff) | |
download | gpt4free-362f9877cedd92681dec32997f9ea555d0f8d228.tar gpt4free-362f9877cedd92681dec32997f9ea555d0f8d228.tar.gz gpt4free-362f9877cedd92681dec32997f9ea555d0f8d228.tar.bz2 gpt4free-362f9877cedd92681dec32997f9ea555d0f8d228.tar.lz gpt4free-362f9877cedd92681dec32997f9ea555d0f8d228.tar.xz gpt4free-362f9877cedd92681dec32997f9ea555d0f8d228.tar.zst gpt4free-362f9877cedd92681dec32997f9ea555d0f8d228.zip |
Diffstat (limited to 'testing/gptworldai_test.py')
-rw-r--r-- | testing/gptworldai_test.py | 18 |
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}) |