😸 Cheshire-Cat API Client
Project description
Cheshire Cat API client
API to develop Python clients to interact with the Cheshire Cat.
The package allows to instantiate 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 a deeper documentation about the available endpoints please, refers 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
Tests
Execute pytest
to run the tests.
Getting Started
Please follow the installation procedure and then run the following.
Send a message via WebSocket
import cheshire_cat_api as ccat
# Define the cat client manager with default settings and send a message to the server via WebSocket.
cat_client = ccat.CatClient()
cat_client.send(message="Hello Cat!")
cat_client.close()
Interact with the Endpoints
where required, the data models are documented here
import cheshire_cat_api as ccat
cat_client = ccat.CatClient()
# All the endpoints are exposed under the `api` module
# For example you can retrieve a list of the available plugins
plugins = cat_client.api.plugins.list_available_plugins()
# Please note that interacting with the RabbitHole to upload
# a URL requires to structure the body like this
from cheshire_cat_api.models.body_upload_url import BodyUploadUrl
body_upload_url = BodyUploadUrl(
url="https://cheshire-cat-ai.github.io/docs/conceptual/cheshire_cat/rabbit_hole/",
chunk_size=400,
chunk_overlap=100,
summary=False
)
# then you can make the request as follows
response = cat_client.api.rabbit_hole.upload_url(body_upload_url)
Documentation for WebSocket
Both the classes are available with:
from cheshire_cat_api import Settings, WebSocketSettings
Class | Name | Default | Description |
---|---|---|---|
Settings | base_url |
'localhost' | base URL where the Cat is hosted |
Settings | auth_key |
'' | authentication key for the endpoints |
Settings | port |
1865 | port for the connection |
Settings | secure |
False | if to instantiate a secure connection, i.e. wss:// |
Settings | timeout |
10000 | timeout for the endpoints |
Settings | instant |
True | if true the websocket connection is instantiated immediately, otherwise you can connect later with CatClient.run() |
WebSocketSettings | path |
'ws' | the websocket path |
WebSocketSettings | retries |
3 | maximum number of retries before calling on_failed event |
WebSocketSettings | delay |
5000 | delay for reconnect, in milliseconds |
Documentation for API Endpoints
All URIs are relative to http://localhost
Class | Method | HTTP request | Description |
---|---|---|---|
MemoryApi | delete_element_in_memory | DELETE /memory/point/{collection_id}/{memory_id}/ | Delete Element In Memory |
MemoryApi | get_collections | GET /memory/collections/ | Get Collections |
MemoryApi | recall_memories_from_text | GET /memory/recall/ | Recall Memories From Text |
MemoryApi | wipe_collections | DELETE /memory/wipe-collections/ | Wipe Collections |
MemoryApi | wipe_conversation_history | DELETE /memory/working-memory/conversation-history/ | Wipe Conversation History |
MemoryApi | wipe_single_collection | DELETE /memory/collections/{collection_id} | Wipe Single Collection |
PluginsApi | delete_plugin | DELETE /plugins/{plugin_id} | Delete Plugin |
PluginsApi | get_plugin_details | GET /plugins/{plugin_id} | Get Plugin Details |
PluginsApi | get_plugin_settings | GET /plugins/settings/{plugin_id} | Get Plugin Settings |
PluginsApi | install_plugin | POST /plugins/upload/ | Install Plugin |
PluginsApi | list_available_plugins | GET /plugins/ | List Available Plugins |
PluginsApi | toggle_plugin | PUT /plugins/toggle/{plugin_id} | Toggle Plugin |
PluginsApi | upsert_plugin_settings | PUT /plugins/settings/{plugin_id} | Upsert Plugin Settings |
RabbitHoleApi | upload_file | POST /rabbithole/ | Upload File |
RabbitHoleApi | upload_memory | POST /rabbithole/memory/ | Upload Memory |
RabbitHoleApi | upload_url | POST /rabbithole/web/ | Upload Url |
SettingsEmbedderApi | get_embedder_settings | GET /settings/embedder/ | Get Embedder Settings |
SettingsEmbedderApi | upsert_embedder_setting | PUT /settings/embedder/{languageEmbedderName} | Upsert Embedder Setting |
SettingsGeneralApi | create_setting | POST /settings/ | Create Setting |
SettingsGeneralApi | delete_setting | DELETE /settings/{settingId} | Delete Setting |
SettingsGeneralApi | get_setting | GET /settings/{settingId} | Get Setting |
SettingsGeneralApi | get_settings | GET /settings/ | Get Settings |
SettingsGeneralApi | update_setting | PUT /settings/{settingId} | Update Setting |
SettingsLargeLanguageModelApi | get_llm_settings | GET /settings/llm/ | Get Llm Settings |
SettingsLargeLanguageModelApi | upsert_llm_setting | PUT /settings/llm/{languageModelName} | Upsert Llm Setting |
SettingsPromptApi | get_default_prompt_settings | GET /settings/prompt/ | Get Default Prompt Settings |
StatusApi | home | GET / | Home |
Documentation For Models
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cheshire_cat_api-1.3.1.tar.gz
.
File metadata
- Download URL: cheshire_cat_api-1.3.1.tar.gz
- Upload date:
- Size: 34.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.11.0 Linux/6.2.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c06698c934ae1b5424d9b30e2cac6e1537d72cdb20eb26e9d76ae43228abf9f |
|
MD5 | 7cd5b52e1b2729720e624da58afd8c2d |
|
BLAKE2b-256 | c79096601cb89f81063fdfe30dc71cbe6ef4a071d535963ab8dcae4d86e7be90 |
File details
Details for the file cheshire_cat_api-1.3.1-py3-none-any.whl
.
File metadata
- Download URL: cheshire_cat_api-1.3.1-py3-none-any.whl
- Upload date:
- Size: 50.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.11.0 Linux/6.2.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fefc84db69ff1ba6ff1e9112b0eb0e1c0e7e58e561b4ffdbdd7c3b8dd09f59be |
|
MD5 | 209b047162ffab03e1905f0cb09abd7c |
|
BLAKE2b-256 | b511c940f6771a0e3b85959369baa7ebe4f4d759ddce1c80d9727a9b269d62cf |