diff options
author | Tekky <98614666+xtekky@users.noreply.github.com> | 2023-10-22 18:08:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-22 18:08:03 +0200 |
commit | d1eaa46360b7fe30d6f9c60f5a4af6246c24dc56 (patch) | |
tree | 9cc4e7401fdf42efdf6b42670acd3c2a72214ebf /g4f/Provider/Geekgpt.py | |
parent | ~ | Merge pull request #1112 from lategege/main (diff) | |
parent | Fix ChatgptAi Provider (diff) | |
download | gpt4free-d1eaa46360b7fe30d6f9c60f5a4af6246c24dc56.tar gpt4free-d1eaa46360b7fe30d6f9c60f5a4af6246c24dc56.tar.gz gpt4free-d1eaa46360b7fe30d6f9c60f5a4af6246c24dc56.tar.bz2 gpt4free-d1eaa46360b7fe30d6f9c60f5a4af6246c24dc56.tar.lz gpt4free-d1eaa46360b7fe30d6f9c60f5a4af6246c24dc56.tar.xz gpt4free-d1eaa46360b7fe30d6f9c60f5a4af6246c24dc56.tar.zst gpt4free-d1eaa46360b7fe30d6f9c60f5a4af6246c24dc56.zip |
Diffstat (limited to 'g4f/Provider/Geekgpt.py')
-rw-r--r-- | g4f/Provider/Geekgpt.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/g4f/Provider/Geekgpt.py b/g4f/Provider/Geekgpt.py index 1a82757c..3c577cf8 100644 --- a/g4f/Provider/Geekgpt.py +++ b/g4f/Provider/Geekgpt.py @@ -14,19 +14,23 @@ class GeekGpt(BaseProvider): supports_gpt_4 = True @classmethod - def create_completion(cls, - model: str, - messages: Messages, - stream: bool, **kwargs) -> CreateResult: - + def create_completion( + cls, + model: str, + messages: Messages, + stream: bool, + **kwargs + ) -> CreateResult: + if not model: + model = "gpt-3.5-turbo" json_data = { 'messages': messages, - 'model': model, - 'temperature': kwargs.get('temperature', 0.9), - 'presence_penalty': kwargs.get('presence_penalty', 0), - 'top_p': kwargs.get('top_p', 1), - 'frequency_penalty': kwargs.get('frequency_penalty', 0), - 'stream': True + 'model': model, + 'temperature': kwargs.get('temperature', 0.9), + 'presence_penalty': kwargs.get('presence_penalty', 0), + 'top_p': kwargs.get('top_p', 1), + 'frequency_penalty': kwargs.get('frequency_penalty', 0), + 'stream': True } data = dumps(json_data, separators=(',', ':')) @@ -61,7 +65,6 @@ class GeekGpt(BaseProvider): try: content = json.loads(json_data)["choices"][0]["delta"].get("content") - except Exception as e: raise RuntimeError(f'error | {e} :', json_data) |