GPT4Free/example_gpt-3.5-turbo.py

13 行
445 B
Python
Raw 通常表示 履歴

2023-06-06 17:46:22 +09:00
import g4f
import sys
# Automatic selection of provider, streamed completion
response = g4f.ChatCompletion.create(model='gpt-3.5-turbo',
messages=[{"role": "user",
"content": "Write a poem about a tree."}],
stream=True)
for message in response:
print(message, end="")
sys.stdout.flush()