From 23e002f52ffaffbaf98fa4251ceca70e465db05a Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Fri, 9 Feb 2024 06:36:28 +0100 Subject: Fix OpenaiChat provider, Fix issue with curl_cffi --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 9db1679d..6167587e 100644 --- a/README.md +++ b/README.md @@ -358,6 +358,21 @@ response = g4f.ChatCompletion.create( # Displaying the response print(response) + +from g4f.image import ImageResponse + +# Get image links from response +for chunk in g4f.ChatCompletion.create( + model=g4f.models.default, # Using the default model + provider=g4f.Provider.OpenaiChat, # Specifying the provider as OpenaiChat + messages=[{"role": "user", "content": "Create images with dogs"}], + access_token="...", # Need a access token from a plus user + stream=True, + ignore_stream=True +): + if isinstance(chunk, ImageResponse): + print(chunk.images) # Print generated image links + print(chunk.alt) # Print used prompt for image generation ``` ##### Using Browser -- cgit v1.2.3