diff options
Diffstat (limited to 'openai_rev/openai_rev.py')
-rw-r--r-- | openai_rev/openai_rev.py | 35 |
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) |