diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-04-22 01:35:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-22 01:35:07 +0200 |
commit | 4b4d1f08b5c75c8c8932b5edfbb0d020f8e029a7 (patch) | |
tree | 6ed0cfc6cd53a3ab32565d6199a929ac1ea6ad80 /g4f/providers | |
parent | Merge pull request #1869 from hlohaus/carst (diff) | |
parent | Add vision models to readme (diff) | |
download | gpt4free-4b4d1f08b5c75c8c8932b5edfbb0d020f8e029a7.tar gpt4free-4b4d1f08b5c75c8c8932b5edfbb0d020f8e029a7.tar.gz gpt4free-4b4d1f08b5c75c8c8932b5edfbb0d020f8e029a7.tar.bz2 gpt4free-4b4d1f08b5c75c8c8932b5edfbb0d020f8e029a7.tar.lz gpt4free-4b4d1f08b5c75c8c8932b5edfbb0d020f8e029a7.tar.xz gpt4free-4b4d1f08b5c75c8c8932b5edfbb0d020f8e029a7.tar.zst gpt4free-4b4d1f08b5c75c8c8932b5edfbb0d020f8e029a7.zip |
Diffstat (limited to 'g4f/providers')
-rw-r--r-- | g4f/providers/base_provider.py | 4 | ||||
-rw-r--r-- | g4f/providers/helper.py | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/g4f/providers/base_provider.py b/g4f/providers/base_provider.py index 685a6f98..5624c9e1 100644 --- a/g4f/providers/base_provider.py +++ b/g4f/providers/base_provider.py @@ -271,13 +271,13 @@ class AsyncGeneratorProvider(AsyncProvider): raise NotImplementedError() class ProviderModelMixin: - default_model: str + default_model: str = None models: list[str] = [] model_aliases: dict[str, str] = {} @classmethod def get_models(cls) -> list[str]: - if not cls.models: + if not cls.models and cls.default_model is not None: return [cls.default_model] return cls.models diff --git a/g4f/providers/helper.py b/g4f/providers/helper.py index 0ec9aac2..7ebe0d02 100644 --- a/g4f/providers/helper.py +++ b/g4f/providers/helper.py @@ -3,7 +3,7 @@ from __future__ import annotations import random import string -from ..typing import Messages +from ..typing import Messages, Cookies def format_prompt(messages: Messages, add_special_tokens=False) -> str: """ @@ -56,4 +56,7 @@ def filter_none(**kwargs) -> dict: key: value for key, value in kwargs.items() if value is not None - }
\ No newline at end of file + } + +def format_cookies(cookies: Cookies) -> str: + return "; ".join([f"{k}={v}" for k, v in cookies.items()])
\ No newline at end of file |