summaryrefslogtreecommitdiffstats
path: root/piexample.py
blob: 23280d2bf10b2d48dcb68942832b09a4633c24c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)