summaryrefslogtreecommitdiffstats
path: root/piexample.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--piexample.py25
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)