Skip to main content

Cheshire Cat API client

API to develop Python clients to interact with the Cheshire Cat.

The package allows instantiating a WebSocket client and provides the API to interact with all the endpoints.

A part of this Python package is automatically generated by the OpenAPI Generator project.

For deeper documentation about the available endpoints, please refer to the API ReDoc. The official Cheshire Cat documentation is available here.

Requirements.

Python 3.10

Installation & Usage

pip install

You can install the API with pip:

pip install cheshire-cat-api

Then import the package:

import cheshire_cat_api as ccat

Interact with the HTTP Endpoints

Available APIs

The CatClient has the following attributes to easily interface with the related APis:

  • memory
  • plugins
  • rabbit_hole
  • status
  • embedder
  • settings
  • llm

Instantiate connection

import cheshire_cat_api as ccat

# 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 API
cat_client = ccat.CatClient(
    config=config
)

Plugin API - Retrieve plugins

# Now retrieve a list of the available plugins
plugins = cat_client.plugins.get_available_plugins()

RabbitHole API - Upload a URL

from cheshire_cat_api.models.body_upload_url import BodyUploadUrl

# Please note that interacting with the RabbitHole to upload
# a URL requires structuring the body like this

body_upload_url = BodyUploadUrl(
    url="https://cheshire-cat-ai.github.io/docs/conceptual/cheshire_cat/rabbit_hole/"
)

# then you can make the request as follows
response = cat_client.rabbit_hole.upload_url(body_upload_url)

Send a WebSocket message

import time
import cheshire_cat_api as ccat

# 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 API
cat_client.connect_ws()

while not cat_client.is_ws_connected: 
# A better handling is strongly advised to avoid an infinite loop 
    time.sleep(1)
    
# Send the message
cat_client.send(message="Hello Cat!")

# Close connection
cat_client.close()

Documentation for Config

Both the classes are available with:

from cheshire_cat_api import Config
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

Low-level API

For a more advanced usage, you can directly interact with the auto-generated client. For documentation see here

Metadata

Release files for cheshire_cat_api 1.4.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cheshire_cat_api 1.4.9
File Size Uploaded
cheshire_cat_api-1.4.9.tar.gz 31.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cheshire_cat_api 1.4.9
File Interpreter ABI Platform
cheshire_cat_api-1.4.9-py3-none-any.whl Python 3 none any Details

Total release size: 80.8 kB

Release files / cheshire_cat_api-1.4.9.tar.gz

Download URL cheshire_cat_api-1.4.9.tar.gz
Size 31.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c3eb0d17f0b8003871a70315d558e4d20ad2a123322dd7b5f08a4310e799a4e2
BLAKE2b-256 checksum
How to use checksums
fdc3f0002343a0251300bef114c1803c72a2bc51bb9de1d3f3e68f50abda1991
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.11.0 Linux/6.8.0-1020-azure

Release files / cheshire_cat_api-1.4.9-py3-none-any.whl

Download URL cheshire_cat_api-1.4.9-py3-none-any.whl
Size 49.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddd831b05d0afa31ab7ae642ca1612326ff3801ce7b9d672851beb1c67d93544
BLAKE2b-256 checksum
How to use checksums
aa652d0664bc3bf455464cdd18032806e4a6c82ea2bd02ed82f1c8363cc1d55d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.11.0 Linux/6.8.0-1020-azure

Release history Release notifications | RSS feed

This release

1.4.9 This release

2 release files

1.4.8

1 release file

1.4.1

2 release files

1.4

2 release files

1.3.1

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page