Giter Club home page Giter Club logo

api-client-py's People

Contributors

marcosoldo avatar nicola-corbellini avatar pingdred avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

api-client-py's Issues

Add methos to send custom json to the cat via WS

๐Ÿš€ The feature, motivation and pitch

The actually send method (cat_client.py line 120) send a ws message with only "text" parameter. To permit a better integrations with 3rd party tools can be useful to have a second method (eg send_with_params) that permit to send a custom json in additional to text, eg:

"text": message,
"custom_settings": json_string

Obviously this additional setting need to be managed by a plugin on cat server side.

Alternatives

No response

Additional context

No response

api-client-py working - but not working inside a cat plugin

Hello Nicola.
Thank you for the answer in the other issue #Furrmidable-Crew/schrodinger_cat#1 (comment).
I tried to upload a .txt from my computer to the cat using https://github.com/cheshire-cat-ai/api-client-py.git and everything worked without any issue.

My goal was to load a document (stored in the plugin folder) inside the declarative memory of the cat just asking it to him.
So I tried to:

  1. copy the api-client-py inside the plug-in folder of the cat (with the requirements.txt file) with no modifications.
  2. run the plug-in inside the cat

the cat gave me this output error in loading the plugin :

cheshire_cat_core | [2023-09-23 09:43:29.325] WARNING cat.mad_hatter.MadHatter.toggle_plugin::228 => 'Toggle plugin 08_upload file from plug in v3: Activate' cheshire_cat_core | [2023-09-23 09:43:32.106] ERROR cat.mad_hatter.Plugin._load_hooks_and_tools::183 => ('Error in cat.plugins.08_upload file from plug in v3.scripts.release_notes: ' cheshire_cat_core | [2023-09-23 09:43:32.106] ERROR cat.mad_hatter.Plugin._load_hooks_and_tools::183 => "'TAG'")

The question are:

  1. is it possible to do what I'm trying to do?
  2. It is a error that can be solved easily?
  3. is there a more intelligent way to do it with some cat features that I ignore?

This one below is the main code of the plugin but I think it is not required.
tool_caricamento_file.txt

Configuration for the rabbit hole api doesn't work without specifying host even though docs says it is optional

๐Ÿ› Describe the bug

`from cheshire_cat_api.api.rabbit_hole_api import RabbitHoleApi
from cheshire_cat_api.api_client import ApiClient
from cheshire_cat_api.configuration import Configuration

file=open("example.txt","w")

conf = Configuration()
api_client=ApiClient(conf)
api_instance = RabbitHoleApi(api_client)
api_response = api_instance.upload_file("example.txt")`

this snippet creates an empty txt file and tries to upload it through the rabbit hole api and fails because the host isn't specified

I believe this is a bug because the rabbit hole api docs say # Defining the host is optional and defaults to http://localhost

Versions

Python 3.10.11
annotated-types==0.6.0
beautifulsoup4==4.12.2
bs4==0.0.1
certifi==2023.11.17
cffi==1.16.0
charset-normalizer==3.3.2
cheshire_cat_api==1.4.1
cryptography==42.0.5
idna==3.6
pdfminer.six==20221105
pdfplumber==0.10.4
Pillow==9.5.0
pycparser==2.21
pycryptodome==3.16.0
pydantic==2.6.2
pydantic_core==2.16.3
PyPDF2==3.0.1
pypdfium2==4.27.0
python-dateutil==2.8.2
requests==2.31.0
six==1.16.0
soupsieve==2.5
typing_extensions==4.9.0
urllib3==2.0.7
websocket-client==1.7.0

Synchronous functions to get the answers

๐Ÿš€ 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.