diff options
author | abc <98614666+xtekky@users.noreply.github.com> | 2023-10-16 01:46:58 +0200 |
---|---|---|
committer | abc <98614666+xtekky@users.noreply.github.com> | 2023-10-16 01:46:58 +0200 |
commit | 46398e8ac643c90e68d04be77a63379aef5df6ec (patch) | |
tree | be30a34de215c0427105575e5eb07753909d69a0 /etc/testing/test_providers.py | |
parent | ~ | Merge pull request #1081 from hlohaus/son (diff) | |
download | gpt4free-46398e8ac643c90e68d04be77a63379aef5df6ec.tar gpt4free-46398e8ac643c90e68d04be77a63379aef5df6ec.tar.gz gpt4free-46398e8ac643c90e68d04be77a63379aef5df6ec.tar.bz2 gpt4free-46398e8ac643c90e68d04be77a63379aef5df6ec.tar.lz gpt4free-46398e8ac643c90e68d04be77a63379aef5df6ec.tar.xz gpt4free-46398e8ac643c90e68d04be77a63379aef5df6ec.tar.zst gpt4free-46398e8ac643c90e68d04be77a63379aef5df6ec.zip |
Diffstat (limited to '')
-rw-r--r-- | etc/testing/test_providers.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/etc/testing/test_providers.py b/etc/testing/test_providers.py index ec0e0271..4ba3a5b4 100644 --- a/etc/testing/test_providers.py +++ b/etc/testing/test_providers.py @@ -1,3 +1,36 @@ +# from g4f.Provider import __all__, ProviderUtils +# from g4f import ChatCompletion +# import concurrent.futures + +# _ = [ +# 'BaseProvider', +# 'AsyncProvider', +# 'AsyncGeneratorProvider', +# 'RetryProvider' +# ] + +# def test_provider(provider): +# try: +# provider = (ProviderUtils.convert[provider]) +# if provider.working and not provider.needs_auth: +# print('testing', provider.__name__) +# completion = ChatCompletion.create(model='gpt-3.5-turbo', +# messages=[{"role": "user", "content": "hello"}], provider=provider) +# return completion, provider.__name__ +# except Exception as e: +# #print(f'Failed to test provider: {provider} | {e}') +# return None + +# with concurrent.futures.ThreadPoolExecutor() as executor: +# futures = [] +# for provider in __all__: +# if provider not in _: +# futures.append(executor.submit(test_provider, provider)) +# for future in concurrent.futures.as_completed(futures): +# result = future.result() +# if result: +# print(f'{result[1]} | {result[0]}') + import sys from pathlib import Path from colorama import Fore, Style |