summaryrefslogtreecommitdiffstats
path: root/g4f
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-11-18 11:35:26 +0100
committerGitHub <noreply@github.com>2024-11-18 11:35:26 +0100
commit56beb19fef7f18bddde81082c7af0f96c6c51be4 (patch)
tree926386f38f4adec4a3b9ee78a341887b455800a3 /g4f
parentUpdate HuggingChat.py (diff)
downloadgpt4free-56beb19fef7f18bddde81082c7af0f96c6c51be4.tar
gpt4free-56beb19fef7f18bddde81082c7af0f96c6c51be4.tar.gz
gpt4free-56beb19fef7f18bddde81082c7af0f96c6c51be4.tar.bz2
gpt4free-56beb19fef7f18bddde81082c7af0f96c6c51be4.tar.lz
gpt4free-56beb19fef7f18bddde81082c7af0f96c6c51be4.tar.xz
gpt4free-56beb19fef7f18bddde81082c7af0f96c6c51be4.tar.zst
gpt4free-56beb19fef7f18bddde81082c7af0f96c6c51be4.zip
Diffstat (limited to 'g4f')
-rw-r--r--g4f/Provider/Blackbox.py31
1 files changed, 7 insertions, 24 deletions
diff --git a/g4f/Provider/Blackbox.py b/g4f/Provider/Blackbox.py
index 8d820344..75abb183 100644
--- a/g4f/Provider/Blackbox.py
+++ b/g4f/Provider/Blackbox.py
@@ -20,17 +20,14 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
supports_system_message = True
supports_message_history = True
_last_validated_value = None
-
+
default_model = 'blackboxai'
-
- image_models = ['Image Generation', 'repomap']
-
- userSelectedModel = ['gpt-4o', 'gemini-pro', 'claude-sonnet-3.5', 'blackboxai-pro']
-
+ default_image_model = 'generate_image'
+ image_models = [default_image_model, 'repomap']
+ text_models = [default_model, 'gpt-4o', 'gemini-pro', 'claude-sonnet-3.5', 'blackboxai-pro']
agentMode = {
'Image Generation': {'mode': True, 'id': "ImageGenerationLV45LJp", 'name': "Image Generation"},
}
-
trendingAgentMode = {
"gemini-1.5-flash": {'mode': True, 'id': 'Gemini'},
"llama-3.1-8b": {'mode': True, 'id': "llama-3.1-8b"},
@@ -72,12 +69,8 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
'Youtube Agent': {'mode': True, 'id': "Youtube Agent"},
'builder Agent': {'mode': True, 'id': "builder Agent"},
}
-
model_prefixes = {mode: f"@{value['id']}" for mode, value in trendingAgentMode.items() if mode not in ["gemini-1.5-flash", "llama-3.1-8b", "llama-3.1-70b", "llama-3.1-405b", "repomap"]}
-
-
- models = [default_model, *userSelectedModel, *list(agentMode.keys()), *list(trendingAgentMode.keys())]
-
+ models = [*text_models, default_image_model, *list(trendingAgentMode.keys())]
model_aliases = {
"gemini-flash": "gemini-1.5-flash",
"claude-3.5-sonnet": "claude-sonnet-3.5",
@@ -118,12 +111,11 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
return cls._last_validated_value
-
@staticmethod
def generate_id(length=7):
characters = string.ascii_letters + string.digits
return ''.join(random.choice(characters) for _ in range(length))
-
+
@classmethod
def add_prefix_to_messages(cls, messages: Messages, model: str) -> Messages:
prefix = cls.model_prefixes.get(model, "")
@@ -140,15 +132,6 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
return new_messages
@classmethod
- def get_model(cls, model: str) -> str:
- if model in cls.models:
- return model
- elif model in cls.model_aliases:
- return cls.model_aliases[model]
- else:
- return cls.default_model
-
- @classmethod
async def create_async_generator(
cls,
model: str,
@@ -209,7 +192,7 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
"clickedForceWebSearch": False,
"visitFromDelta": False,
"mobileClient": False,
- "userSelectedModel": model if model in cls.userSelectedModel else None,
+ "userSelectedModel": model if model in cls.text_models else None,
"webSearchMode": web_search,
"validated": validated_value,
}