summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorxtekky <98614666+xtekky@users.noreply.github.com>2023-05-18 11:33:31 +0200
committerGitHub <noreply@github.com>2023-05-18 11:33:31 +0200
commit2e4bce90b2dab34cc9a37780b47bce43e339b4f7 (patch)
tree4b1af55c7e085b10c4ab955c109bfe6c988936d2 /testing
parentcountdown (diff)
parentadd references to deepai to the main readme (diff)
downloadgpt4free-2e4bce90b2dab34cc9a37780b47bce43e339b4f7.tar
gpt4free-2e4bce90b2dab34cc9a37780b47bce43e339b4f7.tar.gz
gpt4free-2e4bce90b2dab34cc9a37780b47bce43e339b4f7.tar.bz2
gpt4free-2e4bce90b2dab34cc9a37780b47bce43e339b4f7.tar.lz
gpt4free-2e4bce90b2dab34cc9a37780b47bce43e339b4f7.tar.xz
gpt4free-2e4bce90b2dab34cc9a37780b47bce43e339b4f7.tar.zst
gpt4free-2e4bce90b2dab34cc9a37780b47bce43e339b4f7.zip
Diffstat (limited to 'testing')
-rw-r--r--testing/deepai_test.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/testing/deepai_test.py b/testing/deepai_test.py
new file mode 100644
index 00000000..474f663e
--- /dev/null
+++ b/testing/deepai_test.py
@@ -0,0 +1,18 @@
+from gpt4free import deepai
+
+#single completion
+for chunk in deepai.Completion.create("Write a list of possible vacation destinations:"):
+ print(chunk, end="", flush=True)
+print()
+
+#chat completion
+print("==============")
+messages = [ #taken from the openai docs
+ {"role": "system", "content": "You are a helpful assistant."},
+ {"role": "user", "content": "Who won the world series in 2020?"},
+ {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
+ {"role": "user", "content": "Where was it played?"}
+]
+for chunk in deepai.ChatCompletion.create(messages):
+ print(chunk, end="", flush=True)
+print() \ No newline at end of file