summaryrefslogtreecommitdiffstats
path: root/openai_rev/openai_rev.py
diff options
context:
space:
mode:
authorRaju Komati <komatiraju032@gmail.com>2023-04-27 21:10:43 +0200
committerRaju Komati <komatiraju032@gmail.com>2023-04-27 21:10:43 +0200
commit920fe19608ba06ed8c2b4c9a23944af35cf24e56 (patch)
treeaf356603b7918af1ea5cdfe0c48830a599ee5903 /openai_rev/openai_rev.py
parentUpdate README.md (diff)
downloadgpt4free-920fe19608ba06ed8c2b4c9a23944af35cf24e56.tar
gpt4free-920fe19608ba06ed8c2b4c9a23944af35cf24e56.tar.gz
gpt4free-920fe19608ba06ed8c2b4c9a23944af35cf24e56.tar.bz2
gpt4free-920fe19608ba06ed8c2b4c9a23944af35cf24e56.tar.lz
gpt4free-920fe19608ba06ed8c2b4c9a23944af35cf24e56.tar.xz
gpt4free-920fe19608ba06ed8c2b4c9a23944af35cf24e56.tar.zst
gpt4free-920fe19608ba06ed8c2b4c9a23944af35cf24e56.zip
Diffstat (limited to '')
-rw-r--r--openai_rev/openai_rev.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/openai_rev/openai_rev.py b/openai_rev/openai_rev.py
new file mode 100644
index 00000000..6e1341c7
--- /dev/null
+++ b/openai_rev/openai_rev.py
@@ -0,0 +1,35 @@
+from enum import Enum
+
+import quora
+import you
+
+
+class Provider(Enum):
+ You = 'you'
+ Poe = 'poe'
+
+
+class Completion:
+ @staticmethod
+ def create(provider: Provider, prompt: str, **kwargs):
+ if provider == Provider.Poe:
+ return Completion.__poe_service(prompt, **kwargs)
+ elif provider == Provider.You:
+ return Completion.__you_service(prompt, **kwargs)
+
+ @classmethod
+ def __you_service(cls, prompt: str, **kwargs) -> str:
+ return you.Completion.create(prompt).text
+
+ @classmethod
+ def __poe_service(cls, prompt: str, **kwargs) -> str:
+ return quora.Completion.create(prompt=prompt).text
+
+
+# usage You
+response = Completion.create(Provider.You, prompt='Write a poem on Lionel Messi')
+print(response)
+
+# usage Poe
+response = Completion.create(Provider.Poe, prompt='Write a poem on Lionel Messi', token='GKzCahZYGKhp76LfE197xw==')
+print(response)