cheshirecat-python-sdk 1.7.4__py3-none-any.whl → 1.7.6__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.
@@ -1,7 +1,7 @@
1
1
  from typing import Any
2
2
 
3
3
  from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint
4
- from cheshirecat_python_sdk.models.api.tokens import TokenOutput
4
+ from cheshirecat_python_sdk.models.api.tokens import TokenOutput, MeOutput
5
5
  from cheshirecat_python_sdk.utils import deserialize
6
6
 
7
7
 
@@ -10,7 +10,7 @@ class AuthEndpoint(AbstractEndpoint):
10
10
  super().__init__(client)
11
11
  self.prefix = "/auth"
12
12
 
13
- def token(self, username: str, password: str, agent_id: str | None = None) -> TokenOutput:
13
+ def token(self, username: str, password: str) -> TokenOutput:
14
14
  """
15
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
16
  the token expires, the user must request a new token.
@@ -21,7 +21,6 @@ class AuthEndpoint(AbstractEndpoint):
21
21
  "username": username,
22
22
  "password": password,
23
23
  },
24
- headers={"X-Agent-ID": agent_id} if agent_id else None,
25
24
  )
26
25
  response.raise_for_status()
27
26
 
@@ -40,3 +39,16 @@ class AuthEndpoint(AbstractEndpoint):
40
39
  response.raise_for_status()
41
40
 
42
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
@@ -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:
@@ -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
- return self.post_json(self.format_url("/agents/create/"), agent_id, output_class=CreatedOutput)
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
  """
@@ -4,3 +4,22 @@ from pydantic import BaseModel
4
4
  class TokenOutput(BaseModel):
5
5
  access_token: str
6
6
  token_type: str | None = "bearer"
7
+
8
+
9
+ class User(BaseModel):
10
+ id: str
11
+ username: str
12
+ permissions: dict[str, list[str]]
13
+
14
+
15
+ class AgentMatch(BaseModel):
16
+ agent_id: str
17
+ agent_name: str
18
+ agent_description: str | None = None
19
+ user: User
20
+
21
+
22
+ class MeOutput(BaseModel):
23
+ success : bool
24
+ agents: list[AgentMatch]
25
+ auto_selected: bool
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cheshirecat-python-sdk
3
- Version: 1.7.4
3
+ Version: 1.7.6
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
@@ -13,9 +13,9 @@ cheshirecat_python_sdk/clients/http_client.py,sha256=LnP0kr-kHRCwC-BZiysj1Zg-T3b
13
13
  cheshirecat_python_sdk/clients/websocket_client.py,sha256=xNjkLSEZhpHzRqIZL21V0oG3srAGFaqYveMqlma2gvI,1932
14
14
  cheshirecat_python_sdk/endpoints/__init__.py,sha256=uQPclok3DdKTibR7ywDVM67eqtxEMwx_iuza37Wqkr8,1247
15
15
  cheshirecat_python_sdk/endpoints/admins.py,sha256=rc6jEhYF8KTTWFXLinm3xPV7Rj87iKT8Kp0zHn1qUO4,7024
16
- cheshirecat_python_sdk/endpoints/auth.py,sha256=GcmN90uZIgeRqc_NjBhZx7bxYRSpfKL6ZOLHLom1aKQ,1658
16
+ cheshirecat_python_sdk/endpoints/auth.py,sha256=_22fLGznoxo2pybcQGgcsHCpLoq76P6RplmSMMgajEQ,2031
17
17
  cheshirecat_python_sdk/endpoints/auth_handler.py,sha256=Jfi7E7L3SIzJyECbJnUenIyl6xxkJlyC31AHpAlmqSs,2117
18
- cheshirecat_python_sdk/endpoints/base.py,sha256=ldayH0QxQfzD5bYqlMBH1JVBOTd11RYDWxf-6kl0fng,4003
18
+ cheshirecat_python_sdk/endpoints/base.py,sha256=W_ynJur_cbT31KLp6F4pJ212tMaAa1BxnG75YS1UgNU,4075
19
19
  cheshirecat_python_sdk/endpoints/chunker.py,sha256=bgp-2gQpKt7W_B46eEb-KFRkd4eZJH0euwsf3N0jfC8,1979
20
20
  cheshirecat_python_sdk/endpoints/conversation.py,sha256=jG1z7ivdD53H8JZe7WZWihoBWy2_-W951SwKXmnpmTk,3282
21
21
  cheshirecat_python_sdk/endpoints/custom_endpoint.py,sha256=HVRQMqA5JfPr87gHtWpYcsXsE-TA-coXLcvsPKabqds,2791
@@ -28,7 +28,7 @@ cheshirecat_python_sdk/endpoints/message.py,sha256=QTUSUJcj52VhfnX9hdjsD2aLeFC43
28
28
  cheshirecat_python_sdk/endpoints/plugins.py,sha256=FasjwNY2UVv7zfg9lvXEj2ATefPDOPQpJXzQ2BbQIYI,3474
29
29
  cheshirecat_python_sdk/endpoints/rabbit_hole.py,sha256=DH5KGpk0Ur8RPi1fZIO9D925mc2D0GHQpsOeIKIa1G0,7213
30
30
  cheshirecat_python_sdk/endpoints/users.py,sha256=PXlPPobLoWpiuAzi0k89YUyqSp24Sc5DEcDQYGRXRBA,5369
31
- cheshirecat_python_sdk/endpoints/utils.py,sha256=UhhWCC4h9c7lbPxAaV3nHjLYwod4z0tHzrE-2tuKs8M,2328
31
+ cheshirecat_python_sdk/endpoints/utils.py,sha256=yKGrFRpu6ItLnBEuc98093LbXqGYaGdgCLiWuLQJVno,2551
32
32
  cheshirecat_python_sdk/endpoints/vector_database.py,sha256=Xu6zcopjZgcFVVmyN547piiqFcaTUtF35X0QxQHycXQ,2149
33
33
  cheshirecat_python_sdk/models/dtos.py,sha256=yK6CfCGdwLvZtYFPoImDEgpV5eyHB2iwji2t6dh6gxc,668
34
34
  cheshirecat_python_sdk/models/api/admins.py,sha256=K1HzZrjEk--rmBSxEg3cbWm2MVQaSxTheMBhhBr54_4,767
@@ -39,11 +39,11 @@ cheshirecat_python_sdk/models/api/memories.py,sha256=4rqFuFNzNbmwIG1KGiSyfnv40nd
39
39
  cheshirecat_python_sdk/models/api/messages.py,sha256=oslVFn8sMNOZyQkOzAncI2W2WLX0Tmd8Avc81iEIpWo,609
40
40
  cheshirecat_python_sdk/models/api/plugins.py,sha256=uX8SYbcTxQSxv1IaVChEBd3rr6kc83rwq3IILnmq5EE,1996
41
41
  cheshirecat_python_sdk/models/api/rabbit_holes.py,sha256=01FcPSIG6nq9WJhL_rQopLMSD81CU9lfP-t0xtf35Gw,285
42
- cheshirecat_python_sdk/models/api/tokens.py,sha256=5vzQqmcYWg593U1cTnnmLPZMNkgNNY5egQBQTE-NDoE,123
42
+ cheshirecat_python_sdk/models/api/tokens.py,sha256=tJRx96ZrOS66anE9F5EvBLgd5aKNbrgn4EwpIvYaruQ,442
43
43
  cheshirecat_python_sdk/models/api/users.py,sha256=2l86y6ol0R0823gGl4bmc1TzGP4ZyvTm9AR8riKiatA,160
44
44
  cheshirecat_python_sdk/models/api/nested/memories.py,sha256=ddGDsmZa2refElM0sGz9QfKHGk50wsTpkwN5qDC5bF4,946
45
45
  cheshirecat_python_sdk/models/api/nested/plugins.py,sha256=7vrwgXh0csaUn11YKY_OWnGEnD8Fu_ewKxt024VOBEs,738
46
- cheshirecat_python_sdk-1.7.4.dist-info/METADATA,sha256=R1wHR1rsC5gYTtJFJ-zM02uo_qY2S2yJa-i8Bh5i4eM,44136
47
- cheshirecat_python_sdk-1.7.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
48
- cheshirecat_python_sdk-1.7.4.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
49
- cheshirecat_python_sdk-1.7.4.dist-info/RECORD,,
46
+ cheshirecat_python_sdk-1.7.6.dist-info/METADATA,sha256=IHhoqsj7YiRvzbu-DDWoweHhwPQb7lVLmJs0t9rTKXk,44136
47
+ cheshirecat_python_sdk-1.7.6.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
48
+ cheshirecat_python_sdk-1.7.6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
49
+ cheshirecat_python_sdk-1.7.6.dist-info/RECORD,,