summaryrefslogtreecommitdiffstats
path: root/openai_rev/openai_rev.py
diff options
context:
space:
mode:
authorRaju Komati <komatiraju032@gmail.com>2023-04-27 22:57:06 +0200
committerRaju Komati <komatiraju032@gmail.com>2023-04-27 22:57:06 +0200
commitb206a1eb6364e519741ceb89e3f3b63910b4e1ef (patch)
treea5b02f50f60f4e307fa719f053b88f5df478b4e3 /openai_rev/openai_rev.py
parentadded main module for accessing all services (diff)
downloadgpt4free-b206a1eb6364e519741ceb89e3f3b63910b4e1ef.tar
gpt4free-b206a1eb6364e519741ceb89e3f3b63910b4e1ef.tar.gz
gpt4free-b206a1eb6364e519741ceb89e3f3b63910b4e1ef.tar.bz2
gpt4free-b206a1eb6364e519741ceb89e3f3b63910b4e1ef.tar.lz
gpt4free-b206a1eb6364e519741ceb89e3f3b63910b4e1ef.tar.xz
gpt4free-b206a1eb6364e519741ceb89e3f3b63910b4e1ef.tar.zst
gpt4free-b206a1eb6364e519741ceb89e3f3b63910b4e1ef.zip
Diffstat (limited to 'openai_rev/openai_rev.py')
-rw-r--r--openai_rev/openai_rev.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/openai_rev/openai_rev.py b/openai_rev/openai_rev.py
index 6e1341c7..7d483c01 100644
--- a/openai_rev/openai_rev.py
+++ b/openai_rev/openai_rev.py
@@ -1,12 +1,14 @@
from enum import Enum
-import quora
-import you
+from openai_rev import forefront
+from openai_rev import quora
+from openai_rev import you
class Provider(Enum):
You = 'you'
Poe = 'poe'
+ ForeFront = 'fore_front'
class Completion:
@@ -16,20 +18,17 @@ class Completion:
return Completion.__poe_service(prompt, **kwargs)
elif provider == Provider.You:
return Completion.__you_service(prompt, **kwargs)
+ elif provider == Provider.ForeFront:
+ return Completion.__fore_front_service(prompt, **kwargs)
@classmethod
def __you_service(cls, prompt: str, **kwargs) -> str:
- return you.Completion.create(prompt).text
+ return you.Completion.create(prompt, **kwargs).text
@classmethod
def __poe_service(cls, prompt: str, **kwargs) -> str:
- return quora.Completion.create(prompt=prompt).text
+ return quora.Completion.create(prompt=prompt, **kwargs).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)
+ @classmethod
+ def __fore_front_service(cls, prompt: str, **kwargs) -> str:
+ return forefront.Completion.create(prompt=prompt, **kwargs).text