XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

updated the bot names in poe

2200e777
Raju Komati <komatiraju032@gmail.com>
提交于

代码差异

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