diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2023-12-14 07:50:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-14 07:50:43 +0100 |
commit | 36592e4952e19c33e8e9a25b2acc3ef9e5547ee8 (patch) | |
tree | 585adedaeebaf4caa6013fb7a7894739fff5ae1c /g4f/api/__init__.py | |
parent | Merge pull request #1343 from nullstreak/main (diff) | |
parent | Add providers in api (diff) | |
download | gpt4free-36592e4952e19c33e8e9a25b2acc3ef9e5547ee8.tar gpt4free-36592e4952e19c33e8e9a25b2acc3ef9e5547ee8.tar.gz gpt4free-36592e4952e19c33e8e9a25b2acc3ef9e5547ee8.tar.bz2 gpt4free-36592e4952e19c33e8e9a25b2acc3ef9e5547ee8.tar.lz gpt4free-36592e4952e19c33e8e9a25b2acc3ef9e5547ee8.tar.xz gpt4free-36592e4952e19c33e8e9a25b2acc3ef9e5547ee8.tar.zst gpt4free-36592e4952e19c33e8e9a25b2acc3ef9e5547ee8.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/api/__init__.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/g4f/api/__init__.py b/g4f/api/__init__.py index 410fcc5f..a79da7b0 100644 --- a/g4f/api/__init__.py +++ b/g4f/api/__init__.py @@ -84,6 +84,10 @@ class Api: stream = True if item_data.get("stream") == "True" else False messages = item_data.get('messages') conversation = item_data.get('conversation') if item_data.get('conversation') != None else None + provider = item_data.get('provider').replace('g4f.Provider.', '') + provider = provider if provider and provider != "Auto" else None + if provider != None: + provider = g4f.Provider.ProviderUtils.convert.get(provider) try: if model == 'pi': @@ -92,12 +96,14 @@ class Api: stream=stream, messages=messages, conversation=conversation, + provider = provider, ignored=self.list_ignored_providers) else: response = g4f.ChatCompletion.create( model=model, stream=stream, messages=messages, + provider = provider, ignored=self.list_ignored_providers) except Exception as e: logging.exception(e) |