From a3851150b7b97cb7e9411f844634d6086473e837 Mon Sep 17 00:00:00 2001 From: Luneye <73485421+Luneye@users.noreply.github.com> Date: Mon, 28 Aug 2023 16:41:59 +0200 Subject: Update Bing.py Fixed some errors in my previously precipitated commit. --- g4f/Provider/Bing.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/g4f/Provider/Bing.py b/g4f/Provider/Bing.py index 4c7e0557..d96af6a6 100644 --- a/g4f/Provider/Bing.py +++ b/g4f/Provider/Bing.py @@ -10,12 +10,13 @@ class Bing(AsyncGeneratorProvider): supports_gpt_4 = True working=True supports_stream=True + needs_auth=True @staticmethod def create_completion( model: str, messages: list[dict[str, str]], - cookies: dict = None, + cookies: dict, **kwargs ) -> AsyncGenerator: @@ -26,11 +27,11 @@ class Bing(AsyncGeneratorProvider): else: prompt = messages[-1]["content"] context = create_context(messages[:-1]) - if cookies is None: + + if cookies: #TODO: Will implement proper cookie retrieval later and use a try-except mechanism in 'stream_generate' instead of defaulting the cookie value like this - #cookies = get_cookies(".bing.com") - cookies = - { + #cookies_dict = get_cookies(".bing.com") + cookies_dict = { 'MUID': '', 'BCP': '', 'MUIDB': '', @@ -55,8 +56,7 @@ class Bing(AsyncGeneratorProvider): 'SRCHHPGUSR': '', 'ipv6': '', } - - return stream_generate(prompt, context, cookies) + return stream_generate(prompt, context, cookies_dict) def create_context(messages: list[dict[str, str]]): context = "" -- cgit v1.2.3