XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
UTF-8
# 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(
        "docs/images/cat.jpeg", "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 ...