diff options
author | Raju Komati <komatiraju032@gmail.com> | 2023-04-24 09:43:41 +0200 |
---|---|---|
committer | Raju Komati <komatiraju032@gmail.com> | 2023-04-24 09:57:25 +0200 |
commit | 95fa113a60ba60ce5dd6d3c275a75b0d1e071449 (patch) | |
tree | 8161bcf2b329d8da46c6edf631cc927e7647364b | |
parent | updated type hint (diff) | |
download | gpt4free-95fa113a60ba60ce5dd6d3c275a75b0d1e071449.tar gpt4free-95fa113a60ba60ce5dd6d3c275a75b0d1e071449.tar.gz gpt4free-95fa113a60ba60ce5dd6d3c275a75b0d1e071449.tar.bz2 gpt4free-95fa113a60ba60ce5dd6d3c275a75b0d1e071449.tar.lz gpt4free-95fa113a60ba60ce5dd6d3c275a75b0d1e071449.tar.xz gpt4free-95fa113a60ba60ce5dd6d3c275a75b0d1e071449.tar.zst gpt4free-95fa113a60ba60ce5dd6d3c275a75b0d1e071449.zip |
Diffstat (limited to '')
-rw-r--r-- | quora/__init__.py | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/quora/__init__.py b/quora/__init__.py index 14640f68..e739ee3c 100644 --- a/quora/__init__.py +++ b/quora/__init__.py @@ -377,7 +377,7 @@ class Completion: class Poe: - def __init__(self, model: str = "sage"): + def __init__(self, model: str = "gpt-3.5-turbo"): self.cookie = self.__load_cookie() self.model = MODELS[model] self.client = PoeClient(self.cookie) @@ -402,7 +402,7 @@ class Poe: print(mail_address) options = webdriver.FirefoxOptions() - options.add_argument("-headless") + # options.add_argument("-headless") driver = webdriver.Firefox(options=options) driver.get("https://www.poe.com") @@ -440,9 +440,28 @@ class Poe: driver.close() return cookie - def chat(self, message: str): + def chat(self, message: str, model: Optional[str] = None) -> str: + model = model or self.model response = None - for chunk in self.client.send_message(self.model, message): + for chunk in self.client.send_message(model, message): response = chunk["text"] - return response + + def create_bot( + self, + name: str, + /, + prompt: str = "", + base_model: str = "gpt-3.5-turbo", + description: str = "", + ) -> None: + if base_model not in MODELS: + raise RuntimeError('Sorry, the base_model you provided does not exist. Please check and try again.') + + response = self.client.create_bot( + handle=name, + prompt=prompt, + base_model=MODELS[base_model], + description=description, + ) + print(f'Successfully created bot with name: {response["bot"]["displayName"]}') |