diff options
author | madonchik123 <68397448+madonchik123@users.noreply.github.com> | 2023-12-01 23:11:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-01 23:11:52 +0100 |
commit | b0276f6c9e2925c65a00b7189bad92feb25cefbd (patch) | |
tree | 1909ac2fd081e2e8ad5b5dfa8ae46bd6fd58c579 /piexample.py | |
parent | ~ (diff) | |
download | gpt4free-b0276f6c9e2925c65a00b7189bad92feb25cefbd.tar gpt4free-b0276f6c9e2925c65a00b7189bad92feb25cefbd.tar.gz gpt4free-b0276f6c9e2925c65a00b7189bad92feb25cefbd.tar.bz2 gpt4free-b0276f6c9e2925c65a00b7189bad92feb25cefbd.tar.lz gpt4free-b0276f6c9e2925c65a00b7189bad92feb25cefbd.tar.xz gpt4free-b0276f6c9e2925c65a00b7189bad92feb25cefbd.tar.zst gpt4free-b0276f6c9e2925c65a00b7189bad92feb25cefbd.zip |
Diffstat (limited to 'piexample.py')
-rw-r--r-- | piexample.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/piexample.py b/piexample.py new file mode 100644 index 00000000..23280d2b --- /dev/null +++ b/piexample.py @@ -0,0 +1,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) |