Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

API Client to communicate with the Cheshire Cat AI

NotificationsYou must be signed in to change notification settings

cheshire-cat-ai/api-client-py

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.

Requirements.

Python 3.10

Installation & Usage

pip install

You can install the API withpip:

pip install cheshire-cat-api

Then import the package:

importcheshire_cat_apiasccat

Interact with the HTTP Endpoints

Available APIs

TheCatClient has the following attributes to easily interface with the related APis:

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

Instantiate connection

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)

Plugin API - Retrieve plugins

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

RabbitHole API - Upload a URL

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)

Send a WebSocket message

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()

Documentation for Config

Both the classes are available with:

fromcheshire_cat_apiimportConfig
ClassNameDefaultDescription
Configbase_url"localhost"base URL where the Cat is hosted
Configport1865port for the connection
Configuser_id"user"id of the client
Configauth_key""authentication key for the http endpoints
Configsecure_connectionFalseif to use secure protocol

Low-level API

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

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp