mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-11-01 12:02:40 +08:00
* Added new provider PI (Hacky way to use) * Updated models endpoint made it show real info about the model.py * Added cloudscraper to the requirements * Fixed some bugs aka made streaming also return role
26 lines
524 B
Python
26 lines
524 B
Python
from g4f import Provider
|
|
|
|
import g4f
|
|
|
|
Conversation = Provider.PI.Start_Conversation()
|
|
|
|
Chat_History = Provider.PI.GetChatHistory(Conversation)
|
|
|
|
response = g4f.ChatCompletion.create(
|
|
model="pi",
|
|
provider=g4f.Provider.PI,
|
|
messages=[
|
|
{
|
|
"role": "user",
|
|
"content": 'Hello who are you?'
|
|
}
|
|
],
|
|
stream=False,
|
|
conversation=Conversation
|
|
)
|
|
|
|
for message in response:
|
|
print(message, flush=True, end='')
|
|
|
|
Chat_Title = Provider.PI.GetConversationTitle(Conversation)
|