summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/DeepInfraChat.py
diff options
context:
space:
mode:
authorkqlio67 <kqlio67@users.noreply.github.com>2024-11-06 16:25:09 +0100
committerkqlio67 <kqlio67@users.noreply.github.com>2024-11-06 16:25:09 +0100
commite98793d0a7af43878cf023fb045dd945a82507cf (patch)
tree205f2318755db4c7ad41a6d13e735c5d48e1450b /g4f/Provider/DeepInfraChat.py
parentUpdate (g4f/Provider/DeepInfra.py g4f/Provider/__init__.py g4f/Provider/needs_auth/) (diff)
downloadgpt4free-e98793d0a7af43878cf023fb045dd945a82507cf.tar
gpt4free-e98793d0a7af43878cf023fb045dd945a82507cf.tar.gz
gpt4free-e98793d0a7af43878cf023fb045dd945a82507cf.tar.bz2
gpt4free-e98793d0a7af43878cf023fb045dd945a82507cf.tar.lz
gpt4free-e98793d0a7af43878cf023fb045dd945a82507cf.tar.xz
gpt4free-e98793d0a7af43878cf023fb045dd945a82507cf.tar.zst
gpt4free-e98793d0a7af43878cf023fb045dd945a82507cf.zip
Diffstat (limited to 'g4f/Provider/DeepInfraChat.py')
-rw-r--r--g4f/Provider/DeepInfraChat.py57
1 files changed, 7 insertions, 50 deletions
diff --git a/g4f/Provider/DeepInfraChat.py b/g4f/Provider/DeepInfraChat.py
index b8cc6ab8..5c668599 100644
--- a/g4f/Provider/DeepInfraChat.py
+++ b/g4f/Provider/DeepInfraChat.py
@@ -6,7 +6,6 @@ import json
from ..typing import AsyncResult, Messages, ImageType
from ..image import to_data_uri
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
-from .helper import format_prompt
class DeepInfraChat(AsyncGeneratorProvider, ProviderModelMixin):
@@ -17,42 +16,18 @@ class DeepInfraChat(AsyncGeneratorProvider, ProviderModelMixin):
supports_system_message = True
supports_message_history = True
- default_model = 'meta-llama/Meta-Llama-3.1-70B-Instruct'
+ default_model = 'meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo'
models = [
- 'meta-llama/Meta-Llama-3.1-405B-Instruct',
- 'meta-llama/Meta-Llama-3.1-70B-Instruct',
'meta-llama/Meta-Llama-3.1-8B-Instruct',
- 'mistralai/Mixtral-8x22B-Instruct-v0.1',
- 'mistralai/Mixtral-8x7B-Instruct-v0.1',
+ default_model,
'microsoft/WizardLM-2-8x22B',
- 'microsoft/WizardLM-2-7B',
- 'Qwen/Qwen2-72B-Instruct',
- 'microsoft/Phi-3-medium-4k-instruct',
- 'google/gemma-2-27b-it',
- 'openbmb/MiniCPM-Llama3-V-2_5', # Image upload is available
- 'mistralai/Mistral-7B-Instruct-v0.3',
- 'lizpreciatior/lzlv_70b_fp16_hf',
- 'openchat/openchat-3.6-8b',
- 'Phind/Phind-CodeLlama-34B-v2',
- 'cognitivecomputations/dolphin-2.9.1-llama-3-70b',
+ 'Qwen/Qwen2.5-72B-Instruct',
]
model_aliases = {
- "llama-3.1-405b": "meta-llama/Meta-Llama-3.1-405B-Instruct",
- "llama-3.1-70b": "meta-llama/Meta-Llama-3.1-70B-Instruct",
- "llama-3.1-8B": "meta-llama/Meta-Llama-3.1-8B-Instruct",
- "mixtral-8x22b": "mistralai/Mixtral-8x22B-Instruct-v0.1",
- "mixtral-8x7b": "mistralai/Mixtral-8x7B-Instruct-v0.1",
+ "llama-3.1-8b": "meta-llama/Meta-Llama-3.1-8B-Instruct",
+ "llama-3.1-70b": "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
"wizardlm-2-8x22b": "microsoft/WizardLM-2-8x22B",
- "wizardlm-2-7b": "microsoft/WizardLM-2-7B",
- "qwen-2-72b": "Qwen/Qwen2-72B-Instruct",
- "phi-3-medium-4k": "microsoft/Phi-3-medium-4k-instruct",
- "gemma-2b-27b": "google/gemma-2-27b-it",
- "minicpm-llama-3-v2.5": "openbmb/MiniCPM-Llama3-V-2_5", # Image upload is available
- "mistral-7b": "mistralai/Mistral-7B-Instruct-v0.3",
- "lzlv-70b": "lizpreciatior/lzlv_70b_fp16_hf",
- "openchat-3.6-8b": "openchat/openchat-3.6-8b",
- "phind-codellama-34b-v2": "Phind/Phind-CodeLlama-34B-v2",
- "dolphin-2.9.1-llama-3-70b": "cognitivecomputations/dolphin-2.9.1-llama-3-70b",
+ "qwen-2-72b": "Qwen/Qwen2.5-72B-Instruct",
}
@@ -97,30 +72,12 @@ class DeepInfraChat(AsyncGeneratorProvider, ProviderModelMixin):
}
async with ClientSession(headers=headers) as session:
- prompt = format_prompt(messages)
data = {
'model': model,
- 'messages': [
- {'role': 'system', 'content': 'Be a helpful assistant'},
- {'role': 'user', 'content': prompt}
- ],
+ 'messages': messages,
'stream': True
}
- if model == 'openbmb/MiniCPM-Llama3-V-2_5' and image is not None:
- data['messages'][-1]['content'] = [
- {
- 'type': 'image_url',
- 'image_url': {
- 'url': to_data_uri(image)
- }
- },
- {
- 'type': 'text',
- 'text': messages[-1]['content']
- }
- ]
-
async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response:
response.raise_for_status()
async for line in response.content: