- Notifications
You must be signed in to change notification settings - Fork11
API Client to communicate with the Cheshire Cat AI
cheshire-cat-ai/api-client-py
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
API to develop Python clients to interact with the Cheshire Cat.
The package allows instantiating aWebSocket client and provides the API to interact with all theendpoints.
A part of this Python package is automatically generated by theOpenAPI Generator project.
For deeper documentation about the available endpoints, please refer to the APIReDoc.The official Cheshire Cat documentation is availablehere.
Python 3.10
You can install the API withpip:
pip install cheshire-cat-api
Then import the package:
importcheshire_cat_apiasccat
TheCatClient has the following attributes to easily interface with the related APis:
- memory
- plugins
- rabbit_hole
- status
- embedder
- settings
- llm
importcheshire_cat_apiasccat# A config is necessary to set up base parameters like# URL, port, user_id, etc.config=ccat.Config(user_id="my_user_42")# Connect to the APIcat_client=ccat.CatClient(config=config)
# Now retrieve a list of the available pluginsplugins=cat_client.plugins.get_available_plugins()
fromcheshire_cat_api.models.body_upload_urlimportBodyUploadUrl# Please note that interacting with the RabbitHole to upload# a URL requires structuring the body like thisbody_upload_url=BodyUploadUrl(url="https://cheshire-cat-ai.github.io/docs/conceptual/cheshire_cat/rabbit_hole/")# then you can make the request as followsresponse=cat_client.rabbit_hole.upload_url(body_upload_url)
importtimeimportcheshire_cat_apiasccat# A config is necessary to set up base parameters like# URL, port, user_id, etc.config=ccat.Config(user_id="my_user_42")cat_client=ccat.CatClient(config=config)# Connect to the WebSocket APIcat_client.connect_ws()whilenotcat_client.is_ws_connected:# A better handling is strongly advised to avoid an infinite looptime.sleep(1)# Send the messagecat_client.send(message="Hello Cat!")# Close connectioncat_client.close()
Both the classes are available with:
fromcheshire_cat_apiimportConfig
| Class | Name | Default | Description |
|---|---|---|---|
| Config | base_url | "localhost" | base URL where the Cat is hosted |
| Config | port | 1865 | port for the connection |
| Config | user_id | "user" | id of the client |
| Config | auth_key | "" | authentication key for the http endpoints |
| Config | secure_connection | False | if to use secure protocol |
For a more advanced usage, you can directly interact with the auto-generated client.For documentation seehere
About
API Client to communicate with the Cheshire Cat AI
Topics
Resources
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.