cheshire_cat_api


Namecheshire_cat_api JSON
Version 1.4.8 PyPI version JSON
download
home_pagehttps://cheshirecat.ai/
Summary😸 Cheshire-Cat API Client
upload_time2024-02-25 20:20:00
maintainerNicola Corbellini
docs_urlNone
authorChesire Cat AI
requires_python>=3.10,<4.0
licenseGPL-3.0-only
keywords openapi cheshire-cat llm opensource
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Cheshire Cat API client
API to develop Python clients to interact with the Cheshire Cat.

The package allows instantiating 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 deeper documentation about the available endpoints, please refer 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.)

### 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

```python
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

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

#### RabbitHole API - Upload a URL

```python
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

```python
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:
```python
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](docs/)

[//]: # (## Documentation for API Endpoints)

[//]: # ()
[//]: # (All URIs are relative to *http://localhost*)

[//]: # ()
[//]: # (| Class                           | Method        | HTTP request                                            | Description                 |)

[//]: # (|---------------------------------|---------------|---------------------------------------------------------|-----------------------------|)

[//]: # (| *MemoryApi*                     | **wipe_memory_point** | **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      |)

[//]: # (| *MemoryApi*                    | **get_conversation_history** | **GET** /memory/conversation_history/ |)

[//]: # (| **Memory**)

[//]: # (| *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)

[//]: # ()
[//]: # ( - [BodyUploadUrl]&#40;docs/BodyUploadUrl.md&#41;)

[//]: # ( - [HTTPValidationError]&#40;docs/HTTPValidationError.md&#41;)

[//]: # ( - [LocationInner]&#40;docs/LocationInner.md&#41;)

[//]: # ( - [SettingBody]&#40;docs/SettingBody.md&#41;)

[//]: # ( - [ValidationError]&#40;docs/ValidationError.md&#41;)





            

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,OpenSource",
    "author": "Chesire Cat AI",
    "author_email": "",
    "download_url": "",
    "platform": null,
    "description": "# Cheshire Cat API client\nAPI to develop Python clients to interact with the Cheshire Cat.\n\nThe package allows instantiating 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 deeper documentation about the available endpoints, please refer 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\n[//]: # ()\n[//]: # (Execute `pytest` to run the tests.)\n\n### Interact with the HTTP Endpoints\n\n## Available APIs\n\nThe `CatClient` has the following attributes to easily interface with the related APis:\n\n- memory\n- plugins\n- rabbit_hole\n- status\n- embedder\n- settings\n- llm\n\n#### Instantiate connection\n\n```python\nimport cheshire_cat_api as ccat\n\n# A config is necessary to set up base parameters like\n# URL, port, user_id, etc.\nconfig = ccat.Config(user_id=\"my_user_42\")\n\n# Connect to the API\ncat_client = ccat.CatClient(\n    config=config\n)\n```\n\n#### Plugin API - Retrieve plugins\n\n```python\n# Now retrieve a list of the available plugins\nplugins = cat_client.plugins.get_available_plugins()\n```\n\n#### RabbitHole API - Upload a URL\n\n```python\nfrom cheshire_cat_api.models.body_upload_url import BodyUploadUrl\n\n# Please note that interacting with the RabbitHole to upload\n# a URL requires structuring the body like this\n\nbody_upload_url = BodyUploadUrl(\n    url=\"https://cheshire-cat-ai.github.io/docs/conceptual/cheshire_cat/rabbit_hole/\"\n)\n\n# then you can make the request as follows\nresponse = cat_client.rabbit_hole.upload_url(body_upload_url)\n```\n\n### Send a WebSocket message\n\n```python\nimport time\nimport cheshire_cat_api as ccat\n\n# A config is necessary to set up base parameters like\n# URL, port, user_id, etc.\nconfig = ccat.Config(user_id=\"my_user_42\")\ncat_client = ccat.CatClient(config=config)\n\n# Connect to the WebSocket API\ncat_client.connect_ws()\n\nwhile not cat_client.is_ws_connected: \n# A better handling is strongly advised to avoid an infinite loop \n    time.sleep(1)\n    \n# Send the message\ncat_client.send(message=\"Hello Cat!\")\n\n# Close connection\ncat_client.close()\n```\n\n## Documentation for Config\n\nBoth the classes are available with:\n```python\nfrom cheshire_cat_api import Config\n```\n\n| Class    | Name                | Default     | Description                               |\n|----------|---------------------|-------------|-------------------------------------------|\n| *Config* | `base_url`          | \"localhost\" | base URL where the Cat is hosted          |\n| *Config* | `port`              | 1865        | port for the connection                   |\n| *Config* | `user_id`           | \"user\"      | id of the client                          |\n| *Config* | `auth_key`          | \"\"          | authentication key for the http endpoints |\n| *Config* | `secure_connection` | False       | if to use secure protocol                 |\n\n## Low-level API\n\nFor a more advanced usage, you can directly interact with the auto-generated client.\nFor documentation see [here](docs/)\n\n[//]: # (## Documentation for API Endpoints)\n\n[//]: # ()\n[//]: # (All URIs are relative to *http://localhost*)\n\n[//]: # ()\n[//]: # (| Class                           | Method        | HTTP request                                            | Description                 |)\n\n[//]: # (|---------------------------------|---------------|---------------------------------------------------------|-----------------------------|)\n\n[//]: # (| *MemoryApi*                     | **wipe_memory_point** | **DELETE** /memory/point/{collection_id}/{memory_id}/   | Delete Element In Memory    |)\n\n[//]: # (| *MemoryApi*                     | **get_collections** | **GET** /memory/collections/                            | Get Collections             |)\n\n[//]: # (| *MemoryApi*                     | **recall_memories_from_text** | **GET** /memory/recall/                                 | Recall Memories From Text   |)\n\n[//]: # (| *MemoryApi*                     | **wipe_collections** | **DELETE** /memory/wipe-collections/                    | Wipe Collections            |)\n\n[//]: # (| *MemoryApi*                     | **wipe_conversation_history** | **DELETE** /memory/working-memory/conversation-history/ | Wipe Conversation History   |)\n\n[//]: # (| *MemoryApi*                     | **wipe_single_collection** | **DELETE** /memory/collections/{collection_id}          | Wipe Single Collection      |)\n\n[//]: # (| *MemoryApi*                    | **get_conversation_history** | **GET** /memory/conversation_history/ |)\n\n[//]: # (| **Memory**)\n\n[//]: # (| *PluginsApi*                    | **delete_plugin** | **DELETE** /plugins/{plugin_id}                         | Delete Plugin               |)\n\n[//]: # (| *PluginsApi*                    | **get_plugin_details** | **GET** /plugins/{plugin_id}                            | Get Plugin Details          |)\n\n[//]: # (| *PluginsApi*                    | **get_plugin_settings** | **GET** /plugins/settings/{plugin_id}                   | Get Plugin Settings         |)\n\n[//]: # (| *PluginsApi*                    | **install_plugin** | **POST** /plugins/upload/                               | Install Plugin              |)\n\n[//]: # (| *PluginsApi*                    | **list_available_plugins** | **GET** /plugins/                                       | List Available Plugins      |)\n\n[//]: # (| *PluginsApi*                    | **toggle_plugin** | **PUT** /plugins/toggle/{plugin_id}                     | Toggle Plugin               |)\n\n[//]: # (| *PluginsApi*                    | **upsert_plugin_settings** | **PUT** /plugins/settings/{plugin_id}                   | Upsert Plugin Settings      |)\n\n[//]: # (| *RabbitHoleApi*                 | **upload_file** | **POST** /rabbithole/                                   | Upload File                 |)\n\n[//]: # (| *RabbitHoleApi*                 | **upload_memory** | **POST** /rabbithole/memory/                            | Upload Memory               |)\n\n[//]: # (| *RabbitHoleApi*                 | **upload_url** | **POST** /rabbithole/web/                               | Upload Url                  |)\n\n[//]: # (| *SettingsEmbedderApi*           | **get_embedder_settings** | **GET** /settings/embedder/                             | Get Embedder Settings       |)\n\n[//]: # (| *SettingsEmbedderApi*           | **upsert_embedder_setting** | **PUT** /settings/embedder/{languageEmbedderName}       | Upsert Embedder Setting     |)\n\n[//]: # (| *SettingsGeneralApi*            | **create_setting** | **POST** /settings/                                     | Create Setting              |)\n\n[//]: # (| *SettingsGeneralApi*            | **delete_setting** | **DELETE** /settings/{settingId}                        | Delete Setting              |)\n\n[//]: # (| *SettingsGeneralApi*            | **get_setting** | **GET** /settings/{settingId}                           | Get Setting                 |)\n\n[//]: # (| *SettingsGeneralApi*            | **get_settings** | **GET** /settings/                                      | Get Settings                |)\n\n[//]: # (| *SettingsGeneralApi*            | **update_setting** | **PUT** /settings/{settingId}                           | Update Setting              |)\n\n[//]: # (| *SettingsLargeLanguageModelApi* | **get_llm_settings** | **GET** /settings/llm/                                  | Get Llm Settings            |)\n\n[//]: # (| *SettingsLargeLanguageModelApi* | **upsert_llm_setting** | **PUT** /settings/llm/{languageModelName}               | Upsert Llm Setting          |)\n\n[//]: # (| *SettingsPromptApi*             | **get_default_prompt_settings** | **GET** /settings/prompt/                               | Get Default Prompt Settings |)\n\n[//]: # (| *StatusApi*                     | **home**      | **GET** /                                               | Home                        |)\n\n[//]: # (## Documentation For Models)\n\n[//]: # ()\n[//]: # ( - [BodyUploadUrl]&#40;docs/BodyUploadUrl.md&#41;)\n\n[//]: # ( - [HTTPValidationError]&#40;docs/HTTPValidationError.md&#41;)\n\n[//]: # ( - [LocationInner]&#40;docs/LocationInner.md&#41;)\n\n[//]: # ( - [SettingBody]&#40;docs/SettingBody.md&#41;)\n\n[//]: # ( - [ValidationError]&#40;docs/ValidationError.md&#41;)\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-only",
    "summary": "\ud83d\ude38 Cheshire-Cat API Client",
    "version": "1.4.8",
    "project_urls": {
        "Homepage": "https://cheshirecat.ai/",
        "Repository": "https://github.com/cheshire-cat-ai/cheshire-cat-api"
    },
    "split_keywords": [
        "openapi",
        "cheshire-cat",
        "llm",
        "opensource"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d033737779afbf774032a5a14b214c87bb5efbbb3bb42017dff2f4e05eadba40",
                "md5": "f3d8198294752bf19bcfa92d4ecde67c",
                "sha256": "9ad221d9e4537d97686d0e8d21f1576830be968a3816a223879e86ad299fbb91"
            },
            "downloads": -1,
            "filename": "cheshire_cat_api-1.4.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f3d8198294752bf19bcfa92d4ecde67c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 49266,
            "upload_time": "2024-02-25T20:20:00",
            "upload_time_iso_8601": "2024-02-25T20:20:00.213522Z",
            "url": "https://files.pythonhosted.org/packages/d0/33/737779afbf774032a5a14b214c87bb5efbbb3bb42017dff2f4e05eadba40/cheshire_cat_api-1.4.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-25 20:20:00",
    "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"
}
        
Elapsed time: 0.22634s