forked from cheshire-cat-ai/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docs regarding vscode debugger, c# client, FAQ, Architecture and …
…forms (cheshire-cat-ai#146) * Vscode Debugger Document * C# client page * Documentations regarding FAQ, Architecture and forms * Update mkdocs/administrators/architecture.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/administrators/architecture.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/administrators/architecture.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/administrators/architecture.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/administrators/architecture.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/administrators/architecture.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/administrators/architecture.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/administrators/architecture.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/faq.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/technical/debugging/vscode.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/technical/debugging/vscode.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/technical/debugging/vscode.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/technical/debugging/vscode.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/technical/debugging/vscode.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/faq.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/faq.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/faq.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/faq.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/faq.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/faq.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/faq.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/technical/debugging/vscode.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/technical/debugging/vscode.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/technical/debugging/vscode.md Co-authored-by: Adelina <[email protected]> * Update mkdocs/technical/debugging/vscode.md Co-authored-by: Adelina <[email protected]> * English fixes * Validators link --------- Co-authored-by: Adelina <[email protected]>
- Loading branch information
1 parent
638026b
commit 5fd1a09
Showing
12 changed files
with
439 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,122 @@ | ||
# Architecture | ||
|
||
The Cheshire Cat framework consists of four components: the Core, the Vector Database, the LLM and the Admin Portal. | ||
The Cheshire Cat framework consists of four components: **the Core**, **the Vector Database**, **the LLM** and **the embedder**. | ||
|
||
The Core and the Admin Portal are implemented within the framework, while the Vector Database and the LLM are external dependencies. | ||
The Core and the Admin Portal are implemented within the framework, while the Vector Database, the LLM and the embedder are external dependencies. | ||
|
||
The Core communicates with both the Vector Database and the LLM, while The Admin Portal communicates with the Core. | ||
The Core communicates with the Vector Database, the LLM and the embedder, while The Admin Portal communicates with the Core. | ||
|
||
The Core is implemented in Python, Qdrant is utilized as Vector Database, the Core support different LLMs (see the [complete list](#compatible-llms) below), the Admin Portal is implemented using the Vue framework. | ||
The Core is implemented in Python, Qdrant is utilized as Vector Database, the Core support different LLMs and Embbeders (see the [complete list](#compatible-models) below), the Admin Portal is implemented using the Vue framework. | ||
|
||
## Docker Compose Images | ||
To facilitate, speed up, and standardize the Cat's user experience, the Cat contains configuration for use inside Docker. | ||
# Core | ||
|
||
When executing `docker compose build` two Docker images are generated. The first one contains the Cat Core and Admin Portal, while the second one contains the Vector Database. The container name of the core is `cheshire_cat_core` and the name of the Vector Database image is `cheshire_vector_memory`. | ||
## Docker Images | ||
|
||
The local Cat core path `./core` is mounted to the image `cheshire_cat_core`, by default changes to files in this folder force a restart of the Core, this behavior can be disable using the [`DEBUG`](env-variables.md/#debug) environment variables. | ||
To facilitate, speed up, and standardize the Cat's user experience, the Cat contains configuration for use inside Docker. | ||
|
||
As default the Admin Portal connect to the core using `localhost` and port `1678`, these values can be customized using [environment variables](env-variables.md#core_host). This port is the only one exposed by the `cheshire_cat_core` image. | ||
You can use the pre-compiled images present in the Repo's Docker Registry or build it from scratch: | ||
|
||
1. To use the pre-compiled image, add `ghcr.io/cheshire-cat-ai/core:<tag-version>` as value of `image` under the name of the service in the docker-compose: | ||
|
||
```yml | ||
cheshire-cat-core: | ||
image: ghcr.io/cheshire-cat-ai/core:1.5.1 | ||
``` | ||
2. To build it from scratch execute `docker compose build` in the repo folder just cloned. | ||
|
||
This will generate two Docker images. The first one contains the Cat Core and Admin Portal. | ||
The container name of the core is `cheshire_cat_core`. | ||
|
||
The Cat core path `./core` is mounted into the image `cheshire_cat_core`, by default changes to files in this folder force a restart of the Core, this behavior can be disabled using the [`DEBUG`](env-variables.md/#debug) environment variable. | ||
|
||
## Admin Portal | ||
|
||
The Admin Portal connects to the core using `localhost` through the port exposed when the container was created, this value can be customized using [environment variables](env-variables.md#core_host). This port is the only one exposed by the `cheshire_cat_core` image. | ||
|
||
## Logging | ||
|
||
All the log messages are printed on the standard output and log level can be configured with [`LOG_LEVEL`](env-variables.md#log_level) environment variables. You can check logging system documentation [here](../technical/plugins/logging.md). | ||
|
||
## Configuration | ||
|
||
Some options of the Core can be customized using [environment variables](env-variables.md). | ||
|
||
## Compatible LLMs | ||
TODO | ||
## Compatible Models | ||
|
||
The cat is agnostic, meaning You can attach your preferred llm and embedder model/provider. The Cat supports the most used ones, but you can increase the number of models/providers by [plugins](/technical/plugins/hooks/#__tabbed_1_5), here is a list of the main ones: | ||
|
||
1. OpenAI and Azure OpenAI | ||
2. Cohere | ||
3. Ollama (LLM model only) | ||
4. HuggingFace TextInference API (LLM model only) | ||
5. Google Gemini | ||
6. Qdrant FastEmbed (Embedder model only) | ||
|
||
# Vector Memory | ||
|
||
## What we use as vector memory? | ||
|
||
The Cat provides a connection to [qdrant](https://qdrant.tech/) through his Python client. | ||
By default the Core tries to connect to a Qdrant database, if the connection fails then it switches to the `local Qdrant database`. | ||
It is highly recommended to connect the Cat to a **Qdrant database** to increase performance and capacity! | ||
|
||
## Qdrant Cloud or Self Hosting | ||
|
||
**Qdrant** provides to 2 paths: | ||
|
||
1. Self-host Qdrant by using docker, follows an example docker-compose: | ||
|
||
```yml | ||
version: '3.7' | ||
services: | ||
cheshire-cat-core: | ||
image: ghcr.io/cheshire-cat-ai/core:1.5.1 | ||
container_name: cheshire_cat_core | ||
depends_on: | ||
- cheshire-cat-vector-memory | ||
environment: | ||
- PYTHONUNBUFFERED=1 | ||
- WATCHFILES_FORCE_POLLING=true | ||
- CORE_HOST=${CORE_HOST:-localhost} | ||
- CORE_PORT=${CORE_PORT:-1865} | ||
- QDRANT_HOST=${QDRANT_HOST:-cheshire_cat_vector_memory} | ||
- QDRANT_PORT=${QDRANT_PORT:-6333} | ||
- CORE_USE_SECURE_PROTOCOLS=${CORE_USE_SECURE_PROTOCOLS:-} | ||
- API_KEY=${API_KEY:-} | ||
- LOG_LEVEL=${LOG_LEVEL:-WARNING} | ||
- DEBUG=${DEBUG:-true} | ||
- SAVE_MEMORY_SNAPSHOTS=${SAVE_MEMORY_SNAPSHOTS:-false} | ||
ports: | ||
- ${CORE_PORT:-1865}:80 | ||
volumes: | ||
- ./cat/static:/app/cat/static | ||
- ./cat/plugins:/app/cat/plugins | ||
- ./cat/data:/app/cat/data | ||
restart: unless-stopped | ||
cheshire-cat-vector-memory: | ||
image: qdrant/qdrant:v1.7.1 | ||
container_name: cheshire_cat_vector_memory | ||
expose: | ||
- 6333 | ||
volumes: | ||
- ./cat/long_term_memory/vector:/qdrant/storage | ||
restart: unless-stopped | ||
``` | ||
|
||
2. Use Qdrant Cloud, by setting `QDRANT_HOST`, `QDRANT_PORT` and `QDRANT_API_KEY` Enviroment Variables. Follows an example of `.env` file: | ||
|
||
```bash | ||
# Qdrant server | ||
QDRANT_HOST=<url of the cluster> | ||
QDRANT_PORT=<port of the cluster, usually 6333> | ||
QDRANT_API_KEY=<api-key> | ||
``` | ||
|
||
# Admin Portal | ||
|
||
## Use case | ||
|
||
The Admin Portal is an administration/debugging panel to interact with the Cat by chatting, uploading files, exploring the memory, changing the LLM and Embedder Models while providing minimal authentication through an `api_key`. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# 🚀 Client Library C\# | ||
|
||
The Cheshire Cat provides a C# API client that allows you to chat with the Cat (using WebSocket) and provides APIs to interact with all the control plane endpoints. | ||
|
||
The package is public released on Github: | ||
[Cheshire Cat C# API Client](https://github.com/cheshire-cat-ai/api-client-csharp){:target="_blank"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,122 @@ | ||
# 🚀 Debug with Visual Studio Code | ||
|
||
The Plugin `Debug Server for VSCode` help you for debug with Visual Studio Code, install it from the [public plugins registry](../../plugins-registry/installing-plugin.md) and then follow the [instructions](https://github.com/sambarza/cc-vscode-debugpy){:target="_blank"} | ||
The `Debug Server for VSCode` plugin helps you to debug the Cat with Visual Studio Code, install it from the [public plugins registry](../../plugins-registry/installing-plugin.md) or [download the zip file](https://github.com/sambarza/cc-vscode-debugpy) (and follow the [Manual Instruction](../../plugins-registry/installing-plugin.md/#manual-installation)). | ||
|
||
## Add a new port to the container | ||
|
||
After the installation, you will need to expose a new port to the container: | ||
|
||
1. If you run the cat with `docker-compose`, expose the port by adding the following line under `ports` section: | ||
|
||
```yml | ||
ports: | ||
- ${CORE_PORT:-1865}:80 | ||
- 5678:5678 < --- add this line | ||
``` | ||
2. If you run the cat with `docker run`, expose the port by using the `-p <host>:<container>` argument in the command like so: | ||
|
||
```bash | ||
docker run --rm -it \ | ||
-v ./data:/app/cat/data \ | ||
-v ./plugins:/app/cat/plugins \ | ||
-p 1865:80 \ | ||
-p 5678:5678 \ < --- add this line | ||
ghcr.io/cheshire-cat-ai/core:latest | ||
``` | ||
|
||
## Configure vscode | ||
|
||
Once you have exposed the port, you will need to create a `launch.json` file having two different options: | ||
|
||
1. Use the `Run and Debug` tab to create it, selecting `Python Debugger` and then `Remote Attach` (Follow the prompts by answering with the default proposed). | ||
2. Create a folder in the root directory called `.vscode` and add the `launch.json` file into it. | ||
|
||
├── <name of the root directory> | ||
│ ├── core | ||
│ ├── .vscode | ||
│ │ ├──launch.json | ||
|
||
After the creation of the launch.json, Copy-Paste this config: | ||
|
||
1. If you run using `docker-compose`: | ||
|
||
```json | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python: Remote Attach to Cat", | ||
"type": "python", | ||
"request": "attach", | ||
"connect": { | ||
"host": "localhost", | ||
"port": 5678 | ||
}, | ||
"pathMappings": [ | ||
{ | ||
"localRoot": "${workspaceFolder}/core", | ||
"remoteRoot": "/app" | ||
} | ||
], | ||
"justMyCode": true | ||
} | ||
] | ||
} | ||
``` | ||
|
||
2. If you run using `docker run`: | ||
|
||
```json | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python: Remote Attach to Cat", | ||
"type": "python", | ||
"request": "attach", | ||
"connect": { | ||
"host": "localhost", | ||
"port": 5678 | ||
}, | ||
"pathMappings": [ | ||
{ | ||
"localRoot": "${workspaceFolder}/", | ||
"remoteRoot": "/app/cat" | ||
} | ||
], | ||
"justMyCode": true | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## Connect vscode to the cat | ||
|
||
To Connect the vscode debugger, ask the cat to help you on debugging ![ask help to debug](../../assets/img/vscode-debugger/image.png) and in the `Run and Debug` tab start the debugging by clicking the `Play button` ▶️ or Use the shortcut `F5`. | ||
|
||
![Enable The debugger](../../assets/img/vscode-debugger/run_debugger.png) | ||
|
||
You are ready to debug your plugin! | ||
|
||
If you are new in VS code debugging, check the [official docs](https://code.visualstudio.com/Docs/editor/debugging). | ||
|
||
## Troubleshooting | ||
|
||
#### I click the button but then I don't see the debugging bar / the breakpoints are not respected | ||
|
||
This usually means that the debugger is not active, make sure to activate the debugger by asking the Cat. | ||
|
||
#### I cannot explore the code outside of my plugin | ||
|
||
By default, you can only explore your "own" code but you can disable this by setting the param `justMyCode` to false in the `launch.json` file. | ||
|
||
#### My Cat is installed in a remote server, can I debug it? | ||
|
||
Of course you can! Just set the correct `host` and `port` in the `connect` param of the `launch.json` file. |
Oops, something went wrong.