CrosswaveOmega / GPT-Function-Calling-Utility

A simple package that provides a set of utilities to make it easier to invoke discord.py commands and regular python methods with OpenAI's Function Calling API.
MIT License
1 stars 0 forks source link

Async problems? #1

Closed holymode closed 1 year ago

holymode commented 1 year ago

I have a decorator function that makes sync function async, however if I add it to the class, it acts like the function doesn't exist, even tho i can see in the log that it loads it up as coroutine.

Can you give me an example for it?

I really like this lib, makes it a breeze to add.

Decorators on a function: @AILibFunction @LibParam @make_async

CrosswaveOmega commented 1 year ago

I've added a new method to GPTFunctionLibrary in the latest release that can invoke coroutines called call_by_dict_async

check examples/async_functions.py for an example.

holymode commented 1 year ago

How does it work if you have mixed functions? For example, a couple of sync functions and then a bunch of async, would call_by_dict_async still work for both?

CrosswaveOmega commented 1 year ago

call_by_dict_async works for both sync and async functions.

holymode commented 1 year ago

Sweet. Thanks for adding it.

holymode commented 1 year ago

Actually, it doesnt work for me. I'm getting: Object of type coroutine is not JSON serializable

Edit: Actually nvm, might be my issue