From 5e9e56ed5388250237479ee59acdbc1c7017ea39 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Wed, 20 Nov 2024 02:35:35 +0100 Subject: Fix missing provider_handler in client --- g4f/client/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'g4f') diff --git a/g4f/client/__init__.py b/g4f/client/__init__.py index 1f3cdab1..549a244b 100644 --- a/g4f/client/__init__.py +++ b/g4f/client/__init__.py @@ -12,7 +12,7 @@ from typing import Union, AsyncIterator, Iterator, Coroutine from ..providers.base_provider import AsyncGeneratorProvider from ..image import ImageResponse, to_image, to_data_uri, is_accepted_format, EXTENSIONS_MAP -from ..typing import Messages, Cookies, Image +from ..typing import Messages, Image from ..providers.types import ProviderType, FinishReason, BaseConversation from ..errors import NoImageResponseError from ..providers.retry_provider import IterListProvider @@ -254,6 +254,8 @@ class Images: provider_handler = self.models.get(model, provider or self.provider or BingCreateImages) elif isinstance(provider, str): provider_handler = convert_to_provider(provider) + else: + provider_handler = provider if provider_handler is None: raise ValueError(f"Unknown model: {model}") if proxy is None: -- cgit v1.2.3