forked from mishalhossin/Discord-AI-Chatbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
24 lines (23 loc) · 728 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from g4f.client import Client
from g4f.Provider import RetryProvider, FlowGpt, ChatgptAi, Liaobots
client = Client(
provider=RetryProvider([FlowGpt, ChatgptAi, Liaobots]),
)
try:
response = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": "Say this is a test"}],
)
print(response.choices[0].message.content)
print('gpt-3.5-turbo worked fine')
except:
print('gpt-3.5-turbo failed')
try:
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Say this is a test"}],
)
print(response.choices[0].message.content)
print('gpt-4 worked fine')
except:
print('gpt-4 failed')