mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-11-22 15:05:57 +03:00
Add gemini-1.5-pro-latest model
This commit is contained in:
parent
6a05a238d9
commit
6e064adb09
@ -404,11 +404,12 @@ While we wait for gpt-5, here is a list of new models that are at least better t
|
|||||||
|
|
||||||
| Label | Provider | Image Model | Vision Model | Website |
|
| Label | Provider | Image Model | Vision Model | Website |
|
||||||
| ----- | -------- | ----------- | ------------ | ------- |
|
| ----- | -------- | ----------- | ------------ | ------- |
|
||||||
| Microsoft Copilot in Bing | `g4f.Provider.Bing` | dall-e| gpt-4-vision | [bing.com](https://bing.com/chat) |
|
| Microsoft Copilot in Bing | `g4f.Provider.Bing` | dall-e-3 | gpt-4-vision | [bing.com](https://bing.com/chat) |
|
||||||
| DeepInfra | `g4f.Provider.DeepInfra` | stability-ai/sdxl| llava-1.5-7b-hf | [deepinfra.com](https://deepinfra.com) |
|
| DeepInfra | `g4f.Provider.DeepInfra` | stability-ai/sdxl| llava-1.5-7b-hf | [deepinfra.com](https://deepinfra.com) |
|
||||||
| Gemini | `g4f.Provider.Gemini` | gemini| gemini | [gemini.google.com](https://gemini.google.com) |
|
| Gemini | `g4f.Provider.Gemini` | gemini| gemini | [gemini.google.com](https://gemini.google.com) |
|
||||||
|
| Gemini API | `g4f.Provider.GeminiPro` | ❌| gemini-1.5-pro-latest | [ai.google.dev](https://ai.google.dev) |
|
||||||
| Meta AI | `g4f.Provider.MetaAI` | meta| ❌ | [meta.ai](https://www.meta.ai) |
|
| Meta AI | `g4f.Provider.MetaAI` | meta| ❌ | [meta.ai](https://www.meta.ai) |
|
||||||
| OpenAI ChatGPT | `g4f.Provider.OpenaiChat` | dall-e| gpt-4-vision | [chat.openai.com](https://chat.openai.com) |
|
| OpenAI ChatGPT | `g4f.Provider.OpenaiChat` | dall-e-3 | gpt-4-vision | [chat.openai.com](https://chat.openai.com) |
|
||||||
| Replicate | `g4f.Provider.Replicate` | stability-ai/sdxl| ❌ | [replicate.com](https://replicate.com) |
|
| Replicate | `g4f.Provider.Replicate` | stability-ai/sdxl| ❌ | [replicate.com](https://replicate.com) |
|
||||||
| You.com | `g4f.Provider.You` | dall-e| agent | [you.com](https://you.com) |
|
| You.com | `g4f.Provider.You` | dall-e| agent | [you.com](https://you.com) |
|
||||||
|
|
||||||
|
@ -136,6 +136,8 @@ def print_image_models():
|
|||||||
netloc = urlparse(provider_url).netloc.replace("www.", "")
|
netloc = urlparse(provider_url).netloc.replace("www.", "")
|
||||||
website = f"[{netloc}]({provider_url})"
|
website = f"[{netloc}]({provider_url})"
|
||||||
label = image_model["provider"] if image_model["label"] is None else image_model["label"]
|
label = image_model["provider"] if image_model["label"] is None else image_model["label"]
|
||||||
|
if image_model["image_model"] is None:
|
||||||
|
image_model["image_model"] = "❌"
|
||||||
if image_model["vision_model"] is None:
|
if image_model["vision_model"] is None:
|
||||||
image_model["vision_model"] = "❌"
|
image_model["vision_model"] = "❌"
|
||||||
lines.append(f'| {label} | `g4f.Provider.{image_model["provider"]}` | {image_model["image_model"]}| {image_model["vision_model"]} | {website} |')
|
lines.append(f'| {label} | `g4f.Provider.{image_model["provider"]}` | {image_model["image_model"]}| {image_model["vision_model"]} | {website} |')
|
||||||
|
@ -11,12 +11,14 @@ from ..errors import MissingAuthError
|
|||||||
from .helper import get_connector
|
from .helper import get_connector
|
||||||
|
|
||||||
class GeminiPro(AsyncGeneratorProvider, ProviderModelMixin):
|
class GeminiPro(AsyncGeneratorProvider, ProviderModelMixin):
|
||||||
|
label = "Gemini API"
|
||||||
url = "https://ai.google.dev"
|
url = "https://ai.google.dev"
|
||||||
working = True
|
working = True
|
||||||
supports_message_history = True
|
supports_message_history = True
|
||||||
needs_auth = True
|
needs_auth = True
|
||||||
default_model = "gemini-pro"
|
default_model = "gemini-1.5-pro-latest"
|
||||||
models = ["gemini-pro", "gemini-pro-vision"]
|
default_vision_model = default_model
|
||||||
|
models = [default_model, "gemini-pro", "gemini-pro-vision"]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def create_async_generator(
|
async def create_async_generator(
|
||||||
@ -32,11 +34,10 @@ class GeminiPro(AsyncGeneratorProvider, ProviderModelMixin):
|
|||||||
connector: BaseConnector = None,
|
connector: BaseConnector = None,
|
||||||
**kwargs
|
**kwargs
|
||||||
) -> AsyncResult:
|
) -> AsyncResult:
|
||||||
model = "gemini-pro-vision" if not model and image is not None else model
|
|
||||||
model = cls.get_model(model)
|
model = cls.get_model(model)
|
||||||
|
|
||||||
if not api_key:
|
if not api_key:
|
||||||
raise MissingAuthError('Missing "api_key"')
|
raise MissingAuthError('Add a "api_key"')
|
||||||
|
|
||||||
headers = params = None
|
headers = params = None
|
||||||
if use_auth_header:
|
if use_auth_header:
|
||||||
|
@ -130,11 +130,7 @@
|
|||||||
<textarea id="DeepInfra-api_key" name="DeepInfra[api_key]" class="DeepInfraImage-api_key" placeholder="api_key"></textarea>
|
<textarea id="DeepInfra-api_key" name="DeepInfra[api_key]" class="DeepInfraImage-api_key" placeholder="api_key"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="field box">
|
<div class="field box">
|
||||||
<label for="Gemini-api_key" class="label" title="">Gemini:</label>
|
<label for="GeminiPro-api_key" class="label" title="">Gemini API:</label>
|
||||||
<textarea id="Gemini-api_key" name="Gemini[api_key]" placeholder=""__Secure-1PSID" cookie"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="field box">
|
|
||||||
<label for="GeminiPro-api_key" class="label" title="">GeminiPro API:</label>
|
|
||||||
<textarea id="GeminiPro-api_key" name="GeminiPro[api_key]" placeholder="api_key"></textarea>
|
<textarea id="GeminiPro-api_key" name="GeminiPro[api_key]" placeholder="api_key"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="field box">
|
<div class="field box">
|
||||||
@ -157,6 +153,10 @@
|
|||||||
<label for="OpenRouter-api_key" class="label" title="">OpenRouter:</label>
|
<label for="OpenRouter-api_key" class="label" title="">OpenRouter:</label>
|
||||||
<textarea id="OpenRouter-api_key" name="OpenRouter[api_key]" placeholder="api_key"></textarea>
|
<textarea id="OpenRouter-api_key" name="OpenRouter[api_key]" placeholder="api_key"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field box">
|
||||||
|
<label for="Replicate-api_key" class="label" title="">Replicate:</label>
|
||||||
|
<textarea id="Replicate-api_key" name="Replicate[api_key]" class="ReplicateImage-api_key" placeholder="api_key"></textarea>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom_buttons">
|
<div class="bottom_buttons">
|
||||||
<button onclick="delete_conversations()">
|
<button onclick="delete_conversations()">
|
||||||
|
@ -45,6 +45,7 @@ class Api():
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def get_image_models() -> list[dict]:
|
def get_image_models() -> list[dict]:
|
||||||
image_models = []
|
image_models = []
|
||||||
|
index = []
|
||||||
for provider in __providers__:
|
for provider in __providers__:
|
||||||
if hasattr(provider, "image_models"):
|
if hasattr(provider, "image_models"):
|
||||||
if hasattr(provider, "get_models"):
|
if hasattr(provider, "get_models"):
|
||||||
@ -52,14 +53,25 @@ class Api():
|
|||||||
parent = provider
|
parent = provider
|
||||||
if hasattr(provider, "parent"):
|
if hasattr(provider, "parent"):
|
||||||
parent = __map__[provider.parent]
|
parent = __map__[provider.parent]
|
||||||
for model in provider.image_models:
|
if parent.__name__ not in index:
|
||||||
image_models.append({
|
for model in provider.image_models:
|
||||||
"provider": parent.__name__,
|
image_models.append({
|
||||||
"url": parent.url,
|
"provider": parent.__name__,
|
||||||
"label": parent.label if hasattr(parent, "label") else None,
|
"url": parent.url,
|
||||||
"image_model": model,
|
"label": parent.label if hasattr(parent, "label") else None,
|
||||||
"vision_model": parent.default_vision_model if hasattr(parent, "default_vision_model") else None
|
"image_model": model,
|
||||||
})
|
"vision_model": parent.default_vision_model if hasattr(parent, "default_vision_model") else None
|
||||||
|
})
|
||||||
|
index.append(parent.__name__)
|
||||||
|
elif hasattr(provider, "default_vision_model") and provider.__name__ not in index:
|
||||||
|
image_models.append({
|
||||||
|
"provider": provider.__name__,
|
||||||
|
"url": provider.url,
|
||||||
|
"label": provider.label if hasattr(provider, "label") else None,
|
||||||
|
"image_model": None,
|
||||||
|
"vision_model": provider.default_vision_model
|
||||||
|
})
|
||||||
|
index.append(provider.__name__)
|
||||||
return image_models
|
return image_models
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user