From 2b271013fb0d8e0bd15575b1d0a3aedee5a46f33 Mon Sep 17 00:00:00 2001 From: abc <98614666+xtekky@users.noreply.github.com> Date: Thu, 25 Apr 2024 00:06:11 +0100 Subject: add reka core model (vision) --- etc/examples/image_chat_reka.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 etc/examples/image_chat_reka.py (limited to 'etc/examples') diff --git a/etc/examples/image_chat_reka.py b/etc/examples/image_chat_reka.py new file mode 100644 index 00000000..954960db --- /dev/null +++ b/etc/examples/image_chat_reka.py @@ -0,0 +1,27 @@ +# Image Chat with Reca +# !! YOU NEED COOKIES / BE LOGGED IN TO chat.reka.ai +# download an image and save it as test.png in the same folder + +from g4f.client import Client +from g4f.Provider import Reka + +client = Client( + provider = Reka # Optional if you set model name to reka-core +) + +completion = client.chat.completions.create( + model = "reka-core", + messages = [ + { + "role": "user", + "content": "What can you see in the image ?" + } + ], + stream = True, + image = open("test.png", "rb") # open("path", "rb"), do not use .read(), etc. it must be a file object +) + +for message in completion: + print(message.choices[0].delta.content or "") + + # >>> In the image there is ... \ No newline at end of file -- cgit v1.2.3