You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello Elio, nice to see you experimenting with the Python client.
If you want to upload a document just asking the Cat, you can avoid using the Python api client.
The library is meant for interacting with the Cat from "outside", if you want to develop a custom client.
Rather, your goal can be achieved with the following tool
fromcat.mad_hatter.decoratorsimporttool@tooldefupload_document(tool_input, cat):
"""Useful to upload a document in the memory. Input is the name to the document."""# Full document pathdoc_path=f"{cat.get_static_path()}/{tool_input}"# Upload the document to declarative memorycat.rabbit_hole.ingest_file(doc_path)
return"Done"
where cat.get_static_path() is the folder you see under core/cat/static/ and is a static server where you should place the document to be loaded; while cat.rabbit_hole.ingest_file is the same method you used from the Python client.
You can trigger the tool with something like "Please, upload the file foo.txt". The Cat will format the path to be cat/static/foo.txt,
This is just a simple example you can customize to your needs. Please, let me know if this solves your issue.
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:
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:
This one below is the main code of the plugin but I think it is not required.
tool_caricamento_file.txt
The text was updated successfully, but these errors were encountered: