cheshirecat-python-sdk 1.7.3__tar.gz → 1.7.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/PKG-INFO +1 -1
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/client.py +5 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/clients/http_client.py +5 -5
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/__init__.py +1 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/admins.py +1 -31
- cheshirecat_python_sdk-1.7.5/cheshirecat_python_sdk/endpoints/auth.py +42 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/base.py +2 -1
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/users.py +0 -28
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/utils.py +10 -1
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/pyproject.toml +1 -1
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/.gitignore +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/LICENSE +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/Makefile +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/README.md +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/__init__.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/builders/__init__.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/builders/base.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/builders/memory.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/builders/settings_input.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/builders/why.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/clients/__init__.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/clients/websocket_client.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/configuration.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/auth_handler.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/chunker.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/conversation.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/custom_endpoint.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/embedder.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/file_manager.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/health_check.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/large_language_model.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/memory.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/message.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/plugins.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/rabbit_hole.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/endpoints/vector_database.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/enums.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/api/admins.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/api/conversations.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/api/factories.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/api/file_managers.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/api/memories.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/api/messages.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/api/nested/memories.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/api/nested/plugins.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/api/plugins.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/api/rabbit_holes.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/api/tokens.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/api/users.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/dtos.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/utils.py +0 -0
- {cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/requirements.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cheshirecat-python-sdk
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.5
|
|
4
4
|
Summary: Python SDK for the Cloud-ready fork of the Cheshire Cat
|
|
5
5
|
Project-URL: Repository, https://github.com/matteocacciola/cheshirecat-python-sdk
|
|
6
6
|
Project-URL: Documentation, https://github.com/matteocacciola/cheshirecat-python-sdk#README
|
{cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/client.py
RENAMED
|
@@ -2,6 +2,7 @@ from cheshirecat_python_sdk.clients import HttpClient, WSClient
|
|
|
2
2
|
from cheshirecat_python_sdk.configuration import Configuration
|
|
3
3
|
from cheshirecat_python_sdk.endpoints import (
|
|
4
4
|
AdminsEndpoint,
|
|
5
|
+
AuthEndpoint,
|
|
5
6
|
AuthHandlerEndpoint,
|
|
6
7
|
ChunkerEndpoint,
|
|
7
8
|
ConversationEndpoint,
|
|
@@ -55,6 +56,10 @@ class CheshireCatClient:
|
|
|
55
56
|
def admins(self):
|
|
56
57
|
return AdminsEndpoint(self)
|
|
57
58
|
|
|
59
|
+
@property
|
|
60
|
+
def auth(self):
|
|
61
|
+
return AuthEndpoint(self)
|
|
62
|
+
|
|
58
63
|
@property
|
|
59
64
|
def auth_handler(self):
|
|
60
65
|
return AuthHandlerEndpoint(self)
|
|
@@ -40,19 +40,19 @@ class HttpClient:
|
|
|
40
40
|
if self.apikey:
|
|
41
41
|
self.headers["Authorization"] = f"Bearer {self.apikey}"
|
|
42
42
|
if self.agent_id:
|
|
43
|
-
self.headers["
|
|
43
|
+
self.headers["X-Agent-ID"] = self.agent_id
|
|
44
44
|
if self.user_id:
|
|
45
|
-
self.headers["
|
|
45
|
+
self.headers["X-User-ID"] = self.user_id
|
|
46
46
|
if self.chat_id:
|
|
47
|
-
self.headers["
|
|
47
|
+
self.headers["X-Chat-ID"] = self.chat_id
|
|
48
48
|
|
|
49
49
|
def __before_jwt_request(self):
|
|
50
50
|
if self.token:
|
|
51
51
|
self.headers["Authorization"] = f"Bearer {self.token}"
|
|
52
52
|
if self.agent_id:
|
|
53
|
-
self.headers["
|
|
53
|
+
self.headers["X-Agent-ID"] = self.agent_id
|
|
54
54
|
if self.chat_id:
|
|
55
|
-
self.headers["
|
|
55
|
+
self.headers["X-Chat-ID"] = self.chat_id
|
|
56
56
|
|
|
57
57
|
def get_client(
|
|
58
58
|
self,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from cheshirecat_python_sdk.endpoints.admins import AdminsEndpoint
|
|
2
|
+
from cheshirecat_python_sdk.endpoints.auth import AuthEndpoint
|
|
2
3
|
from cheshirecat_python_sdk.endpoints.auth_handler import AuthHandlerEndpoint
|
|
3
4
|
from cheshirecat_python_sdk.endpoints.chunker import ChunkerEndpoint
|
|
4
5
|
from cheshirecat_python_sdk.endpoints.conversation import ConversationEndpoint
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import List
|
|
1
|
+
from typing import List
|
|
2
2
|
|
|
3
3
|
from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint, MultipartPayload
|
|
4
4
|
from cheshirecat_python_sdk.models.api.admins import (
|
|
@@ -10,7 +10,6 @@ from cheshirecat_python_sdk.models.api.admins import (
|
|
|
10
10
|
)
|
|
11
11
|
from cheshirecat_python_sdk.models.api.nested.plugins import PluginSettingsOutput
|
|
12
12
|
from cheshirecat_python_sdk.models.api.plugins import PluginCollectionOutput, PluginsSettingsOutput, PluginToggleOutput
|
|
13
|
-
from cheshirecat_python_sdk.models.api.tokens import TokenOutput
|
|
14
13
|
from cheshirecat_python_sdk.utils import deserialize, file_attributes
|
|
15
14
|
|
|
16
15
|
|
|
@@ -19,35 +18,6 @@ class AdminsEndpoint(AbstractEndpoint):
|
|
|
19
18
|
super().__init__(client)
|
|
20
19
|
self.prefix = "/admins"
|
|
21
20
|
|
|
22
|
-
def token(self, username: str, password: str) -> TokenOutput:
|
|
23
|
-
"""
|
|
24
|
-
This endpoint is used to get a token for the user. The token is used to authenticate the user in the system.
|
|
25
|
-
When the token expires, the user must request a new token.
|
|
26
|
-
:param username: The username of the user.
|
|
27
|
-
:param password: The password of the user.
|
|
28
|
-
:return: TokenOutput, the token of the user.
|
|
29
|
-
"""
|
|
30
|
-
response = self.get_http_session().post(
|
|
31
|
-
self.format_url("/auth/token"),
|
|
32
|
-
json={"username": username, "password": password},
|
|
33
|
-
)
|
|
34
|
-
response.raise_for_status()
|
|
35
|
-
|
|
36
|
-
result = deserialize(response.json(), TokenOutput)
|
|
37
|
-
self.client.add_token(result.access_token)
|
|
38
|
-
return result
|
|
39
|
-
|
|
40
|
-
def get_available_permissions(self) -> dict[int | str, Any]:
|
|
41
|
-
"""
|
|
42
|
-
This endpoint is used to get a list of available permissions in the system. The permissions are used to define
|
|
43
|
-
the access rights of the users in the system. The permissions are defined by the system administrator.
|
|
44
|
-
:return array<int|string, Any>, the available permissions
|
|
45
|
-
"""
|
|
46
|
-
response = self.get_http_client().get(self.format_url("/auth/available-permissions"))
|
|
47
|
-
response.raise_for_status()
|
|
48
|
-
|
|
49
|
-
return response.json()
|
|
50
|
-
|
|
51
21
|
def post_admin(self, username: str, password: str, permissions: dict | None = None) -> AdminOutput:
|
|
52
22
|
"""
|
|
53
23
|
Create a new admin user.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint
|
|
4
|
+
from cheshirecat_python_sdk.models.api.tokens import TokenOutput
|
|
5
|
+
from cheshirecat_python_sdk.utils import deserialize
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AuthEndpoint(AbstractEndpoint):
|
|
9
|
+
def __init__(self, client: "CheshireCatClient"):
|
|
10
|
+
super().__init__(client)
|
|
11
|
+
self.prefix = "/auth"
|
|
12
|
+
|
|
13
|
+
def token(self, username: str, password: str, agent_id: str | None = None) -> TokenOutput:
|
|
14
|
+
"""
|
|
15
|
+
This endpoint is used to get a token for the user. The token is used to authenticate the user in the system. When
|
|
16
|
+
the token expires, the user must request a new token.
|
|
17
|
+
"""
|
|
18
|
+
response = self.get_http_session().post(
|
|
19
|
+
self.format_url("/token"),
|
|
20
|
+
json={
|
|
21
|
+
"username": username,
|
|
22
|
+
"password": password,
|
|
23
|
+
},
|
|
24
|
+
headers={"X-Agent-ID": agent_id} if agent_id else None,
|
|
25
|
+
)
|
|
26
|
+
response.raise_for_status()
|
|
27
|
+
|
|
28
|
+
result = deserialize(response.json(), TokenOutput)
|
|
29
|
+
self.client.add_token(result.access_token)
|
|
30
|
+
|
|
31
|
+
return result
|
|
32
|
+
|
|
33
|
+
def get_available_permissions(self) -> dict[int | str, Any]:
|
|
34
|
+
"""
|
|
35
|
+
This endpoint is used to get a list of available permissions in the system. The permissions are used to define
|
|
36
|
+
the access rights of the users in the system. The permissions are defined by the system administrator.
|
|
37
|
+
:return array<int|string, Any>, the available permissions
|
|
38
|
+
"""
|
|
39
|
+
response = self.get_http_client().get(self.format_url("/available-permissions"))
|
|
40
|
+
response.raise_for_status()
|
|
41
|
+
|
|
42
|
+
return response.json()
|
|
@@ -2,6 +2,7 @@ from abc import ABC
|
|
|
2
2
|
from typing import Dict, Any, List, Tuple, Type
|
|
3
3
|
import requests
|
|
4
4
|
from pydantic import BaseModel
|
|
5
|
+
from requests_toolbelt.sessions import BaseUrlSession
|
|
5
6
|
from websockets import ClientConnection
|
|
6
7
|
|
|
7
8
|
from cheshirecat_python_sdk.utils import T, deserialize
|
|
@@ -29,7 +30,7 @@ class AbstractEndpoint(ABC):
|
|
|
29
30
|
) -> requests.Session:
|
|
30
31
|
return self.client.http_client.get_client(agent_id, user_id, chat_id)
|
|
31
32
|
|
|
32
|
-
def get_http_session(self):
|
|
33
|
+
def get_http_session(self) -> BaseUrlSession:
|
|
33
34
|
return self.client.http_client.get_base_session()
|
|
34
35
|
|
|
35
36
|
async def get_ws_client(self, agent_id: str, user_id: str, chat_id: str | None = None) -> ClientConnection:
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from typing import Any, List, Dict
|
|
2
2
|
|
|
3
3
|
from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint
|
|
4
|
-
from cheshirecat_python_sdk.models.api.tokens import TokenOutput
|
|
5
4
|
from cheshirecat_python_sdk.models.api.users import UserOutput
|
|
6
5
|
from cheshirecat_python_sdk.utils import deserialize
|
|
7
6
|
|
|
@@ -11,33 +10,6 @@ class UsersEndpoint(AbstractEndpoint):
|
|
|
11
10
|
super().__init__(client)
|
|
12
11
|
self.prefix = "/users"
|
|
13
12
|
|
|
14
|
-
def token(self, username: str, password: str) -> TokenOutput:
|
|
15
|
-
"""
|
|
16
|
-
This endpoint is used to get a token for the user. The token is used to authenticate the user in the system. When
|
|
17
|
-
the token expires, the user must request a new token.
|
|
18
|
-
"""
|
|
19
|
-
response = self.get_http_session().post("/auth/token", json={
|
|
20
|
-
"username": username,
|
|
21
|
-
"password": password,
|
|
22
|
-
})
|
|
23
|
-
response.raise_for_status()
|
|
24
|
-
|
|
25
|
-
result = deserialize(response.json(), TokenOutput)
|
|
26
|
-
self.client.add_token(result.access_token)
|
|
27
|
-
|
|
28
|
-
return result
|
|
29
|
-
|
|
30
|
-
def get_available_permissions(self) -> dict[int | str, Any]:
|
|
31
|
-
"""
|
|
32
|
-
This endpoint is used to get a list of available permissions in the system. The permissions are used to define
|
|
33
|
-
the access rights of the users in the system. The permissions are defined by the system administrator.
|
|
34
|
-
:return array<int|string, Any>, the available permissions
|
|
35
|
-
"""
|
|
36
|
-
response = self.get_http_client().get("/auth/available-permissions")
|
|
37
|
-
response.raise_for_status()
|
|
38
|
-
|
|
39
|
-
return response.json()
|
|
40
|
-
|
|
41
13
|
def post_user(
|
|
42
14
|
self, agent_id: str, username: str, password: str, permissions: dict[str, Any] | None = None
|
|
43
15
|
) -> UserOutput:
|
|
@@ -2,6 +2,7 @@ from typing import List
|
|
|
2
2
|
|
|
3
3
|
from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint
|
|
4
4
|
from cheshirecat_python_sdk.models.api.admins import ResetOutput, ClonedOutput, CreatedOutput
|
|
5
|
+
from cheshirecat_python_sdk.utils import deserialize
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class UtilsEndpoint(AbstractEndpoint):
|
|
@@ -29,7 +30,15 @@ class UtilsEndpoint(AbstractEndpoint):
|
|
|
29
30
|
:param agent_id: The ID of the agent.
|
|
30
31
|
:return: CreatedOutput, the details of the agent.
|
|
31
32
|
"""
|
|
32
|
-
|
|
33
|
+
response = self.get_http_client().post(
|
|
34
|
+
self.format_url("/agents/create/"),
|
|
35
|
+
json={
|
|
36
|
+
"agent_id": agent_id,
|
|
37
|
+
},
|
|
38
|
+
)
|
|
39
|
+
response.raise_for_status()
|
|
40
|
+
|
|
41
|
+
return deserialize(response.json(), CreatedOutput)
|
|
33
42
|
|
|
34
43
|
def post_agent_reset(self, agent_id: str) -> ResetOutput:
|
|
35
44
|
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/builders/why.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/enums.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/models/dtos.py
RENAMED
|
File without changes
|
{cheshirecat_python_sdk-1.7.3 → cheshirecat_python_sdk-1.7.5}/cheshirecat_python_sdk/utils.py
RENAMED
|
File without changes
|
|
File without changes
|