Raju Komati commited on
Commit
2200e77
1 Parent(s): 95fa113

updated the bot names in poe

Browse files
Files changed (2) hide show
  1. quora/README.md +6 -1
  2. quora/__init__.py +17 -10
quora/README.md CHANGED
@@ -52,7 +52,12 @@ print(response.completion.choices[0].text)
52
  ```python
53
  from quora import Poe
54
 
55
- poe = Poe(model='sage')
 
 
56
  poe.chat('who won the football world cup most?')
57
 
 
 
 
58
  ```
 
52
  ```python
53
  from quora import Poe
54
 
55
+ # available models: ['Sage', 'GPT-4', 'Claude+', 'Claude-instant', 'ChatGPT', 'Dragonfly', 'NeevaAI']
56
+
57
+ poe = Poe(model='gpt-3.5-turbo')
58
  poe.chat('who won the football world cup most?')
59
 
60
+ # new bot creation
61
+ poe.create_bot('new_bot_name', prompt='You are new test bot', base_model='gpt-3.5-turbo')
62
+
63
  ```
quora/__init__.py CHANGED
@@ -6,6 +6,7 @@ from pathlib import Path
6
  from random import choice, choices, randint
7
  from re import search, findall
8
  from string import ascii_letters, digits
 
9
  from urllib.parse import unquote
10
 
11
  import selenium.webdriver.support.expected_conditions as EC
@@ -18,17 +19,18 @@ from tls_client import Session as TLS
18
 
19
  from quora.api import Client as PoeClient
20
  from quora.mail import Emailnator
21
- from typing import Optional
22
 
23
  # from twocaptcha import TwoCaptcha
24
  # solver = TwoCaptcha('72747bf24a9d89b4dcc1b24875efd358')
25
 
26
  MODELS = {
27
- "sage": "capybara",
28
- "gpt-4": "beaver",
29
- "claude-v1.2": "a2_2",
30
- "claude-instant-v1.0": "a2",
31
- "gpt-3.5-turbo": "chinchilla",
 
 
32
  }
33
 
34
 
@@ -377,7 +379,7 @@ class Completion:
377
 
378
 
379
  class Poe:
380
- def __init__(self, model: str = "gpt-3.5-turbo"):
381
  self.cookie = self.__load_cookie()
382
  self.model = MODELS[model]
383
  self.client = PoeClient(self.cookie)
@@ -441,7 +443,7 @@ class Poe:
441
  return cookie
442
 
443
  def chat(self, message: str, model: Optional[str] = None) -> str:
444
- model = model or self.model
445
  response = None
446
  for chunk in self.client.send_message(model, message):
447
  response = chunk["text"]
@@ -452,11 +454,13 @@ class Poe:
452
  name: str,
453
  /,
454
  prompt: str = "",
455
- base_model: str = "gpt-3.5-turbo",
456
  description: str = "",
457
  ) -> None:
458
  if base_model not in MODELS:
459
- raise RuntimeError('Sorry, the base_model you provided does not exist. Please check and try again.')
 
 
460
 
461
  response = self.client.create_bot(
462
  handle=name,
@@ -465,3 +469,6 @@ class Poe:
465
  description=description,
466
  )
467
  print(f'Successfully created bot with name: {response["bot"]["displayName"]}')
 
 
 
 
6
  from random import choice, choices, randint
7
  from re import search, findall
8
  from string import ascii_letters, digits
9
+ from typing import Optional
10
  from urllib.parse import unquote
11
 
12
  import selenium.webdriver.support.expected_conditions as EC
 
19
 
20
  from quora.api import Client as PoeClient
21
  from quora.mail import Emailnator
 
22
 
23
  # from twocaptcha import TwoCaptcha
24
  # solver = TwoCaptcha('72747bf24a9d89b4dcc1b24875efd358')
25
 
26
  MODELS = {
27
+ "Sage": "capybara",
28
+ "GPT-4": "beaver",
29
+ "Claude+": "a2_2",
30
+ "Claude-instant": "a2",
31
+ "ChatGPT": "chinchilla",
32
+ "Dragonfly": "nutria",
33
+ "NeevaAI": "hutia",
34
  }
35
 
36
 
 
379
 
380
 
381
  class Poe:
382
+ def __init__(self, model: str = "ChatGPT"):
383
  self.cookie = self.__load_cookie()
384
  self.model = MODELS[model]
385
  self.client = PoeClient(self.cookie)
 
443
  return cookie
444
 
445
  def chat(self, message: str, model: Optional[str] = None) -> str:
446
+ model = MODELS[model] or self.model
447
  response = None
448
  for chunk in self.client.send_message(model, message):
449
  response = chunk["text"]
 
454
  name: str,
455
  /,
456
  prompt: str = "",
457
+ base_model: str = "ChatGPT",
458
  description: str = "",
459
  ) -> None:
460
  if base_model not in MODELS:
461
+ raise RuntimeError(
462
+ "Sorry, the base_model you provided does not exist. Please check and try again."
463
+ )
464
 
465
  response = self.client.create_bot(
466
  handle=name,
 
469
  description=description,
470
  )
471
  print(f'Successfully created bot with name: {response["bot"]["displayName"]}')
472
+
473
+ def list_bots(self) -> list:
474
+ return list(self.client.bot_names.values())