diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-03-12 02:06:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-12 02:06:06 +0100 |
commit | 6ef282de3a3245acbfecd08ae48dba85ff91d031 (patch) | |
tree | 0236c9678eea8f9c78ed7c09f3d86eaf3d7c691c /g4f/providers | |
parent | Update .gitignore (diff) | |
download | gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.gz gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.bz2 gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.lz gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.xz gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.zst gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.zip |
Diffstat (limited to 'g4f/providers')
-rw-r--r-- | g4f/providers/helper.py | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/g4f/providers/helper.py b/g4f/providers/helper.py index c027216b..df6767a4 100644 --- a/g4f/providers/helper.py +++ b/g4f/providers/helper.py @@ -3,10 +3,8 @@ from __future__ import annotations import random import secrets import string -from aiohttp import BaseConnector -from ..typing import Messages, Optional -from ..errors import MissingRequirementsError +from ..typing import Messages def format_prompt(messages: Messages, add_special_tokens=False) -> str: """ @@ -49,16 +47,4 @@ def get_random_hex() -> str: Returns: str: A random hexadecimal string of 32 characters (16 bytes). """ - return secrets.token_hex(16).zfill(32) - -def get_connector(connector: BaseConnector = None, proxy: str = None, rdns: bool = False) -> Optional[BaseConnector]: - if proxy and not connector: - try: - from aiohttp_socks import ProxyConnector - if proxy.startswith("socks5h://"): - proxy = proxy.replace("socks5h://", "socks5://") - rdns = True - connector = ProxyConnector.from_url(proxy, rdns=rdns) - except ImportError: - raise MissingRequirementsError('Install "aiohttp_socks" package for proxy support') - return connector
\ No newline at end of file + return secrets.token_hex(16).zfill(32)
\ No newline at end of file |