diff options
Diffstat (limited to 'g4f')
-rw-r--r-- | g4f/Provider/needs_auth/Groq.py | 23 | ||||
-rw-r--r-- | g4f/api/__init__.py | 8 | ||||
-rw-r--r-- | g4f/cookies.py | 3 |
3 files changed, 31 insertions, 3 deletions
diff --git a/g4f/Provider/needs_auth/Groq.py b/g4f/Provider/needs_auth/Groq.py index d11f6a82..027d98bf 100644 --- a/g4f/Provider/needs_auth/Groq.py +++ b/g4f/Provider/needs_auth/Groq.py @@ -8,7 +8,26 @@ class Groq(Openai): url = "https://console.groq.com/playground" working = True default_model = "mixtral-8x7b-32768" - models = ["mixtral-8x7b-32768", "llama2-70b-4096", "gemma-7b-it"] + models = [ + "distil-whisper-large-v3-en", + "gemma2-9b-it", + "gemma-7b-it", + "llama3-groq-70b-8192-tool-use-preview", + "llama3-groq-8b-8192-tool-use-preview", + "llama-3.1-70b-versatile", + "llama-3.1-8b-instant", + "llama-3.2-1b-preview", + "llama-3.2-3b-preview", + "llama-3.2-11b-vision-preview", + "llama-3.2-90b-vision-preview", + "llama-guard-3-8b", + "llava-v1.5-7b-4096-preview", + "llama3-70b-8192", + "llama3-8b-8192", + "mixtral-8x7b-32768", + "whisper-large-v3", + "whisper-large-v3-turbo", + ] model_aliases = {"mixtral-8x7b": "mixtral-8x7b-32768", "llama2-70b": "llama2-70b-4096"} @classmethod @@ -21,4 +40,4 @@ class Groq(Openai): ) -> AsyncResult: return super().create_async_generator( model, messages, api_base=api_base, **kwargs - )
\ No newline at end of file + ) diff --git a/g4f/api/__init__.py b/g4f/api/__init__.py index da35319a..83df469a 100644 --- a/g4f/api/__init__.py +++ b/g4f/api/__init__.py @@ -12,6 +12,7 @@ from fastapi.security import APIKeyHeader from starlette.exceptions import HTTPException from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY, HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN from fastapi.encoders import jsonable_encoder +from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel from typing import Union, Optional @@ -24,6 +25,13 @@ from g4f.cookies import read_cookie_files def create_app(): app = FastAPI() api = Api(app) + app.add_middleware( + CORSMiddleware, + allow_origin_regex=".*", + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], + ) api.register_routes() api.register_authorization() api.register_validation_exception_handler() diff --git a/g4f/cookies.py b/g4f/cookies.py index 0a25c41e..8d535ce7 100644 --- a/g4f/cookies.py +++ b/g4f/cookies.py @@ -34,6 +34,7 @@ DOMAINS = [ "www.whiterabbitneo.com", "huggingface.co", "chat.reka.ai", + "chatgpt.com" ] if has_browser_cookie3 and os.environ.get('DBUS_SESSION_BUS_ADDRESS') == "/dev/null": @@ -180,4 +181,4 @@ def _g4f(domain_name: str) -> list: return [] user_data_dir = user_config_dir("g4f") cookie_file = os.path.join(user_data_dir, "Default", "Cookies") - return [] if not os.path.exists(cookie_file) else chrome(cookie_file, domain_name)
\ No newline at end of file + return [] if not os.path.exists(cookie_file) else chrome(cookie_file, domain_name) |