gpt4free icon indicating copy to clipboard operation
gpt4free copied to clipboard

Unexpected TypeError with forefront.StreamingCompletion.create

Open bhaskoro-muthohar opened this issue 1 year ago • 2 comments

Bug description I am currently attempting to use the gpt4free library for a Discord bot. Specifically, I am trying to use the forefront.StreamingCompletion.create method to generate responses. However, when passing an account_data argument to the method, I'm encountering an error that says this is an unexpected keyword argument.

Here's the relevant portion of my code:

account_data = forefront.Account.create(logging=False)

async def generate_response(prompt):
    response_text = ''
    for response in forefront.StreamingCompletion.create(
        account_data=account_data,
        prompt=prompt,
        model='gpt-4'
    ):
        response_text += response.choices[0].text
    return response_text

The error message I receive is as follows:

TypeError: create() got an unexpected keyword argument 'account_data'

Environement

  • Python version: Python 3.9.13
  • Location: Indonesia

Additional context I've checked my code thoroughly and I can't find any issues with it. Based on the error message, it seems the StreamingCompletion.create method does not accept account_data as an argument, but I'm unable to find documentation or guidance that indicates what the correct arguments should be.

bhaskoro-muthohar avatar May 14 '23 04:05 bhaskoro-muthohar

Replace

for response in forefront.StreamingCompletion.create(
        account_data=account_data,
        prompt=prompt,
        model='gpt-4'
    )

with

for response in forefront.StreamingCompletion.create(
    token=account_data,
    prompt=prompt,
    model='gpt-4'
)

Wudext avatar May 16 '23 15:05 Wudext

have diff?

huguiqi avatar May 18 '23 08:05 huguiqi