Skip to content

Commit

Permalink
Merge pull request #13 from YeetCode-devs/staging/prathamdby
Browse files Browse the repository at this point in the history
Override the default author for workflow commits, implement a new test, and use the default model on all tests
  • Loading branch information
prathamdby authored Mar 18, 2024
2 parents e8c2a13 + 33e39d2 commit 5ea6d8e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/add-license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ jobs:
- uses: GuillaumeFalourd/[email protected]
with:
email: "[email protected]"
name: "GitHub Actions Bot"
commit_message: "Add license to files"
target_branch: main
4 changes: 3 additions & 1 deletion tests/test_bing.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@

from g4f.client import Client
from g4f.Provider import Bing
from g4f.models import default


def generate_response() -> str:
client = Client(provider=Bing)

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

Expand Down
32 changes: 32 additions & 0 deletions tests/test_freechatgpt.py
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit 5ea6d8e

Please sign in to comment.