XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/gpt4free

Fix provider initialization in Client class and update method naming convention in ClientFactory

c5187b2c
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +4 -2
Modified g4f/client/__init__.py +4 -2
@@ -290,6 +290,8 @@ class Client(BaseClient):
290 290 **kwargs
291 291 ) -> None:
292 292 super().__init__(**kwargs)
293 if self.base_url and provider is None:
294 provider = create_custom_provider(base_url=self.base_url, api_key=self.api_key)
293 295 self.chat: Chat = Chat(self, provider)
294 296 if media_provider is None:
295 297 media_provider = kwargs.get("image_provider", provider)
@@ -954,10 +956,10 @@ class ClientFactory:
954 956
955 957 Example:
956 958 # Named provider
957 client = ClientFactory.createAsyncClient("PollinationsAI")
959 client = ClientFactory.create_async_client("PollinationsAI")
958 960
959 961 # Custom provider
960 client = ClientFactory.createAsyncClient(
962 client = ClientFactory.create_async_client(
961 963 base_url="https://api.openai.com/v1",
962 964 api_key="sk-..."
963 965 )