summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorabc <98614666+xtekky@users.noreply.github.com>2023-08-17 14:57:37 +0200
committerabc <98614666+xtekky@users.noreply.github.com>2023-08-17 14:57:37 +0200
commit6d96a1efd27b94c564da6da9cddf3bfceaf7c0ed (patch)
tree0f046519635833db16e6b71505d355eb2c8cb717
parent ~ (diff)
downloadgpt4free-6d96a1efd27b94c564da6da9cddf3bfceaf7c0ed.tar
gpt4free-6d96a1efd27b94c564da6da9cddf3bfceaf7c0ed.tar.gz
gpt4free-6d96a1efd27b94c564da6da9cddf3bfceaf7c0ed.tar.bz2
gpt4free-6d96a1efd27b94c564da6da9cddf3bfceaf7c0ed.tar.lz
gpt4free-6d96a1efd27b94c564da6da9cddf3bfceaf7c0ed.tar.xz
gpt4free-6d96a1efd27b94c564da6da9cddf3bfceaf7c0ed.tar.zst
gpt4free-6d96a1efd27b94c564da6da9cddf3bfceaf7c0ed.zip
-rw-r--r--g4f/Provider/Bing.py6
-rw-r--r--g4f/Provider/Raycast.py2
-rw-r--r--g4f/__init__.py12
-rw-r--r--g4f/models.py2
-rw-r--r--g4f/typing.py2
5 files changed, 12 insertions, 12 deletions
diff --git a/g4f/Provider/Bing.py b/g4f/Provider/Bing.py
index 40e112a9..48b5477d 100644
--- a/g4f/Provider/Bing.py
+++ b/g4f/Provider/Bing.py
@@ -9,7 +9,7 @@ import aiohttp
import certifi
import requests
-from ..typing import Any, AsyncGenerator, CreateResult, Tuple
+from ..typing import Any, AsyncGenerator, CreateResult, Tuple, Union
from .base_provider import BaseProvider
@@ -79,7 +79,7 @@ def _format(msg: dict[str, Any]) -> str:
async def stream_generate(
prompt: str,
mode: dict[str, list[str]] = jailbreak,
- context: bool | str = False,
+ context: Union[bool, str] = False,
):
timeout = aiohttp.ClientTimeout(total=900)
session = aiohttp.ClientSession(timeout=timeout)
@@ -350,7 +350,7 @@ class Defaults:
}
-def run(generator: AsyncGenerator[Any | str, Any]):
+def run(generator: AsyncGenerator[Union[Any, str], Any]):
loop = asyncio.get_event_loop()
gen = generator.__aiter__()
diff --git a/g4f/Provider/Raycast.py b/g4f/Provider/Raycast.py
index 9441f629..49481202 100644
--- a/g4f/Provider/Raycast.py
+++ b/g4f/Provider/Raycast.py
@@ -2,7 +2,7 @@ import json
import requests
-from ..provider.base_provider import BaseProvider
+from ..Provider.base_provider import BaseProvider
from ..typing import Any, CreateResult
diff --git a/g4f/__init__.py b/g4f/__init__.py
index d90faf06..47d2a7a3 100644
--- a/g4f/__init__.py
+++ b/g4f/__init__.py
@@ -1,6 +1,6 @@
from . import models
-from .provider import BaseProvider
-from .typing import Any, CreateResult
+from .Provider import BaseProvider
+from .typing import Any, CreateResult, Union
logging = False
@@ -8,13 +8,13 @@ logging = False
class ChatCompletion:
@staticmethod
def create(
- model: models.Model | str,
+ model: Union[models.Model, str],
messages: list[dict[str, str]],
- provider: type[BaseProvider] | None = None,
+ provider: Union[type[BaseProvider], None] = None,
stream: bool = False,
- auth: str | None = None,
+ auth: Union[str, None] = None,
**kwargs: Any,
- ) -> CreateResult | str:
+ ) -> Union[CreateResult, str]:
if isinstance(model, str):
try:
model = models.ModelUtils.convert[model]
diff --git a/g4f/models.py b/g4f/models.py
index 40d21f2a..c675c280 100644
--- a/g4f/models.py
+++ b/g4f/models.py
@@ -1,6 +1,6 @@
from dataclasses import dataclass
-from .provider import Bard, BaseProvider, GetGpt, H2o, Liaobots, Vercel
+from .Provider import Bard, BaseProvider, GetGpt, H2o, Liaobots, Vercel
@dataclass
diff --git a/g4f/typing.py b/g4f/typing.py
index 5d4489f9..2e123112 100644
--- a/g4f/typing.py
+++ b/g4f/typing.py
@@ -1,4 +1,4 @@
-from typing import Any, AsyncGenerator, Generator, NewType, Tuple, TypedDict
+from typing import Any, AsyncGenerator, Generator, NewType, Tuple, TypedDict, Union
SHA256 = NewType("sha_256_hash", str)
CreateResult = Generator[str, None, None]