From c6b33e527c9af9c72a615a7b23c8d40b5783862f Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Mon, 9 Oct 2023 13:33:20 +0200 Subject: Add Proxy Support and Create Provider to Readme Add proxy support to many providers --- g4f/Provider/needs_auth/HuggingChat.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'g4f/Provider/needs_auth/HuggingChat.py') diff --git a/g4f/Provider/needs_auth/HuggingChat.py b/g4f/Provider/needs_auth/HuggingChat.py index 1d500338..68c6713b 100644 --- a/g4f/Provider/needs_auth/HuggingChat.py +++ b/g4f/Provider/needs_auth/HuggingChat.py @@ -4,8 +4,9 @@ import json, uuid from aiohttp import ClientSession -from ...typing import AsyncGenerator -from ..base_provider import AsyncGeneratorProvider, format_prompt, get_cookies +from ...typing import AsyncResult, Messages +from ..base_provider import AsyncGeneratorProvider +from ..helper import format_prompt, get_cookies class HuggingChat(AsyncGeneratorProvider): @@ -18,12 +19,12 @@ class HuggingChat(AsyncGeneratorProvider): async def create_async_generator( cls, model: str, - messages: list[dict[str, str]], + messages: Messages, stream: bool = True, proxy: str = None, cookies: dict = None, **kwargs - ) -> AsyncGenerator: + ) -> AsyncResult: model = model if model else cls.model if proxy and "://" not in proxy: proxy = f"http://{proxy}" -- cgit v1.2.3