-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from YeetCode-devs/staging/prathamdby
Override the default author for workflow commits, implement a new test, and use the default model on all tests
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |