diff --git a/.github/workflows/add-license.yml b/.github/workflows/add-license.yml index 8747cb9..d603140 100644 --- a/.github/workflows/add-license.yml +++ b/.github/workflows/add-license.yml @@ -26,5 +26,7 @@ jobs: - uses: GuillaumeFalourd/git-commit-push@v1.3 with: + email: "actions@github.com" + name: "GitHub Actions Bot" commit_message: "Add license to files" target_branch: main diff --git a/tests/test_bing.py b/tests/test_bing.py index 64aec6d..9ae1c6c 100644 --- a/tests/test_bing.py +++ b/tests/test_bing.py @@ -16,6 +16,7 @@ from g4f.client import Client from g4f.Provider import Bing +from g4f.models import default def generate_response() -> str: @@ -23,13 +24,14 @@ def generate_response() -> str: try: response = client.chat.completions.create( - model="gpt-4.0-turbo", + model=default, messages=[ {"role": "user", "content": "Say hi, with your response starting with START and ending with END"} ], ) except: print("ERROR: Could not create a prompt!") + raise Exception("ERROR: Could not create a prompt!") return response.choices[0].message.content diff --git a/tests/test_freechatgpt.py b/tests/test_freechatgpt.py new file mode 100644 index 0000000..a294142 --- /dev/null +++ b/tests/test_freechatgpt.py @@ -0,0 +1,32 @@ +from g4f.client import Client +from g4f.Provider import FreeChatgpt +from g4f.models import default + + +def generate_response() -> str: + client = Client(provider=FreeChatgpt) + + try: + response = client.chat.completions.create( + model=default, + messages=[ + {"role": "user", "content": "Say hi, with your response starting with START and ending with END"} + ], + ) + except: + print("ERROR: Could not create a prompt!") + raise Exception("ERROR: Could not create a prompt!") + + return response.choices[0].message.content + + +class TestOutput: + def test_output(self): + response = generate_response() + + if len(response) > 0: + print("✅ FreeChatgpt is up!") + else: + print("❌ FreeChatgpt is down...") + + assert response.startswith("START") and response.endswith("END")