gpt4free/g4f/typing.py

48 lines
1.0 KiB
Python
Raw Normal View History

import sys
from typing import Any, AsyncGenerator, Generator, AsyncIterator, Iterator, NewType, Tuple, Union, List, Dict, Type, IO, Optional
try:
from PIL.Image import Image
except ImportError:
class Image:
pass
if sys.version_info >= (3, 8):
from typing import TypedDict
else:
from typing_extensions import TypedDict
from .providers.response import ResponseType
2023-06-24 04:47:00 +03:00
2023-08-27 18:37:44 +03:00
SHA256 = NewType('sha_256_hash', str)
CreateResult = Iterator[Union[str, ResponseType]]
AsyncResult = AsyncIterator[Union[str, ResponseType]]
Messages = List[Dict[str, Union[str, List[Dict[str, Union[str, Dict[str, str]]]]]]]
Cookies = Dict[str, str]
ImageType = Union[str, bytes, IO, Image]
ImagesType = List[Tuple[ImageType, Optional[str]]]
2023-07-28 13:07:17 +03:00
__all__ = [
2023-08-27 18:37:44 +03:00
'Any',
'AsyncGenerator',
'Generator',
'AsyncIterator',
'Iterator'
2023-08-27 18:37:44 +03:00
'Tuple',
2024-01-21 04:20:23 +03:00
'Union',
'List',
'Dict',
'Type',
2024-01-24 02:46:35 +03:00
'IO',
'Optional',
2023-08-27 18:37:44 +03:00
'TypedDict',
2023-09-18 00:23:54 +03:00
'SHA256',
'CreateResult',
2024-01-21 04:20:23 +03:00
'AsyncResult',
'Messages',
'Cookies',
'Image',
'ImageType',
'ImagesType'
]