gpt4free icon indicating copy to clipboard operation
gpt4free copied to clipboard

I get to step 6 then I am lost...

Open WhatATechGuy opened this issue 1 year ago • 2 comments

I import g4f, but after that I do not understand how to continue and complete setting up gpt4free. Is there anyone out there who can enlighten me on how to complete and use gpt4free? -Thanks

WhatATechGuy avatar Jun 28 '23 05:06 WhatATechGuy

There's an example in the readme file:

import g4f

print(g4f.Provider.Ails.params) # supported args

# Automatic selection of provider

# streamed completion
response = g4f.ChatCompletion.create(model='gpt-3.5-turbo', messages=[
                                     {"role": "user", "content": "Hello world"}], stream=True)

for message in response:
    print(message)

# normal response
response = g4f.ChatCompletion.create(model=g4f.Model.gpt_4, messages=[
                                     {"role": "user", "content": "hi"}]) # alterative model setting

print(response)


# Set with provider
response = g4f.ChatCompletion.create(model='gpt-3.5-turbo', provider=g4f.Provider.Forefront, messages=[
                                     {"role": "user", "content": "Hello world"}], stream=True)

for message in response:
    print(message)

iu2frl avatar Jul 07 '23 18:07 iu2frl

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

github-actions[bot] avatar Oct 03 '23 00:10 github-actions[bot]