Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acreate #36

Open
bballboy8 opened this issue Aug 22, 2023 · 2 comments
Open

Acreate #36

bballboy8 opened this issue Aug 22, 2023 · 2 comments

Comments

@bballboy8
Copy link

When will there be support for asynchronous usage?

@krrishdholakia
Copy link
Contributor

hey @bballboy8 why do you need acreate support?

i've seen people make async calls and just await the openai response inside the function, so i'm not sure i understand the use-case

@bballboy8
Copy link
Author

So for something like this, it would make more sense to have an async call within the async function:

async def _call_gpt(prompt: str, **kwargs: Any) -> Dict:
    """Call GPT api with backoff."""
    openai.ChatCompletion.acreate = reliableGPT(
        openai.ChatCompletion.acreate, user_email="charlie@reclip.app"
    )
    params = {**DEFAULT_GPT_PARAMS, **kwargs}
    return await openai.ChatCompletion.acreate(
        model=settings.OPENAI_GPT_MODEL,
        messages=[dict(role="user", content=prompt)],
        request_timeout=15,
        **params,
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants