cheshirecat-python-sdk 1.2.1__py3-none-any.whl → 1.8.4__py3-none-any.whl

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.
Files changed (49) hide show
  1. cheshirecat_python_sdk/__init__.py +0 -1
  2. cheshirecat_python_sdk/builders/__init__.py +1 -1
  3. cheshirecat_python_sdk/builders/memory.py +1 -32
  4. cheshirecat_python_sdk/builders/why.py +8 -14
  5. cheshirecat_python_sdk/client.py +35 -5
  6. cheshirecat_python_sdk/clients/http_client.py +21 -7
  7. cheshirecat_python_sdk/clients/websocket_client.py +21 -15
  8. cheshirecat_python_sdk/configuration.py +1 -1
  9. cheshirecat_python_sdk/endpoints/__init__.py +7 -1
  10. cheshirecat_python_sdk/endpoints/admins.py +33 -145
  11. cheshirecat_python_sdk/endpoints/agentic_workflow.py +52 -0
  12. cheshirecat_python_sdk/endpoints/auth.py +54 -0
  13. cheshirecat_python_sdk/endpoints/auth_handler.py +8 -8
  14. cheshirecat_python_sdk/endpoints/base.py +53 -19
  15. cheshirecat_python_sdk/endpoints/chunker.py +8 -8
  16. cheshirecat_python_sdk/endpoints/conversation.py +83 -0
  17. cheshirecat_python_sdk/endpoints/custom_endpoint.py +57 -0
  18. cheshirecat_python_sdk/endpoints/embedder.py +4 -4
  19. cheshirecat_python_sdk/endpoints/file_manager.py +65 -8
  20. cheshirecat_python_sdk/endpoints/health_check.py +22 -0
  21. cheshirecat_python_sdk/endpoints/large_language_model.py +8 -8
  22. cheshirecat_python_sdk/endpoints/memory.py +101 -146
  23. cheshirecat_python_sdk/endpoints/message.py +29 -13
  24. cheshirecat_python_sdk/endpoints/plugins.py +31 -26
  25. cheshirecat_python_sdk/endpoints/rabbit_hole.py +53 -23
  26. cheshirecat_python_sdk/endpoints/users.py +35 -56
  27. cheshirecat_python_sdk/endpoints/utils.py +71 -0
  28. cheshirecat_python_sdk/endpoints/vector_database.py +52 -0
  29. cheshirecat_python_sdk/enums.py +0 -11
  30. cheshirecat_python_sdk/models/api/admins.py +5 -7
  31. cheshirecat_python_sdk/models/api/conversations.py +24 -0
  32. cheshirecat_python_sdk/models/api/factories.py +6 -0
  33. cheshirecat_python_sdk/models/api/file_managers.py +18 -0
  34. cheshirecat_python_sdk/models/api/memories.py +2 -10
  35. cheshirecat_python_sdk/models/api/messages.py +8 -6
  36. cheshirecat_python_sdk/models/api/nested/memories.py +5 -5
  37. cheshirecat_python_sdk/models/api/nested/plugins.py +8 -2
  38. cheshirecat_python_sdk/models/api/plugins.py +30 -22
  39. cheshirecat_python_sdk/models/api/tokens.py +19 -0
  40. cheshirecat_python_sdk/models/api/users.py +4 -1
  41. cheshirecat_python_sdk/models/dtos.py +14 -18
  42. cheshirecat_python_sdk/utils.py +2 -1
  43. {cheshirecat_python_sdk-1.2.1.dist-info → cheshirecat_python_sdk-1.8.4.dist-info}/METADATA +12 -10
  44. cheshirecat_python_sdk-1.8.4.dist-info/RECORD +50 -0
  45. {cheshirecat_python_sdk-1.2.1.dist-info → cheshirecat_python_sdk-1.8.4.dist-info}/WHEEL +1 -1
  46. cheshirecat_python_sdk/endpoints/settings.py +0 -63
  47. cheshirecat_python_sdk/models/api/settings.py +0 -22
  48. cheshirecat_python_sdk-1.2.1.dist-info/RECORD +0 -43
  49. {cheshirecat_python_sdk-1.2.1.dist-info → cheshirecat_python_sdk-1.8.4.dist-info}/licenses/LICENSE +0 -0
@@ -1,7 +1,6 @@
1
1
  from cheshirecat_python_sdk.client import CheshireCatClient
2
2
  from cheshirecat_python_sdk.clients import HttpClient, WSClient
3
3
  from cheshirecat_python_sdk.configuration import Configuration
4
- from cheshirecat_python_sdk.enums import Collection, Role
5
4
 
6
5
 
7
6
  from cheshirecat_python_sdk.builders import *
@@ -1,3 +1,3 @@
1
- from cheshirecat_python_sdk.builders.memory import MemoryBuilder, MemoryPointBuilder
1
+ from cheshirecat_python_sdk.builders.memory import MemoryPointBuilder
2
2
  from cheshirecat_python_sdk.builders.settings_input import SettingInputBuilder
3
3
  from cheshirecat_python_sdk.builders.why import WhyBuilder
@@ -1,38 +1,7 @@
1
1
  from typing import Dict, Any
2
2
 
3
3
  from cheshirecat_python_sdk.builders.base import BaseBuilder
4
- from cheshirecat_python_sdk.models.dtos import Memory, MemoryPoint
5
-
6
-
7
- class MemoryBuilder(BaseBuilder):
8
- def __init__(self):
9
- self.episodic: Dict[str, Any] | None = None
10
- self.declarative: Dict[str, Any] | None = None
11
- self.procedural: Dict[str, Any] | None = None
12
-
13
- @staticmethod
14
- def create():
15
- return MemoryBuilder()
16
-
17
- def set_episodic(self, episodic: Dict[str, Any] | None = None):
18
- self.episodic = episodic or {}
19
- return self
20
-
21
- def set_declarative(self, declarative: Dict[str, Any] | None = None):
22
- self.declarative = declarative or {}
23
- return self
24
-
25
- def set_procedural(self, procedural: Dict[str, Any] | None = None):
26
- self.procedural = procedural or {}
27
- return self
28
-
29
- def build(self):
30
- memory = Memory()
31
- memory.episodic = self.episodic
32
- memory.declarative = self.declarative
33
- memory.procedural = self.procedural
34
-
35
- return memory
4
+ from cheshirecat_python_sdk.models.dtos import MemoryPoint
36
5
 
37
6
 
38
7
  class MemoryPointBuilder(BaseBuilder):
@@ -1,15 +1,14 @@
1
- from typing import Dict, Any
1
+ from typing import List
2
2
 
3
3
  from cheshirecat_python_sdk.builders.base import BaseBuilder
4
- from cheshirecat_python_sdk.models.dtos import Memory, Why
4
+ from cheshirecat_python_sdk.models.dtos import Why
5
5
 
6
6
 
7
7
  class WhyBuilder(BaseBuilder):
8
8
  def __init__(self):
9
9
  self.input: str | None = None
10
- self.intermediate_steps: Dict[str, Any] | None = None
11
- self.memory: Memory | None = None
12
- self.model_interactions: Dict[str, Any] | None = None
10
+ self.intermediate_steps: List | None = []
11
+ self.memory: List | None = []
13
12
 
14
13
  @staticmethod
15
14
  def create() -> "WhyBuilder":
@@ -19,16 +18,12 @@ class WhyBuilder(BaseBuilder):
19
18
  self.input = input
20
19
  return self
21
20
 
22
- def set_intermediate_steps(self, intermediate_steps: Dict[str, Any] | None = None) -> "WhyBuilder":
23
- self.intermediate_steps = intermediate_steps
21
+ def set_intermediate_steps(self, intermediate_steps: List | None = None) -> "WhyBuilder":
22
+ self.intermediate_steps = intermediate_steps or []
24
23
  return self
25
24
 
26
- def set_memory(self, memory: Memory) -> "WhyBuilder":
27
- self.memory = memory
28
- return self
29
-
30
- def set_model_interactions(self, model_interactions: Dict[str, Any] | None = None) -> "WhyBuilder":
31
- self.model_interactions = model_interactions
25
+ def set_memory(self, memory: List | None = None) -> "WhyBuilder":
26
+ self.memory = memory or []
32
27
  return self
33
28
 
34
29
  def build(self) -> Why:
@@ -36,5 +31,4 @@ class WhyBuilder(BaseBuilder):
36
31
  input=self.input,
37
32
  intermediate_steps=self.intermediate_steps,
38
33
  memory=self.memory,
39
- model_interactions=self.model_interactions,
40
34
  )
@@ -2,8 +2,11 @@ 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,
8
+ ConversationEndpoint,
9
+ CustomEndpoint,
7
10
  EmbedderEndpoint,
8
11
  FileManagerEndpoint,
9
12
  LargeLanguageModelEndpoint,
@@ -11,8 +14,11 @@ from cheshirecat_python_sdk.endpoints import (
11
14
  MessageEndpoint,
12
15
  PluginsEndpoint,
13
16
  RabbitHoleEndpoint,
14
- SettingsEndpoint,
15
17
  UsersEndpoint,
18
+ UtilsEndpoint,
19
+ VectorDatabaseEndpoint,
20
+ HealthCheckEndpoint,
21
+ AgenticWorkflowEndpoint,
16
22
  )
17
23
 
18
24
 
@@ -51,14 +57,26 @@ class CheshireCatClient:
51
57
  def admins(self):
52
58
  return AdminsEndpoint(self)
53
59
 
60
+ @property
61
+ def auth(self):
62
+ return AuthEndpoint(self)
63
+
54
64
  @property
55
65
  def auth_handler(self):
56
66
  return AuthHandlerEndpoint(self)
57
67
 
68
+ @property
69
+ def agentic_workflow(self):
70
+ return AgenticWorkflowEndpoint(self)
71
+
58
72
  @property
59
73
  def chunker(self):
60
74
  return ChunkerEndpoint(self)
61
75
 
76
+ @property
77
+ def conversation(self):
78
+ return ConversationEndpoint(self)
79
+
62
80
  @property
63
81
  def embedder(self):
64
82
  return EmbedderEndpoint(self)
@@ -87,10 +105,22 @@ class CheshireCatClient:
87
105
  def rabbit_hole(self):
88
106
  return RabbitHoleEndpoint(self)
89
107
 
90
- @property
91
- def settings(self):
92
- return SettingsEndpoint(self)
93
-
94
108
  @property
95
109
  def users(self):
96
110
  return UsersEndpoint(self)
111
+
112
+ @property
113
+ def utils(self):
114
+ return UtilsEndpoint(self)
115
+
116
+ @property
117
+ def custom(self):
118
+ return CustomEndpoint(self)
119
+
120
+ @property
121
+ def vector_database(self):
122
+ return VectorDatabaseEndpoint(self)
123
+
124
+ @property
125
+ def health_check(self):
126
+ return HealthCheckEndpoint(self)
@@ -15,8 +15,9 @@ class HttpClient:
15
15
  self.port = port
16
16
  self.apikey = apikey
17
17
  self.token = None
18
- self.user_id = None
19
18
  self.agent_id = None
19
+ self.user_id = None
20
+ self.chat_id = None
20
21
  self.is_https = is_https
21
22
  self.headers = {}
22
23
 
@@ -38,27 +39,40 @@ class HttpClient:
38
39
  def __before_secure_request(self):
39
40
  if self.apikey:
40
41
  self.headers["Authorization"] = f"Bearer {self.apikey}"
41
- if self.user_id:
42
- self.headers["user_id"] = self.user_id
43
42
  if self.agent_id:
44
- self.headers["agent_id"] = self.agent_id
43
+ self.headers["X-Agent-ID"] = self.agent_id
44
+ if self.user_id:
45
+ self.headers["X-User-ID"] = self.user_id
46
+ if self.chat_id:
47
+ self.headers["X-Chat-ID"] = self.chat_id
45
48
 
46
49
  def __before_jwt_request(self):
47
50
  if self.token:
48
51
  self.headers["Authorization"] = f"Bearer {self.token}"
49
52
  if self.agent_id:
50
- self.headers["agent_id"] = self.agent_id
53
+ self.headers["X-Agent-ID"] = self.agent_id
54
+ if self.chat_id:
55
+ self.headers["X-Chat-ID"] = self.chat_id
51
56
 
52
- def get_client(self, agent_id: str | None = None, user_id: str | None = None) -> BaseUrlSession:
57
+ def get_client(
58
+ self,
59
+ agent_id: str | None = None,
60
+ user_id: str | None = None,
61
+ chat_id: str | None = None,
62
+ ) -> BaseUrlSession:
53
63
  if not self.apikey and not self.token:
54
64
  raise ValueError("You must provide an apikey or a token")
55
65
 
56
- self.agent_id = agent_id or "agent"
66
+ self.agent_id = agent_id
57
67
  self.user_id = user_id
68
+ self.chat_id = chat_id
58
69
 
59
70
  for middleware in self.middlewares:
60
71
  middleware()
61
72
 
73
+ return self.get_base_session()
74
+
75
+ def get_base_session(self) -> BaseUrlSession:
62
76
  session = BaseUrlSession(base_url=self.get_http_uri())
63
77
  session.headers = self.headers
64
78
 
@@ -22,31 +22,37 @@ class WSClient:
22
22
  self.token = token
23
23
  return self
24
24
 
25
- def get_ws_uri(self, agent_id: str | None = None, user_id: str | None = None) -> str:
26
- query = {}
27
- if self.token:
28
- query["token"] = self.token
29
- elif self.apikey:
30
- query["apikey"] = self.apikey
31
- else:
32
- raise ValueError("You must provide an apikey or a token")
33
-
34
- if user_id:
35
- query["user_id"] = user_id
25
+ def get_ws_uri(
26
+ self,
27
+ agent_id: str,
28
+ user_id: str,
29
+ chat_id: str | None = None,
30
+ ) -> str:
31
+ query = {"user_id": user_id}
36
32
 
37
33
  scheme = "wss" if self.is_wss else "ws"
38
- path = f"ws/{agent_id}" if agent_id else "ws"
34
+ path = f"ws/{agent_id}"
35
+ if chat_id:
36
+ path += f"/{chat_id}"
37
+
39
38
  query_string = urlencode(query)
40
39
  port_suffix = f":{self.port}" if self.port else ""
41
40
 
42
41
  return f"{scheme}://{self.host}{port_suffix}/{path}?{query_string}"
43
42
 
44
- async def get_client(self, agent_id: str | None = None, user_id: str | None = None) -> ClientConnection:
45
- uri = self.get_ws_uri(agent_id, user_id)
43
+ async def get_client(self, agent_id: str, user_id: str, chat_id: str | None = None) -> ClientConnection:
44
+ uri = self.get_ws_uri(agent_id, user_id, chat_id)
46
45
  if self.ws_client is None:
47
46
  try:
47
+ if self.token:
48
+ headers = {"Authorization": f"Bearer {self.token}"}
49
+ elif self.apikey:
50
+ headers = {"Authorization": f"Bearer {self.apikey}"}
51
+ else:
52
+ raise ValueError("You must provide an apikey or a token")
53
+
48
54
  # Create a WebSocket connection
49
- websocket = await connect(uri, ping_interval=100000, ping_timeout=100000)
55
+ websocket = await connect(uri, ping_interval=100000, ping_timeout=100000, additional_headers=headers)
50
56
  self.ws_client = websocket
51
57
  except InvalidURI as e:
52
58
  raise ValueError(f"Invalid WebSocket URI: {uri}") from e
@@ -7,5 +7,5 @@ class Configuration(BaseModel):
7
7
  """
8
8
  host: str = "localhost"
9
9
  port: int = 1865
10
- auth_key: str = ""
10
+ auth_key: str | None = None
11
11
  secure_connection: bool = False
@@ -1,6 +1,10 @@
1
1
  from cheshirecat_python_sdk.endpoints.admins import AdminsEndpoint
2
+ from cheshirecat_python_sdk.endpoints.agentic_workflow import AgenticWorkflowEndpoint
3
+ from cheshirecat_python_sdk.endpoints.auth import AuthEndpoint
2
4
  from cheshirecat_python_sdk.endpoints.auth_handler import AuthHandlerEndpoint
3
5
  from cheshirecat_python_sdk.endpoints.chunker import ChunkerEndpoint
6
+ from cheshirecat_python_sdk.endpoints.conversation import ConversationEndpoint
7
+ from cheshirecat_python_sdk.endpoints.custom_endpoint import CustomEndpoint
4
8
  from cheshirecat_python_sdk.endpoints.embedder import EmbedderEndpoint
5
9
  from cheshirecat_python_sdk.endpoints.file_manager import FileManagerEndpoint
6
10
  from cheshirecat_python_sdk.endpoints.large_language_model import LargeLanguageModelEndpoint
@@ -8,5 +12,7 @@ from cheshirecat_python_sdk.endpoints.memory import MemoryEndpoint
8
12
  from cheshirecat_python_sdk.endpoints.message import MessageEndpoint
9
13
  from cheshirecat_python_sdk.endpoints.plugins import PluginsEndpoint
10
14
  from cheshirecat_python_sdk.endpoints.rabbit_hole import RabbitHoleEndpoint
11
- from cheshirecat_python_sdk.endpoints.settings import SettingsEndpoint
12
15
  from cheshirecat_python_sdk.endpoints.users import UsersEndpoint
16
+ from cheshirecat_python_sdk.endpoints.utils import UtilsEndpoint
17
+ from cheshirecat_python_sdk.endpoints.vector_database import VectorDatabaseEndpoint
18
+ from cheshirecat_python_sdk.endpoints.health_check import HealthCheckEndpoint
@@ -1,153 +1,19 @@
1
- from typing import List
2
-
3
1
  from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint, MultipartPayload
4
2
  from cheshirecat_python_sdk.models.api.admins import (
5
- AdminOutput,
6
- ResetOutput,
7
- CreatedOutput,
8
3
  PluginInstallOutput,
9
4
  PluginInstallFromRegistryOutput,
10
5
  PluginDetailsOutput,
11
6
  PluginDeleteOutput,
12
7
  )
13
8
  from cheshirecat_python_sdk.models.api.nested.plugins import PluginSettingsOutput
14
- from cheshirecat_python_sdk.models.api.plugins import PluginCollectionOutput, PluginsSettingsOutput
15
- from cheshirecat_python_sdk.models.api.tokens import TokenOutput
16
- from cheshirecat_python_sdk.utils import deserialize, file_attributes
9
+ from cheshirecat_python_sdk.models.api.plugins import PluginCollectionOutput, PluginsSettingsOutput, PluginToggleOutput
10
+ from cheshirecat_python_sdk.utils import file_attributes
17
11
 
18
12
 
19
13
  class AdminsEndpoint(AbstractEndpoint):
20
14
  def __init__(self, client: "CheshireCatClient"):
21
15
  super().__init__(client)
22
- self.prefix = "/admins"
23
-
24
- def token(self, username: str, password: str) -> TokenOutput:
25
- """
26
- This endpoint is used to get a token for the user. The token is used to authenticate the user in the system.
27
- When the token expires, the user must request a new token.
28
- :param username: The username of the user.
29
- :param password: The password of the user.
30
- :return: TokenOutput, the token of the user.
31
- """
32
- response = self.get_http_client().post(
33
- self.format_url("/auth/token"),
34
- json={"username": username, "password": password},
35
- )
36
- result = deserialize(response.json(), TokenOutput)
37
- self.client.add_token(result.access_token)
38
- return result
39
-
40
- def post_admin(self, username: str, password: str, permissions: dict | None = None) -> AdminOutput:
41
- """
42
- Create a new admin user.
43
- :param username: The username of the user.
44
- :param password: The password of the user.
45
- :param permissions: The permissions of the user.
46
- :return: AdminOutput, the details of the user.
47
- """
48
- payload = {"username": username, "password": password}
49
- if permissions:
50
- payload["permissions"] = permissions
51
-
52
- return self.post_json(self.format_url("/users"), AdminOutput, payload, self.system_id)
53
-
54
- def get_admins(self, limit: int | None = None, skip: int | None = None) -> List[AdminOutput]:
55
- """
56
- Get a list of all admin users.
57
- :param limit: The maximum number of users to return.
58
- :param skip: The number of users to skip.
59
- :return: List[AdminOutput], the details
60
- """
61
- query = {}
62
- if limit:
63
- query["limit"] = limit
64
- if skip:
65
- query["skip"] = skip
66
-
67
- response = self.get_http_client(self.system_id).get(self.format_url("/users"), params=query)
68
- result = []
69
- for item in response.json():
70
- result.append(deserialize(item, AdminOutput))
71
- return result
72
-
73
- def get_admin(self, admin_id: str) -> AdminOutput:
74
- """
75
- Get the details of an admin user.
76
- :param admin_id: The ID of the user.
77
- :return: AdminOutput, the details of the user.
78
- """
79
- return self.get(self.format_url(f"/users/{admin_id}"), AdminOutput, self.system_id)
80
-
81
- def put_admin(
82
- self,
83
- admin_id: str,
84
- username: str | None = None,
85
- password: str | None = None,
86
- permissions: dict | None = None,
87
- ) -> AdminOutput:
88
- """
89
- Update the details of an admin user.
90
- :param admin_id: The ID of the user.
91
- :param username: The new username.
92
- :param password: The new password.
93
- :param permissions: The new permissions.
94
- :return: AdminOutput, the details of the user.
95
- """
96
- payload = {}
97
- if username:
98
- payload["username"] = username
99
- if password:
100
- payload["password"] = password
101
- if permissions:
102
- payload["permissions"] = permissions
103
-
104
- return self.put(self.format_url(f"/users/{admin_id}"), AdminOutput, payload, self.system_id)
105
-
106
- def delete_admin(self, admin_id: str) -> AdminOutput:
107
- """
108
- Delete an admin user.
109
- :param admin_id: The ID of the user.
110
- :return: AdminOutput, the details of the user.
111
- """
112
- return self.delete(self.format_url(f"/users/{admin_id}"), AdminOutput, self.system_id)
113
-
114
- def post_factory_reset(self) -> ResetOutput:
115
- """
116
- Reset the system to the factory settings.
117
- :return: ResetOutput, the details of the reset.
118
- """
119
- return self.post_json(self.format_url("/utils/factory/reset/"), ResetOutput, {}, self.system_id)
120
-
121
- def get_agents(self) -> List[str]:
122
- """
123
- Get a list of all agents.
124
- :return: List[str], the IDs of the agents.
125
- """
126
- return self.get(self.format_url("/utils/agents/"), None, agent_id=self.system_id)
127
-
128
- def post_agent_create(self, agent_id: str | None = None) -> CreatedOutput:
129
- """
130
- Create a new agent.
131
- :param agent_id: The ID of the agent.
132
- :return: CreatedOutput, the details of the agent.
133
- """
134
- return self.post_json(self.format_url("/utils/agent/create/"), CreatedOutput, {}, agent_id)
135
-
136
- def post_agent_reset(self, agent_id: str | None = None) -> ResetOutput:
137
- """
138
- Reset an agent to the factory settings.
139
- :param agent_id: The ID of the agent.
140
- :return: ResetOutput, the details of the reset.
141
- """
142
- return self.post_json(self.format_url("/utils/agent/reset/"), ResetOutput, {}, agent_id)
143
-
144
- def post_agent_destroy(self, agent_id: str | None = None) -> ResetOutput:
145
- """
146
- Destroy an agent.
147
- :param agent_id: The ID of the agent.
148
- :return: ResetOutput, the details of the reset.
149
- """
150
- return self.post_json(self.format_url("/utils/agent/destroy/"), ResetOutput, {}, agent_id)
16
+ self.prefix = "/plugins"
151
17
 
152
18
  def get_available_plugins(self, plugin_name: str | None = None) -> PluginCollectionOutput:
153
19
  """
@@ -156,9 +22,9 @@ class AdminsEndpoint(AbstractEndpoint):
156
22
  :return: PluginCollectionOutput, the details of the plugins.
157
23
  """
158
24
  return self.get(
159
- self.format_url("/plugins"),
160
- PluginCollectionOutput,
25
+ self.format_url("/installed"),
161
26
  self.system_id,
27
+ output_class=PluginCollectionOutput,
162
28
  query={"query": plugin_name} if plugin_name else None,
163
29
  )
164
30
 
@@ -168,7 +34,10 @@ class AdminsEndpoint(AbstractEndpoint):
168
34
  with open(path_zip, "rb") as file:
169
35
  payload.files = [("file", file_attributes(path_zip, file))]
170
36
  result = self.post_multipart(
171
- self.format_url("/plugins/upload"), PluginInstallOutput, payload, self.system_id
37
+ self.format_url("/install/upload"),
38
+ self.system_id,
39
+ output_class=PluginInstallOutput,
40
+ payload=payload,
172
41
  )
173
42
  return result
174
43
 
@@ -178,14 +47,19 @@ class AdminsEndpoint(AbstractEndpoint):
178
47
  :param url: The URL of the plugin.
179
48
  :return: PluginInstallFromRegistryOutput, the details of the installation.
180
49
  """
181
- return self.post_json(self.format_url("/plugins/upload/registry"), PluginInstallFromRegistryOutput, {"url": url}, self.system_id)
50
+ return self.post_json(
51
+ self.format_url("/install/registry"),
52
+ self.system_id,
53
+ output_class=PluginInstallFromRegistryOutput,
54
+ payload={"url": url},
55
+ )
182
56
 
183
57
  def get_plugins_settings(self) -> PluginsSettingsOutput:
184
58
  """
185
59
  Get the default settings of all the plugins.
186
60
  :return: PluginsSettingsOutput, the details of the settings.
187
61
  """
188
- return self.get(self.format_url("/plugins/settings"), PluginsSettingsOutput, self.system_id)
62
+ return self.get(self.format_url("/system/settings"), self.system_id, output_class=PluginsSettingsOutput)
189
63
 
190
64
  def get_plugin_settings(self, plugin_id: str) -> PluginSettingsOutput:
191
65
  """
@@ -193,7 +67,9 @@ class AdminsEndpoint(AbstractEndpoint):
193
67
  :param plugin_id: The ID of the plugin.
194
68
  :return: PluginSettingsOutput, the details of the settings.
195
69
  """
196
- return self.get(self.format_url(f"/plugins/settings/{plugin_id}"), PluginSettingsOutput, self.system_id)
70
+ return self.get(
71
+ self.format_url(f"/system/settings/{plugin_id}"), self.system_id, output_class=PluginSettingsOutput
72
+ )
197
73
 
198
74
  def get_plugin_details(self, plugin_id: str) -> PluginDetailsOutput:
199
75
  """
@@ -201,7 +77,7 @@ class AdminsEndpoint(AbstractEndpoint):
201
77
  :param plugin_id: The ID of the plugin.
202
78
  :return: PluginDetailsOutput, the details of the plugin.
203
79
  """
204
- return self.get(self.format_url(f"/plugins/{plugin_id}"), PluginDetailsOutput, self.system_id)
80
+ return self.get(self.format_url(f"/system/details/{plugin_id}"), self.system_id, output_class=PluginDetailsOutput)
205
81
 
206
82
  def delete_plugin(self, plugin_id: str) -> PluginDeleteOutput:
207
83
  """
@@ -209,4 +85,16 @@ class AdminsEndpoint(AbstractEndpoint):
209
85
  :param plugin_id: The ID of the plugin.
210
86
  :return: PluginDeleteOutput, the details of the plugin.
211
87
  """
212
- return self.delete(self.format_url(f"/plugins/{plugin_id}"), PluginDeleteOutput, self.system_id)
88
+ return self.delete(self.format_url(f"/uninstall/{plugin_id}"), self.system_id, output_class=PluginDeleteOutput)
89
+
90
+ def put_toggle_plugin(self, plugin_id: str) -> PluginToggleOutput:
91
+ """
92
+ This endpoint toggles a plugin, on a system level
93
+ :param plugin_id: The id of the plugin to toggle
94
+ :return: PluginToggleOutput, the toggled plugin
95
+ """
96
+ return self.put(
97
+ self.format_url(f"/system/toggle/{plugin_id}"),
98
+ self.system_id,
99
+ output_class=PluginToggleOutput,
100
+ )
@@ -0,0 +1,52 @@
1
+ from typing import Dict, Any
2
+
3
+ from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint
4
+ from cheshirecat_python_sdk.models.api.factories import FactoryObjectSettingsOutput, FactoryObjectSettingOutput
5
+
6
+
7
+ class AgenticWorkflowEndpoint(AbstractEndpoint):
8
+ def __init__(self, client: "CheshireCatClient"):
9
+ super().__init__(client)
10
+ self.prefix = "/agentic_workflow"
11
+
12
+ def get_agentic_workflows_settings(self, agent_id: str) -> FactoryObjectSettingsOutput:
13
+ """
14
+ Get all agentic workflow settings for the agent with the given ID.
15
+ :param agent_id: The ID of the agent.
16
+ :return: FactoryObjectSettingsOutput, containing the settings for all agentic workflows.
17
+ """
18
+ return self.get(
19
+ self.format_url("/settings"),
20
+ agent_id,
21
+ output_class=FactoryObjectSettingsOutput,
22
+ )
23
+
24
+ def get_agentic_workflow_settings(self, agentic_workflow: str, agent_id: str) -> FactoryObjectSettingOutput:
25
+ """
26
+ Get the settings for the agentic workflow with the given name.
27
+ :param agentic_workflow: The name of the agentic workflow.
28
+ :param agent_id: The ID of the agent.
29
+ :return: FactoryObjectSettingOutput, containing the settings for the agentic workflow.
30
+ """
31
+ return self.get(
32
+ self.format_url(f"/settings/{agentic_workflow}"),
33
+ agent_id,
34
+ output_class=FactoryObjectSettingOutput,
35
+ )
36
+
37
+ def put_agentic_workflow_settings(
38
+ self, agentic_workflow: str, agent_id: str, values: Dict[str, Any]
39
+ ) -> FactoryObjectSettingOutput:
40
+ """
41
+ Update the settings for the agentic workflow with the given name.
42
+ :param agentic_workflow: The name of the agentic workflow.
43
+ :param agent_id: The ID of the agent.
44
+ :param values: The new settings for the agentic workflow.
45
+ :return: FactoryObjectSettingOutput, containing the updated settings for the agentic workflow.
46
+ """
47
+ return self.put(
48
+ self.format_url(f"/settings/{agentic_workflow}"),
49
+ agent_id,
50
+ output_class=FactoryObjectSettingOutput,
51
+ payload=values,
52
+ )
@@ -0,0 +1,54 @@
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, MeOutput
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) -> 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
+ )
25
+ response.raise_for_status()
26
+
27
+ result = deserialize(response.json(), TokenOutput)
28
+ self.client.add_token(result.access_token)
29
+
30
+ return result
31
+
32
+ def get_available_permissions(self) -> dict[int | str, Any]:
33
+ """
34
+ This endpoint is used to get a list of available permissions in the system. The permissions are used to define
35
+ the access rights of the users in the system. The permissions are defined by the system administrator.
36
+ :return array<int|string, Any>, the available permissions
37
+ """
38
+ response = self.get_http_client().get(self.format_url("/available-permissions"))
39
+ response.raise_for_status()
40
+
41
+ return response.json()
42
+
43
+ def me(self, token: str) -> MeOutput:
44
+ """
45
+ This endpoint is used to get the current user information. The user information includes the list of agents
46
+ the user has access to. This endpoint requires authentication.
47
+ """
48
+ self.client.add_token(token)
49
+
50
+ response = self.get_http_client().get("/me")
51
+ response.raise_for_status()
52
+
53
+ result = deserialize(response.json(), MeOutput)
54
+ return result