# Cheshire Cat API client
API to develop Python clients to interact with the Cheshire Cat.
The package allows to instantiate a [WebSocket](#documentation-for-websocket) client and provides the API to interact with all the [endpoints](#documentation-for-api-endpoints).
A part of this Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
For a deeper documentation about the available endpoints please, refers to the API [ReDoc](http://localhost:1865/redoc).
The official Cheshire Cat documentation is available [here](https://cheshire-cat-ai.github.io/docs/).
## Requirements.
Python 3.10
## Installation & Usage
### pip install
You can install the API with `pip`:
```sh
pip install cheshire-cat-api
```
Then import the package:
```python
import cheshire_cat_api as ccat
```
### Tests
Execute `pytest` to run the tests.
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following.
### Send a message via WebSocket
```python
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](#documentation-for-models)
```python
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:
```python
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**](docs/MemoryApi.md#delete_element_in_memory) | **DELETE** /memory/point/{collection_id}/{memory_id}/ | Delete Element In Memory |
| *MemoryApi* | [**get_collections**](docs/MemoryApi.md#get_collections) | **GET** /memory/collections/ | Get Collections |
| *MemoryApi* | [**recall_memories_from_text**](docs/MemoryApi.md#recall_memories_from_text) | **GET** /memory/recall/ | Recall Memories From Text |
| *MemoryApi* | [**wipe_collections**](docs/MemoryApi.md#wipe_collections) | **DELETE** /memory/wipe-collections/ | Wipe Collections |
| *MemoryApi* | [**wipe_conversation_history**](docs/MemoryApi.md#wipe_conversation_history) | **DELETE** /memory/working-memory/conversation-history/ | Wipe Conversation History |
| *MemoryApi* | [**wipe_single_collection**](docs/MemoryApi.md#wipe_single_collection) | **DELETE** /memory/collections/{collection_id} | Wipe Single Collection |
| *PluginsApi* | [**delete_plugin**](docs/PluginsApi.md#delete_plugin) | **DELETE** /plugins/{plugin_id} | Delete Plugin |
| *PluginsApi* | [**get_plugin_details**](docs/PluginsApi.md#get_plugin_details) | **GET** /plugins/{plugin_id} | Get Plugin Details |
| *PluginsApi* | [**get_plugin_settings**](docs/PluginsApi.md#get_plugin_settings) | **GET** /plugins/settings/{plugin_id} | Get Plugin Settings |
| *PluginsApi* | [**install_plugin**](docs/PluginsApi.md#install_plugin) | **POST** /plugins/upload/ | Install Plugin |
| *PluginsApi* | [**list_available_plugins**](docs/PluginsApi.md#list_available_plugins) | **GET** /plugins/ | List Available Plugins |
| *PluginsApi* | [**toggle_plugin**](docs/PluginsApi.md#toggle_plugin) | **PUT** /plugins/toggle/{plugin_id} | Toggle Plugin |
| *PluginsApi* | [**upsert_plugin_settings**](docs/PluginsApi.md#upsert_plugin_settings) | **PUT** /plugins/settings/{plugin_id} | Upsert Plugin Settings |
| *RabbitHoleApi* | [**upload_file**](docs/RabbitHoleApi.md#upload_file) | **POST** /rabbithole/ | Upload File |
| *RabbitHoleApi* | [**upload_memory**](docs/RabbitHoleApi.md#upload_memory) | **POST** /rabbithole/memory/ | Upload Memory |
| *RabbitHoleApi* | [**upload_url**](docs/RabbitHoleApi.md#upload_url) | **POST** /rabbithole/web/ | Upload Url |
| *SettingsEmbedderApi* | [**get_embedder_settings**](docs/SettingsEmbedderApi.md#get_embedder_settings) | **GET** /settings/embedder/ | Get Embedder Settings |
| *SettingsEmbedderApi* | [**upsert_embedder_setting**](docs/SettingsEmbedderApi.md#upsert_embedder_setting) | **PUT** /settings/embedder/{languageEmbedderName} | Upsert Embedder Setting |
| *SettingsGeneralApi* | [**create_setting**](docs/SettingsGeneralApi.md#create_setting) | **POST** /settings/ | Create Setting |
| *SettingsGeneralApi* | [**delete_setting**](docs/SettingsGeneralApi.md#delete_setting) | **DELETE** /settings/{settingId} | Delete Setting |
| *SettingsGeneralApi* | [**get_setting**](docs/SettingsGeneralApi.md#get_setting) | **GET** /settings/{settingId} | Get Setting |
| *SettingsGeneralApi* | [**get_settings**](docs/SettingsGeneralApi.md#get_settings) | **GET** /settings/ | Get Settings |
| *SettingsGeneralApi* | [**update_setting**](docs/SettingsGeneralApi.md#update_setting) | **PUT** /settings/{settingId} | Update Setting |
| *SettingsLargeLanguageModelApi* | [**get_llm_settings**](docs/SettingsLargeLanguageModelApi.md#get_llm_settings) | **GET** /settings/llm/ | Get Llm Settings |
| *SettingsLargeLanguageModelApi* | [**upsert_llm_setting**](docs/SettingsLargeLanguageModelApi.md#upsert_llm_setting) | **PUT** /settings/llm/{languageModelName} | Upsert Llm Setting |
| *SettingsPromptApi* | [**get_default_prompt_settings**](docs/SettingsPromptApi.md#get_default_prompt_settings) | **GET** /settings/prompt/ | Get Default Prompt Settings |
| *StatusApi* | [**home**](docs/StatusApi.md#home) | **GET** / | Home |
## Documentation For Models
- [BodyUploadUrl](docs/BodyUploadUrl.md)
- [HTTPValidationError](docs/HTTPValidationError.md)
- [LocationInner](docs/LocationInner.md)
- [SettingBody](docs/SettingBody.md)
- [ValidationError](docs/ValidationError.md)
Raw data
{
"_id": null,
"home_page": "https://cheshirecat.ai/",
"name": "cheshire-cat-api",
"maintainer": "Nicola Corbellini",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "OpenAPI,Cheshire-Cat,LLM,Open Source",
"author": "Chesire Cat AI",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/77/d6/61b4158a9bd80b39106bc4d065b7ff6a755573ac77a02a6a79f5b7838686/cheshire_cat_api-1.0.1.tar.gz",
"platform": null,
"description": "# Cheshire Cat API client\nAPI to develop Python clients to interact with the Cheshire Cat.\n\nThe package allows to instantiate a [WebSocket](#documentation-for-websocket) client and provides the API to interact with all the [endpoints](#documentation-for-api-endpoints).\n\nA part of this Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project.\n\nFor a deeper documentation about the available endpoints please, refers to the API [ReDoc](http://localhost:1865/redoc).\nThe official Cheshire Cat documentation is available [here](https://cheshire-cat-ai.github.io/docs/).\n\n## Requirements.\n\nPython 3.10\n\n## Installation & Usage\n### pip install\n\nYou can install the API with `pip`:\n\n```sh\npip install cheshire-cat-api\n```\n\nThen import the package:\n```python\nimport cheshire_cat_api as ccat\n```\n\n### Tests\n\nExecute `pytest` to run the tests.\n\n## Getting Started\n\nPlease follow the [installation procedure](#installation--usage) and then run the following.\n\n### Send a message via WebSocket\n\n```python\nimport cheshire_cat_api as ccat\n\n# Define the cat client manager with default settings and send a message to the server via WebSocket.\ncat_client = ccat.CatClient() \ncat_client.send(message=\"Hello Cat!\")\n\ncat_client.close()\n```\n\n### Interact with the Endpoints\n\nwhere required, the data models are documented [here](#documentation-for-models)\n```python\nimport cheshire_cat_api as ccat\n\ncat_client = ccat.CatClient()\n\n# All the endpoints are exposed under the `api` module\n# For example you can retrieve a list of the available plugins\nplugins = cat_client.api.plugins.list_available_plugins()\n\n# Please note that interacting with the RabbitHole to upload\n# a URL requires to structure the body like this\nfrom cheshire_cat_api.models.body_upload_url import BodyUploadUrl\n\nbody_upload_url = BodyUploadUrl(\n url=\"https://cheshire-cat-ai.github.io/docs/conceptual/cheshire_cat/rabbit_hole/\",\n chunk_size=400,\n chunk_overlap=100,\n summary=False\n)\n\n# then you can make the request as follows\nresponse = cat_client.api.rabbit_hole.upload_url(body_upload_url)\n```\n\n## Documentation for WebSocket\n\nBoth the classes are available with:\n```python\nfrom cheshire_cat_api import Settings, WebSocketSettings\n```\n\n| Class | Name | Default | Description |\n|---------------------|------------|-------------|----------------------------------------------------------------------------------------------------------------------|\n| *Settings* | `base_url` | 'localhost' | base URL where the Cat is hosted |\n| *Settings* | `auth_key` | '' | authentication key for the endpoints |\n| *Settings* | `port` | 1865 | port for the connection |\n| *Settings* | `secure` | False | if to instantiate a secure connection, i.e. `wss://` |\n| *Settings* | `timeout` | 10000 | timeout for the endpoints |\n| *Settings* | `instant` | True | if true the websocket connection is instantiated immediately, otherwise you can connect later with `CatClient.run()` |\n| *WebSocketSettings* | `path` | 'ws' | the websocket path |\n| *WebSocketSettings* | `retries` | 3 | maximum number of retries before calling `on_failed` event |\n| *WebSocketSettings* | `delay` | 5000 | delay for reconnect, in milliseconds |\n\n## Documentation for API Endpoints\n\nAll URIs are relative to *http://localhost*\n\n| Class | Method | HTTP request | Description |\n|---------------------------------|------------------------------------------------------------------------------------------|---------------------------------------------------------|-----------------------------|\n| *MemoryApi* | [**delete_element_in_memory**](docs/MemoryApi.md#delete_element_in_memory) | **DELETE** /memory/point/{collection_id}/{memory_id}/ | Delete Element In Memory |\n| *MemoryApi* | [**get_collections**](docs/MemoryApi.md#get_collections) | **GET** /memory/collections/ | Get Collections |\n| *MemoryApi* | [**recall_memories_from_text**](docs/MemoryApi.md#recall_memories_from_text) | **GET** /memory/recall/ | Recall Memories From Text |\n| *MemoryApi* | [**wipe_collections**](docs/MemoryApi.md#wipe_collections) | **DELETE** /memory/wipe-collections/ | Wipe Collections |\n| *MemoryApi* | [**wipe_conversation_history**](docs/MemoryApi.md#wipe_conversation_history) | **DELETE** /memory/working-memory/conversation-history/ | Wipe Conversation History |\n| *MemoryApi* | [**wipe_single_collection**](docs/MemoryApi.md#wipe_single_collection) | **DELETE** /memory/collections/{collection_id} | Wipe Single Collection |\n| *PluginsApi* | [**delete_plugin**](docs/PluginsApi.md#delete_plugin) | **DELETE** /plugins/{plugin_id} | Delete Plugin |\n| *PluginsApi* | [**get_plugin_details**](docs/PluginsApi.md#get_plugin_details) | **GET** /plugins/{plugin_id} | Get Plugin Details |\n| *PluginsApi* | [**get_plugin_settings**](docs/PluginsApi.md#get_plugin_settings) | **GET** /plugins/settings/{plugin_id} | Get Plugin Settings |\n| *PluginsApi* | [**install_plugin**](docs/PluginsApi.md#install_plugin) | **POST** /plugins/upload/ | Install Plugin |\n| *PluginsApi* | [**list_available_plugins**](docs/PluginsApi.md#list_available_plugins) | **GET** /plugins/ | List Available Plugins |\n| *PluginsApi* | [**toggle_plugin**](docs/PluginsApi.md#toggle_plugin) | **PUT** /plugins/toggle/{plugin_id} | Toggle Plugin |\n| *PluginsApi* | [**upsert_plugin_settings**](docs/PluginsApi.md#upsert_plugin_settings) | **PUT** /plugins/settings/{plugin_id} | Upsert Plugin Settings |\n| *RabbitHoleApi* | [**upload_file**](docs/RabbitHoleApi.md#upload_file) | **POST** /rabbithole/ | Upload File |\n| *RabbitHoleApi* | [**upload_memory**](docs/RabbitHoleApi.md#upload_memory) | **POST** /rabbithole/memory/ | Upload Memory |\n| *RabbitHoleApi* | [**upload_url**](docs/RabbitHoleApi.md#upload_url) | **POST** /rabbithole/web/ | Upload Url |\n| *SettingsEmbedderApi* | [**get_embedder_settings**](docs/SettingsEmbedderApi.md#get_embedder_settings) | **GET** /settings/embedder/ | Get Embedder Settings |\n| *SettingsEmbedderApi* | [**upsert_embedder_setting**](docs/SettingsEmbedderApi.md#upsert_embedder_setting) | **PUT** /settings/embedder/{languageEmbedderName} | Upsert Embedder Setting |\n| *SettingsGeneralApi* | [**create_setting**](docs/SettingsGeneralApi.md#create_setting) | **POST** /settings/ | Create Setting |\n| *SettingsGeneralApi* | [**delete_setting**](docs/SettingsGeneralApi.md#delete_setting) | **DELETE** /settings/{settingId} | Delete Setting |\n| *SettingsGeneralApi* | [**get_setting**](docs/SettingsGeneralApi.md#get_setting) | **GET** /settings/{settingId} | Get Setting |\n| *SettingsGeneralApi* | [**get_settings**](docs/SettingsGeneralApi.md#get_settings) | **GET** /settings/ | Get Settings |\n| *SettingsGeneralApi* | [**update_setting**](docs/SettingsGeneralApi.md#update_setting) | **PUT** /settings/{settingId} | Update Setting |\n| *SettingsLargeLanguageModelApi* | [**get_llm_settings**](docs/SettingsLargeLanguageModelApi.md#get_llm_settings) | **GET** /settings/llm/ | Get Llm Settings |\n| *SettingsLargeLanguageModelApi* | [**upsert_llm_setting**](docs/SettingsLargeLanguageModelApi.md#upsert_llm_setting) | **PUT** /settings/llm/{languageModelName} | Upsert Llm Setting |\n| *SettingsPromptApi* | [**get_default_prompt_settings**](docs/SettingsPromptApi.md#get_default_prompt_settings) | **GET** /settings/prompt/ | Get Default Prompt Settings |\n| *StatusApi* | [**home**](docs/StatusApi.md#home) | **GET** / | Home |\n\n## Documentation For Models\n\n - [BodyUploadUrl](docs/BodyUploadUrl.md)\n - [HTTPValidationError](docs/HTTPValidationError.md)\n - [LocationInner](docs/LocationInner.md)\n - [SettingBody](docs/SettingBody.md)\n - [ValidationError](docs/ValidationError.md)\n\n\n\n\n\n",
"bugtrack_url": null,
"license": "GPL-3.0-only",
"summary": "\ud83d\ude38 Cheshire-Cat API Client",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://cheshirecat.ai/",
"Repository": "https://github.com/cheshire-cat-ai/cheshire-cat-api"
},
"split_keywords": [
"openapi",
"cheshire-cat",
"llm",
"open source"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a4ece02e6015d02a91239b9dfa639d9ae492b9ac17c45d70e35aceb43443262c",
"md5": "b0f7cc1fb808753857933d795356c876",
"sha256": "1c9acdb535cce55791aa652e73a865dca5a93f569975fbaea0d754032d59b921"
},
"downloads": -1,
"filename": "cheshire_cat_api-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b0f7cc1fb808753857933d795356c876",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 52012,
"upload_time": "2023-08-16T16:33:42",
"upload_time_iso_8601": "2023-08-16T16:33:42.269460Z",
"url": "https://files.pythonhosted.org/packages/a4/ec/e02e6015d02a91239b9dfa639d9ae492b9ac17c45d70e35aceb43443262c/cheshire_cat_api-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "77d661b4158a9bd80b39106bc4d065b7ff6a755573ac77a02a6a79f5b7838686",
"md5": "4d765fac5e2640c25808932cd68f53aa",
"sha256": "968b63361ac425b72ac4067d35dc4e852ed0a3751dafd3a1ccff7c119a93ecb4"
},
"downloads": -1,
"filename": "cheshire_cat_api-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "4d765fac5e2640c25808932cd68f53aa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 31928,
"upload_time": "2023-08-16T16:33:43",
"upload_time_iso_8601": "2023-08-16T16:33:43.305785Z",
"url": "https://files.pythonhosted.org/packages/77/d6/61b4158a9bd80b39106bc4d065b7ff6a755573ac77a02a6a79f5b7838686/cheshire_cat_api-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-16 16:33:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cheshire-cat-ai",
"github_project": "cheshire-cat-api",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "cheshire-cat-api"
}