summaryrefslogtreecommitdiffstats
path: root/g4f/Provider
diff options
context:
space:
mode:
authorTekky <98614666+xtekky@users.noreply.github.com>2023-09-05 15:25:10 +0200
committerGitHub <noreply@github.com>2023-09-05 15:25:10 +0200
commit4323662008519396c598b4e14ab87923fadff923 (patch)
tree85ab7d042d3a77d3ca579e886b96d474fbfc6229 /g4f/Provider
parent~ |  Merge pull request #872 (diff)
parenttype hints (diff)
downloadgpt4free-4323662008519396c598b4e14ab87923fadff923.tar
gpt4free-4323662008519396c598b4e14ab87923fadff923.tar.gz
gpt4free-4323662008519396c598b4e14ab87923fadff923.tar.bz2
gpt4free-4323662008519396c598b4e14ab87923fadff923.tar.lz
gpt4free-4323662008519396c598b4e14ab87923fadff923.tar.xz
gpt4free-4323662008519396c598b4e14ab87923fadff923.tar.zst
gpt4free-4323662008519396c598b4e14ab87923fadff923.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/AItianhu.py2
-rw-r--r--g4f/Provider/Acytoo.py2
-rw-r--r--g4f/Provider/AiService.py2
-rw-r--r--g4f/Provider/Aichat.py2
-rw-r--r--g4f/Provider/Ails.py3
-rw-r--r--g4f/Provider/Bard.py6
-rw-r--r--g4f/Provider/Bing.py14
-rw-r--r--g4f/Provider/ChatgptAi.py8
-rw-r--r--g4f/Provider/ChatgptLogin.py10
-rw-r--r--g4f/Provider/DeepAi.py9
-rw-r--r--g4f/Provider/DfeHub.py10
-rw-r--r--g4f/Provider/EasyChat.py9
-rw-r--r--g4f/Provider/Equing.py8
-rw-r--r--g4f/Provider/FastGpt.py7
-rw-r--r--g4f/Provider/Forefront.py2
-rw-r--r--g4f/Provider/GetGpt.py12
-rw-r--r--g4f/Provider/H2o.py3
-rw-r--r--g4f/Provider/HuggingChat.py5
-rw-r--r--g4f/Provider/Liaobots.py5
-rw-r--r--g4f/Provider/Lockchat.py8
-rw-r--r--g4f/Provider/Opchatgpts.py4
-rw-r--r--g4f/Provider/OpenAssistant.py6
-rw-r--r--g4f/Provider/OpenaiChat.py10
-rw-r--r--g4f/Provider/Raycast.py8
-rw-r--r--g4f/Provider/Theb.py9
-rw-r--r--g4f/Provider/V50.py9
-rw-r--r--g4f/Provider/Vercel.py12
-rw-r--r--g4f/Provider/Wewordle.py11
-rw-r--r--g4f/Provider/Wuguokai.py7
-rw-r--r--g4f/Provider/You.py5
-rw-r--r--g4f/Provider/Yqcloud.py2
-rw-r--r--g4f/Provider/__init__.py1
-rw-r--r--g4f/Provider/base_provider.py8
33 files changed, 174 insertions, 45 deletions
diff --git a/g4f/Provider/AItianhu.py b/g4f/Provider/AItianhu.py
index abf66cc1..4458c14f 100644
--- a/g4f/Provider/AItianhu.py
+++ b/g4f/Provider/AItianhu.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
import json
import requests
diff --git a/g4f/Provider/Acytoo.py b/g4f/Provider/Acytoo.py
index 5baa2b8d..48a3a344 100644
--- a/g4f/Provider/Acytoo.py
+++ b/g4f/Provider/Acytoo.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
import time
import requests
diff --git a/g4f/Provider/AiService.py b/g4f/Provider/AiService.py
index 3453bfd9..f4de2836 100644
--- a/g4f/Provider/AiService.py
+++ b/g4f/Provider/AiService.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
import requests
from ..typing import Any, CreateResult
diff --git a/g4f/Provider/Aichat.py b/g4f/Provider/Aichat.py
index 62954e07..2b228314 100644
--- a/g4f/Provider/Aichat.py
+++ b/g4f/Provider/Aichat.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
import requests
from ..typing import Any, CreateResult
diff --git a/g4f/Provider/Ails.py b/g4f/Provider/Ails.py
index 9a58d505..4eb21729 100644
--- a/g4f/Provider/Ails.py
+++ b/g4f/Provider/Ails.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
import hashlib
import json
import time
@@ -9,6 +11,7 @@ import requests
from ..typing import SHA256, Any, CreateResult
from .base_provider import BaseProvider
+
class Ails(BaseProvider):
url: str = "https://ai.ls"
working = True
diff --git a/g4f/Provider/Bard.py b/g4f/Provider/Bard.py
index 978fa98e..2137d820 100644
--- a/g4f/Provider/Bard.py
+++ b/g4f/Provider/Bard.py
@@ -1,9 +1,13 @@
+from __future__ import annotations
+
import json
import random
import re
+
from aiohttp import ClientSession
-from .base_provider import AsyncProvider, get_cookies, format_prompt
+from .base_provider import AsyncProvider, format_prompt, get_cookies
+
class Bard(AsyncProvider):
url = "https://bard.google.com"
diff --git a/g4f/Provider/Bing.py b/g4f/Provider/Bing.py
index 48968e39..57dfcec9 100644
--- a/g4f/Provider/Bing.py
+++ b/g4f/Provider/Bing.py
@@ -1,9 +1,17 @@
-import asyncio, aiohttp, json, os, random
+from __future__ import annotations
-from aiohttp import ClientSession
-from ..typing import Any, AsyncGenerator, CreateResult, Union
+import asyncio
+import json
+import os
+import random
+
+import aiohttp
+from aiohttp import ClientSession
+
+from ..typing import Any, AsyncGenerator, CreateResult, Union
from .base_provider import AsyncGeneratorProvider, get_cookies
+
class Bing(AsyncGeneratorProvider):
url = "https://bing.com/chat"
needs_auth = True
diff --git a/g4f/Provider/ChatgptAi.py b/g4f/Provider/ChatgptAi.py
index 13c591cb..55b9b942 100644
--- a/g4f/Provider/ChatgptAi.py
+++ b/g4f/Provider/ChatgptAi.py
@@ -1,6 +1,10 @@
-import re, requests
+from __future__ import annotations
-from ..typing import Any, CreateResult
+import re
+
+import requests
+
+from ..typing import Any, CreateResult
from .base_provider import BaseProvider
diff --git a/g4f/Provider/ChatgptLogin.py b/g4f/Provider/ChatgptLogin.py
index d445e023..e4584d32 100644
--- a/g4f/Provider/ChatgptLogin.py
+++ b/g4f/Provider/ChatgptLogin.py
@@ -1,6 +1,12 @@
-import base64, os, re, requests
+from __future__ import annotations
-from ..typing import Any, CreateResult
+import base64
+import os
+import re
+
+import requests
+
+from ..typing import Any, CreateResult
from .base_provider import BaseProvider
diff --git a/g4f/Provider/DeepAi.py b/g4f/Provider/DeepAi.py
index 073b04a5..feba6b41 100644
--- a/g4f/Provider/DeepAi.py
+++ b/g4f/Provider/DeepAi.py
@@ -1,6 +1,11 @@
-import json, js2py, requests
+from __future__ import annotations
-from ..typing import Any, CreateResult
+import json
+
+import js2py
+import requests
+
+from ..typing import Any, CreateResult
from .base_provider import BaseProvider
diff --git a/g4f/Provider/DfeHub.py b/g4f/Provider/DfeHub.py
index 477bb546..d40e0380 100644
--- a/g4f/Provider/DfeHub.py
+++ b/g4f/Provider/DfeHub.py
@@ -1,6 +1,12 @@
-import json, re, time , requests
+from __future__ import annotations
-from ..typing import Any, CreateResult
+import json
+import re
+import time
+
+import requests
+
+from ..typing import Any, CreateResult
from .base_provider import BaseProvider
diff --git a/g4f/Provider/EasyChat.py b/g4f/Provider/EasyChat.py
index 959b9d10..946d4a4d 100644
--- a/g4f/Provider/EasyChat.py
+++ b/g4f/Provider/EasyChat.py
@@ -1,6 +1,11 @@
-import json, requests, random
+from __future__ import annotations
-from ..typing import Any, CreateResult
+import json
+import random
+
+import requests
+
+from ..typing import Any, CreateResult
from .base_provider import BaseProvider
diff --git a/g4f/Provider/Equing.py b/g4f/Provider/Equing.py
index 8595c73e..0ebb93a5 100644
--- a/g4f/Provider/Equing.py
+++ b/g4f/Provider/Equing.py
@@ -1,6 +1,10 @@
-import requests, json
+from __future__ import annotations
+
+import json
+from abc import ABC, abstractmethod
+
+import requests
-from abc import ABC, abstractmethod
from ..typing import Any, CreateResult
diff --git a/g4f/Provider/FastGpt.py b/g4f/Provider/FastGpt.py
index 8bf58423..ef47f752 100644
--- a/g4f/Provider/FastGpt.py
+++ b/g4f/Provider/FastGpt.py
@@ -1,6 +1,11 @@
-import requests, json, random
+from __future__ import annotations
+
+import json
+import random
from abc import ABC, abstractmethod
+import requests
+
from ..typing import Any, CreateResult
diff --git a/g4f/Provider/Forefront.py b/g4f/Provider/Forefront.py
index 658355f4..8f51fb57 100644
--- a/g4f/Provider/Forefront.py
+++ b/g4f/Provider/Forefront.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
import json
import requests
diff --git a/g4f/Provider/GetGpt.py b/g4f/Provider/GetGpt.py
index d79cb9db..74e772b0 100644
--- a/g4f/Provider/GetGpt.py
+++ b/g4f/Provider/GetGpt.py
@@ -1,7 +1,13 @@
-import os, json, uuid, requests
+from __future__ import annotations
-from Crypto.Cipher import AES
-from ..typing import Any, CreateResult
+import json
+import os
+import uuid
+
+import requests
+from Crypto.Cipher import AES
+
+from ..typing import Any, CreateResult
from .base_provider import BaseProvider
diff --git a/g4f/Provider/H2o.py b/g4f/Provider/H2o.py
index ac5fcfb7..b62da977 100644
--- a/g4f/Provider/H2o.py
+++ b/g4f/Provider/H2o.py
@@ -1,5 +1,8 @@
+from __future__ import annotations
+
import json
import uuid
+
from aiohttp import ClientSession
from ..typing import AsyncGenerator
diff --git a/g4f/Provider/HuggingChat.py b/g4f/Provider/HuggingChat.py
index 4564d7b3..7b62b342 100644
--- a/g4f/Provider/HuggingChat.py
+++ b/g4f/Provider/HuggingChat.py
@@ -1,8 +1,11 @@
+from __future__ import annotations
+
import json
+
from aiohttp import ClientSession
from ..typing import AsyncGenerator
-from .base_provider import AsyncGeneratorProvider, get_cookies, format_prompt
+from .base_provider import AsyncGeneratorProvider, format_prompt, get_cookies
class HuggingChat(AsyncGeneratorProvider):
diff --git a/g4f/Provider/Liaobots.py b/g4f/Provider/Liaobots.py
index 95a0ea06..2360c8a5 100644
--- a/g4f/Provider/Liaobots.py
+++ b/g4f/Provider/Liaobots.py
@@ -1,5 +1,8 @@
-import uuid
+from __future__ import annotations
+
import json
+import uuid
+
from aiohttp import ClientSession
from ..typing import AsyncGenerator
diff --git a/g4f/Provider/Lockchat.py b/g4f/Provider/Lockchat.py
index 3c1ce0d1..c15eec8d 100644
--- a/g4f/Provider/Lockchat.py
+++ b/g4f/Provider/Lockchat.py
@@ -1,6 +1,10 @@
-import json, requests
+from __future__ import annotations
-from ..typing import Any, CreateResult
+import json
+
+import requests
+
+from ..typing import Any, CreateResult
from .base_provider import BaseProvider
diff --git a/g4f/Provider/Opchatgpts.py b/g4f/Provider/Opchatgpts.py
index a47b0099..241646f0 100644
--- a/g4f/Provider/Opchatgpts.py
+++ b/g4f/Provider/Opchatgpts.py
@@ -1,6 +1,8 @@
+from __future__ import annotations
+
import requests
-from ..typing import Any, CreateResult
+from ..typing import Any, CreateResult
from .base_provider import BaseProvider
diff --git a/g4f/Provider/OpenAssistant.py b/g4f/Provider/OpenAssistant.py
index 542af78f..3a931597 100644
--- a/g4f/Provider/OpenAssistant.py
+++ b/g4f/Provider/OpenAssistant.py
@@ -1,8 +1,12 @@
+from __future__ import annotations
+
import json
+
from aiohttp import ClientSession
from ..typing import Any, AsyncGenerator
-from .base_provider import AsyncGeneratorProvider, get_cookies, format_prompt
+from .base_provider import AsyncGeneratorProvider, format_prompt, get_cookies
+
class OpenAssistant(AsyncGeneratorProvider):
url = "https://open-assistant.io/chat"
diff --git a/g4f/Provider/OpenaiChat.py b/g4f/Provider/OpenaiChat.py
index 9ca0cd58..f2d1ed6f 100644
--- a/g4f/Provider/OpenaiChat.py
+++ b/g4f/Provider/OpenaiChat.py
@@ -1,14 +1,18 @@
+from __future__ import annotations
+
has_module = True
try:
from revChatGPT.V1 import AsyncChatbot
except ImportError:
has_module = False
-from .base_provider import AsyncGeneratorProvider, get_cookies, format_prompt
-from ..typing import AsyncGenerator
-from httpx import AsyncClient
import json
+from httpx import AsyncClient
+
+from ..typing import AsyncGenerator
+from .base_provider import AsyncGeneratorProvider, format_prompt, get_cookies
+
class OpenaiChat(AsyncGeneratorProvider):
url = "https://chat.openai.com"
diff --git a/g4f/Provider/Raycast.py b/g4f/Provider/Raycast.py
index 057f5b31..7ddc8acd 100644
--- a/g4f/Provider/Raycast.py
+++ b/g4f/Provider/Raycast.py
@@ -1,6 +1,10 @@
-import json, requests
+from __future__ import annotations
-from ..typing import Any, CreateResult
+import json
+
+import requests
+
+from ..typing import Any, CreateResult
from .base_provider import BaseProvider
diff --git a/g4f/Provider/Theb.py b/g4f/Provider/Theb.py
index 9a47bb89..c37cc4b7 100644
--- a/g4f/Provider/Theb.py
+++ b/g4f/Provider/Theb.py
@@ -1,6 +1,11 @@
-import json, random, requests
+from __future__ import annotations
-from ..typing import Any, CreateResult
+import json
+import random
+
+import requests
+
+from ..typing import Any, CreateResult
from .base_provider import BaseProvider
diff --git a/g4f/Provider/V50.py b/g4f/Provider/V50.py
index 1dc7651d..4e02d4b7 100644
--- a/g4f/Provider/V50.py
+++ b/g4f/Provider/V50.py
@@ -1,8 +1,13 @@
-import uuid, requests
+from __future__ import annotations
-from ..typing import Any, CreateResult
+import uuid
+
+import requests
+
+from ..typing import Any, CreateResult
from .base_provider import BaseProvider
+
class V50(BaseProvider):
url = 'https://p5.v50.ltd'
supports_gpt_35_turbo = True
diff --git a/g4f/Provider/Vercel.py b/g4f/Provider/Vercel.py
index f2377db4..8aaf5656 100644
--- a/g4f/Provider/Vercel.py
+++ b/g4f/Provider/Vercel.py
@@ -1,7 +1,13 @@
-import base64, json, uuid, quickjs
+from __future__ import annotations
-from curl_cffi import requests
-from ..typing import Any, CreateResult, TypedDict
+import base64
+import json
+import uuid
+
+import quickjs
+from curl_cffi import requests
+
+from ..typing import Any, CreateResult, TypedDict
from .base_provider import BaseProvider
diff --git a/g4f/Provider/Wewordle.py b/g4f/Provider/Wewordle.py
index 6a8a6a7b..99c81a84 100644
--- a/g4f/Provider/Wewordle.py
+++ b/g4f/Provider/Wewordle.py
@@ -1,6 +1,13 @@
-import json, random, string, time, requests
+from __future__ import annotations
-from ..typing import Any, CreateResult
+import json
+import random
+import string
+import time
+
+import requests
+
+from ..typing import Any, CreateResult
from .base_provider import BaseProvider
diff --git a/g4f/Provider/Wuguokai.py b/g4f/Provider/Wuguokai.py
index 8a5aac0d..a9614626 100644
--- a/g4f/Provider/Wuguokai.py
+++ b/g4f/Provider/Wuguokai.py
@@ -1,4 +1,9 @@
-import random, requests
+from __future__ import annotations
+
+import random
+
+import requests
+
from ..typing import Any, CreateResult
from .base_provider import BaseProvider
diff --git a/g4f/Provider/You.py b/g4f/Provider/You.py
index 1fbe1eb6..121d1dbd 100644
--- a/g4f/Provider/You.py
+++ b/g4f/Provider/You.py
@@ -1,6 +1,9 @@
-from aiohttp import ClientSession
+from __future__ import annotations
+
import json
+from aiohttp import ClientSession
+
from ..typing import AsyncGenerator
from .base_provider import AsyncGeneratorProvider, format_prompt, get_cookies
diff --git a/g4f/Provider/Yqcloud.py b/g4f/Provider/Yqcloud.py
index 7c1d06ba..731e4ecb 100644
--- a/g4f/Provider/Yqcloud.py
+++ b/g4f/Provider/Yqcloud.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
from aiohttp import ClientSession
from .base_provider import AsyncProvider, format_prompt
diff --git a/g4f/Provider/__init__.py b/g4f/Provider/__init__.py
index fce66d0c..fa1bdb87 100644
--- a/g4f/Provider/__init__.py
+++ b/g4f/Provider/__init__.py
@@ -1,3 +1,4 @@
+from __future__ import annotations
from .Acytoo import Acytoo
from .Aichat import Aichat
from .Ails import Ails
diff --git a/g4f/Provider/base_provider.py b/g4f/Provider/base_provider.py
index def2cd6d..e667819a 100644
--- a/g4f/Provider/base_provider.py
+++ b/g4f/Provider/base_provider.py
@@ -1,9 +1,11 @@
-from abc import ABC, abstractmethod
+from __future__ import annotations
-from ..typing import Any, CreateResult, AsyncGenerator, Union
+import asyncio
+from abc import ABC, abstractmethod
import browser_cookie3
-import asyncio
+
+from ..typing import Any, AsyncGenerator, CreateResult, Union
class BaseProvider(ABC):