cheshire-cat-ai/api-client-py

Synchronous functions to get the answers

Closed this issue ยท 2 comments

๐Ÿš€ The feature, motivation and pitch

Hi @nicola-corbellini,

I was wondering how I should use this library to interact with the cat from outside: the "send" method looks to be asynchronous but how can I get the result of a message to be used by other services?

Let's say I want to integrate the cat with Microsoft Teams: I'd like to use this library as "man in the middle" but I can't because I can't get the answer from the "send" method.

Am I missing something?

Alternatives

No response

Additional context

No response

Hi @Roby91! There has recently been a refactor. Hence, with the latest version you should define a callback function like this:

def on_message(message):
    # the client will pass the message to this function

And then pass this message to the constructor

ccat = CatClient(on_message=on_message)

Sorry for the lack of documentation, we'll add more soon

Great, I got it, that's enough for what I needed, thanks!