summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/needs_auth
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--g4f/Provider/needs_auth/DeepInfraImage.py (renamed from g4f/Provider/DeepInfraImage.py)8
-rw-r--r--g4f/Provider/needs_auth/HuggingFace.py (renamed from g4f/Provider/HuggingFace.py)12
-rw-r--r--g4f/Provider/needs_auth/MetaAI.py (renamed from g4f/Provider/MetaAI.py)12
-rw-r--r--g4f/Provider/needs_auth/MetaAIAccount.py (renamed from g4f/Provider/MetaAIAccount.py)8
-rw-r--r--g4f/Provider/needs_auth/OpenRouter.py32
-rw-r--r--g4f/Provider/needs_auth/Replicate.py (renamed from g4f/Provider/Replicate.py)14
-rw-r--r--g4f/Provider/needs_auth/__init__.py8
-rw-r--r--g4f/Provider/needs_auth/gigachat/GigaChat.py (renamed from g4f/Provider/gigachat/GigaChat.py)8
-rw-r--r--g4f/Provider/needs_auth/gigachat/__init__.py (renamed from g4f/Provider/gigachat/__init__.py)0
-rw-r--r--g4f/Provider/needs_auth/gigachat/russian_trusted_root_ca_pem.crt (renamed from g4f/Provider/gigachat/russian_trusted_root_ca_pem.crt)0
10 files changed, 38 insertions, 64 deletions
diff --git a/g4f/Provider/DeepInfraImage.py b/g4f/Provider/needs_auth/DeepInfraImage.py
index cee608ce..2310c1c8 100644
--- a/g4f/Provider/DeepInfraImage.py
+++ b/g4f/Provider/needs_auth/DeepInfraImage.py
@@ -2,10 +2,10 @@ from __future__ import annotations
import requests
-from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
-from ..typing import AsyncResult, Messages
-from ..requests import StreamSession, raise_for_status
-from ..image import ImageResponse
+from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
+from ...typing import AsyncResult, Messages
+from ...requests import StreamSession, raise_for_status
+from ...image import ImageResponse
class DeepInfraImage(AsyncGeneratorProvider, ProviderModelMixin):
url = "https://deepinfra.com"
diff --git a/g4f/Provider/HuggingFace.py b/g4f/Provider/needs_auth/HuggingFace.py
index 586e5f5f..ecc75d1c 100644
--- a/g4f/Provider/HuggingFace.py
+++ b/g4f/Provider/needs_auth/HuggingFace.py
@@ -3,13 +3,13 @@ from __future__ import annotations
import json
from aiohttp import ClientSession, BaseConnector
-from ..typing import AsyncResult, Messages
-from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
-from .helper import get_connector
-from ..errors import RateLimitError, ModelNotFoundError
-from ..requests.raise_for_status import raise_for_status
+from ...typing import AsyncResult, Messages
+from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
+from ..helper import get_connector
+from ...errors import RateLimitError, ModelNotFoundError
+from ...requests.raise_for_status import raise_for_status
-from .HuggingChat import HuggingChat
+from ..HuggingChat import HuggingChat
class HuggingFace(AsyncGeneratorProvider, ProviderModelMixin):
url = "https://huggingface.co/chat"
diff --git a/g4f/Provider/MetaAI.py b/g4f/Provider/needs_auth/MetaAI.py
index 218b7ebb..4b730abd 100644
--- a/g4f/Provider/MetaAI.py
+++ b/g4f/Provider/needs_auth/MetaAI.py
@@ -8,12 +8,12 @@ from typing import Dict, List
from aiohttp import ClientSession, BaseConnector
-from ..typing import AsyncResult, Messages, Cookies
-from ..requests import raise_for_status, DEFAULT_HEADERS
-from ..image import ImageResponse, ImagePreview
-from ..errors import ResponseError
-from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
-from .helper import format_prompt, get_connector, format_cookies
+from ...typing import AsyncResult, Messages, Cookies
+from ...requests import raise_for_status, DEFAULT_HEADERS
+from ...image import ImageResponse, ImagePreview
+from ...errors import ResponseError
+from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
+from ..helper import format_prompt, get_connector, format_cookies
class Sources():
def __init__(self, link_list: List[Dict[str, str]]) -> None:
diff --git a/g4f/Provider/MetaAIAccount.py b/g4f/Provider/needs_auth/MetaAIAccount.py
index 369b3f2f..2d54f3e0 100644
--- a/g4f/Provider/MetaAIAccount.py
+++ b/g4f/Provider/needs_auth/MetaAIAccount.py
@@ -1,8 +1,8 @@
from __future__ import annotations
-from ..typing import AsyncResult, Messages, Cookies
-from .helper import format_prompt, get_cookies
-from .MetaAI import MetaAI
+from ...typing import AsyncResult, Messages, Cookies
+from ..helper import format_prompt, get_cookies
+from ..MetaAI import MetaAI
class MetaAIAccount(MetaAI):
needs_auth = True
@@ -20,4 +20,4 @@ class MetaAIAccount(MetaAI):
) -> AsyncResult:
cookies = get_cookies(".meta.ai", True, True) if cookies is None else cookies
async for chunk in cls(proxy).prompt(format_prompt(messages), cookies):
- yield chunk \ No newline at end of file
+ yield chunk
diff --git a/g4f/Provider/needs_auth/OpenRouter.py b/g4f/Provider/needs_auth/OpenRouter.py
deleted file mode 100644
index 5e0bf336..00000000
--- a/g4f/Provider/needs_auth/OpenRouter.py
+++ /dev/null
@@ -1,32 +0,0 @@
-from __future__ import annotations
-
-import requests
-
-from .Openai import Openai
-from ...typing import AsyncResult, Messages
-
-class OpenRouter(Openai):
- label = "OpenRouter"
- url = "https://openrouter.ai"
- working = False
- default_model = "mistralai/mistral-7b-instruct:free"
-
- @classmethod
- def get_models(cls):
- if not cls.models:
- url = 'https://openrouter.ai/api/v1/models'
- models = requests.get(url).json()["data"]
- cls.models = [model['id'] for model in models]
- return cls.models
-
- @classmethod
- def create_async_generator(
- cls,
- model: str,
- messages: Messages,
- api_base: str = "https://openrouter.ai/api/v1",
- **kwargs
- ) -> AsyncResult:
- return super().create_async_generator(
- model, messages, api_base=api_base, **kwargs
- )
diff --git a/g4f/Provider/Replicate.py b/g4f/Provider/needs_auth/Replicate.py
index 7ff8ad65..ec993aa4 100644
--- a/g4f/Provider/Replicate.py
+++ b/g4f/Provider/needs_auth/Replicate.py
@@ -1,11 +1,11 @@
from __future__ import annotations
-from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
-from .helper import format_prompt, filter_none
-from ..typing import AsyncResult, Messages
-from ..requests import raise_for_status
-from ..requests.aiohttp import StreamSession
-from ..errors import ResponseError, MissingAuthError
+from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
+from ..helper import format_prompt, filter_none
+from ...typing import AsyncResult, Messages
+from ...requests import raise_for_status
+from ...requests.aiohttp import StreamSession
+from ...errors import ResponseError, MissingAuthError
class Replicate(AsyncGeneratorProvider, ProviderModelMixin):
url = "https://replicate.com"
@@ -85,4 +85,4 @@ class Replicate(AsyncGeneratorProvider, ProviderModelMixin):
if new_text:
yield new_text
else:
- yield "\n" \ No newline at end of file
+ yield "\n"
diff --git a/g4f/Provider/needs_auth/__init__.py b/g4f/Provider/needs_auth/__init__.py
index aa3547a5..0626a837 100644
--- a/g4f/Provider/needs_auth/__init__.py
+++ b/g4f/Provider/needs_auth/__init__.py
@@ -1,4 +1,7 @@
+from .gigachat import *
+
from .DeepInfra import DeepInfra
+from .DeepInfraImage import DeepInfraImage
from .Gemini import Gemini
from .Raycast import Raycast
from .Theb import Theb
@@ -7,6 +10,9 @@ from .OpenaiChat import OpenaiChat
from .Poe import Poe
from .Openai import Openai
from .Groq import Groq
-from .OpenRouter import OpenRouter
#from .OpenaiAccount import OpenaiAccount
from .PerplexityApi import PerplexityApi
+from .Replicate import Replicate
+from .MetaAI import MetaAI
+#from .MetaAIAccount import MetaAIAccount
+from .HuggingFace import HuggingFace
diff --git a/g4f/Provider/gigachat/GigaChat.py b/g4f/Provider/needs_auth/gigachat/GigaChat.py
index b1b293e3..c9f1c011 100644
--- a/g4f/Provider/gigachat/GigaChat.py
+++ b/g4f/Provider/needs_auth/gigachat/GigaChat.py
@@ -9,10 +9,10 @@ import json
from aiohttp import ClientSession, TCPConnector, BaseConnector
from g4f.requests import raise_for_status
-from ...typing import AsyncResult, Messages
-from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
-from ...errors import MissingAuthError
-from ..helper import get_connector
+from ....typing import AsyncResult, Messages
+from ...base_provider import AsyncGeneratorProvider, ProviderModelMixin
+from ....errors import MissingAuthError
+from ...helper import get_connector
access_token = ""
token_expires_at = 0
diff --git a/g4f/Provider/gigachat/__init__.py b/g4f/Provider/needs_auth/gigachat/__init__.py
index c9853742..c9853742 100644
--- a/g4f/Provider/gigachat/__init__.py
+++ b/g4f/Provider/needs_auth/gigachat/__init__.py
diff --git a/g4f/Provider/gigachat/russian_trusted_root_ca_pem.crt b/g4f/Provider/needs_auth/gigachat/russian_trusted_root_ca_pem.crt
index 4c143a21..4c143a21 100644
--- a/g4f/Provider/gigachat/russian_trusted_root_ca_pem.crt
+++ b/g4f/Provider/needs_auth/gigachat/russian_trusted_root_ca_pem.crt