cheshirecat-python-sdk 1.8.4__tar.gz → 1.8.6__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.
Files changed (53) hide show
  1. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/PKG-INFO +1 -1
  2. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/conversation.py +36 -11
  3. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/users.py +1 -4
  4. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/utils.py +43 -18
  5. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/models/api/admins.py +11 -2
  6. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/models/api/conversations.py +3 -2
  7. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/pyproject.toml +1 -1
  8. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/.gitignore +0 -0
  9. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/LICENSE +0 -0
  10. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/Makefile +0 -0
  11. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/README.md +0 -0
  12. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/__init__.py +0 -0
  13. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/builders/__init__.py +0 -0
  14. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/builders/base.py +0 -0
  15. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/builders/memory.py +0 -0
  16. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/builders/settings_input.py +0 -0
  17. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/builders/why.py +0 -0
  18. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/client.py +0 -0
  19. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/clients/__init__.py +0 -0
  20. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/clients/http_client.py +0 -0
  21. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/clients/websocket_client.py +0 -0
  22. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/configuration.py +0 -0
  23. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/__init__.py +0 -0
  24. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/admins.py +0 -0
  25. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/agentic_workflow.py +0 -0
  26. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/auth.py +0 -0
  27. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/auth_handler.py +0 -0
  28. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/base.py +0 -0
  29. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/chunker.py +0 -0
  30. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/custom_endpoint.py +0 -0
  31. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/embedder.py +0 -0
  32. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/file_manager.py +0 -0
  33. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/health_check.py +0 -0
  34. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/large_language_model.py +0 -0
  35. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/memory.py +0 -0
  36. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/message.py +0 -0
  37. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/plugins.py +0 -0
  38. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/rabbit_hole.py +0 -0
  39. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/endpoints/vector_database.py +0 -0
  40. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/enums.py +0 -0
  41. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/models/api/factories.py +0 -0
  42. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/models/api/file_managers.py +0 -0
  43. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/models/api/memories.py +0 -0
  44. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/models/api/messages.py +0 -0
  45. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/models/api/nested/memories.py +0 -0
  46. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/models/api/nested/plugins.py +0 -0
  47. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/models/api/plugins.py +0 -0
  48. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/models/api/rabbit_holes.py +0 -0
  49. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/models/api/tokens.py +0 -0
  50. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/models/api/users.py +0 -0
  51. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/models/dtos.py +0 -0
  52. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/cheshirecat_python_sdk/utils.py +0 -0
  53. {cheshirecat_python_sdk-1.8.4 → cheshirecat_python_sdk-1.8.6}/requirements.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cheshirecat-python-sdk
3
- Version: 1.8.4
3
+ Version: 1.8.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
@@ -1,11 +1,11 @@
1
- from typing import List
1
+ from typing import List, Dict
2
2
 
3
3
  from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint
4
4
  from cheshirecat_python_sdk.models.api.conversations import (
5
5
  ConversationHistoryOutput,
6
6
  ConversationDeleteOutput,
7
7
  ConversationsResponse,
8
- ConversationNameChangeOutput,
8
+ ConversationAttributesChangeOutput,
9
9
  )
10
10
  from cheshirecat_python_sdk.utils import deserialize
11
11
 
@@ -13,7 +13,7 @@ from cheshirecat_python_sdk.utils import deserialize
13
13
  class ConversationEndpoint(AbstractEndpoint):
14
14
  def __init__(self, client: "CheshireCatClient"):
15
15
  super().__init__(client)
16
- self.prefix = "/conversation"
16
+ self.prefix = "/conversations"
17
17
 
18
18
  def get_conversation_history(self, agent_id: str, user_id: str, chat_id: str) -> ConversationHistoryOutput:
19
19
  """
@@ -24,7 +24,7 @@ class ConversationEndpoint(AbstractEndpoint):
24
24
  :return: ConversationHistoryOutput, a list of conversation history entries.
25
25
  """
26
26
  return self.get(
27
- self.format_url(chat_id),
27
+ self.format_url(f"{chat_id}/history"),
28
28
  agent_id,
29
29
  user_id=user_id,
30
30
  output_class=ConversationHistoryOutput,
@@ -42,6 +42,22 @@ class ConversationEndpoint(AbstractEndpoint):
42
42
 
43
43
  return [deserialize(item, ConversationsResponse) for item in response.json()]
44
44
 
45
+ def get_conversation(self, agent_id: str, user_id: str, chat_id: str) -> ConversationsResponse:
46
+ """
47
+ This endpoint returns the attributes of a specific conversation, given the `agent_id`, the `user_id` and the
48
+ `chat_id`.
49
+ :param agent_id: The agent ID.
50
+ :param user_id: The user ID to filter the conversation history.
51
+ :param chat_id: The chat ID to filter the conversation history.
52
+ :return: ConversationsResponse, the conversation attributes.
53
+ """
54
+ return self.get(
55
+ self.format_url(chat_id),
56
+ agent_id,
57
+ user_id=user_id,
58
+ output_class=ConversationsResponse,
59
+ )
60
+
45
61
  def delete_conversation(self, agent_id: str, user_id: str, chat_id: str) -> ConversationDeleteOutput:
46
62
  """
47
63
  This endpoint deletes the conversation.
@@ -57,27 +73,36 @@ class ConversationEndpoint(AbstractEndpoint):
57
73
  user_id=user_id,
58
74
  )
59
75
 
60
- def post_conversation_name(
76
+ def put_conversation_attributes(
61
77
  self,
62
- name: str,
63
78
  agent_id: str,
64
79
  user_id: str,
65
80
  chat_id: str,
66
- ) -> ConversationNameChangeOutput:
81
+ name: str | None,
82
+ metadata: Dict | None = None,
83
+ ) -> ConversationAttributesChangeOutput:
67
84
  """
68
85
  This endpoint creates a new element in the conversation history.
69
- :param name: The new name to assign to the conversation
70
86
  :param agent_id: The agent ID.
71
87
  :param user_id: The user ID to filter the conversation history.
72
88
  :param chat_id: The chat ID to filter the conversation history.
89
+ :param name: The new name to assign to the conversation
90
+ :param metadata: The metadata to assign to the conversation
73
91
  :return: ConversationNameChangeOutput, a message indicating whether the conversation name was changed.
74
92
  """
75
- payload = {"name": name}
93
+ if not name and not metadata:
94
+ raise ValueError("Either name or metadata must be provided")
95
+
96
+ payload = {}
97
+ if name:
98
+ payload = {"name": name}
99
+ if metadata:
100
+ payload["metadata"] = metadata
76
101
 
77
- return self.post_json(
102
+ return self.put(
78
103
  self.format_url(chat_id),
79
104
  agent_id,
80
- output_class=ConversationNameChangeOutput,
105
+ output_class=ConversationAttributesChangeOutput,
81
106
  payload=payload,
82
107
  user_id=user_id,
83
108
  )
@@ -59,10 +59,7 @@ class UsersEndpoint(AbstractEndpoint):
59
59
  response = self.get_http_client(agent_id).get(self.prefix)
60
60
  response.raise_for_status()
61
61
 
62
- result = []
63
- for item in response.json():
64
- result.append(deserialize(item, UserOutput))
65
- return result
62
+ return [deserialize(item, UserOutput) for item in response.json()]
66
63
 
67
64
  def get_user(self, user_id: str, agent_id: str) -> UserOutput:
68
65
  """
@@ -1,7 +1,13 @@
1
- from typing import List
1
+ from typing import List, Dict
2
2
 
3
3
  from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint
4
- from cheshirecat_python_sdk.models.api.admins import ResetOutput, ClonedOutput, CreatedOutput
4
+ from cheshirecat_python_sdk.models.api.admins import (
5
+ ResetOutput,
6
+ AgentClonedOutput,
7
+ AgentCreatedOutput,
8
+ AgentOutput,
9
+ AgentUpdatedOutput,
10
+ )
5
11
  from cheshirecat_python_sdk.utils import deserialize
6
12
 
7
13
 
@@ -17,28 +23,33 @@ class UtilsEndpoint(AbstractEndpoint):
17
23
  """
18
24
  return self.post_json(self.format_url("/factory/reset/"), self.system_id, output_class=ResetOutput)
19
25
 
20
- def get_agents(self) -> List[str]:
26
+ def get_agents(self) -> List[AgentOutput]:
21
27
  """
22
28
  Get a list of all agents.
23
- :return: List[str], the IDs of the agents.
29
+ :return: List[AgentOutput], the ID and the metadata of the agents.
24
30
  """
25
- return self.get(self.format_url("/agents/"), self.system_id)
31
+ response = self.get_http_client(agent_id=self.system_id).get(self.format_url("/agents/"))
32
+ response.raise_for_status()
33
+
34
+ return [deserialize(item, AgentOutput) for item in response.json()]
26
35
 
27
- def post_agent_create(self, agent_id: str) -> CreatedOutput:
36
+ def post_agent_create(self, agent_id: str, metadata: Dict | None = None) -> AgentCreatedOutput:
28
37
  """
29
38
  Create a new agent.
30
39
  :param agent_id: The ID of the agent.
31
- :return: CreatedOutput, the details of the agent.
40
+ :param metadata: The metadata of the agent.
41
+ :return: AgentCreatedOutput, the details of the agent.
32
42
  """
33
- response = self.get_http_client().post(
43
+ payload = {"agent_id": agent_id}
44
+ if metadata is not None:
45
+ payload["metadata"] = metadata # type: ignore
46
+
47
+ return self.post_json(
34
48
  self.format_url("/agents/create/"),
35
- json={
36
- "agent_id": agent_id,
37
- },
49
+ self.system_id,
50
+ output_class=AgentCreatedOutput,
51
+ payload=payload,
38
52
  )
39
- response.raise_for_status()
40
-
41
- return deserialize(response.json(), CreatedOutput)
42
53
 
43
54
  def post_agent_reset(self, agent_id: str) -> ResetOutput:
44
55
  """
@@ -56,16 +67,30 @@ class UtilsEndpoint(AbstractEndpoint):
56
67
  """
57
68
  return self.post_json(self.format_url("/agents/destroy/"), agent_id, output_class=ResetOutput)
58
69
 
59
- def post_agent_clone(self, agent_id: str, new_agent_id: str) -> ClonedOutput:
70
+ def post_agent_clone(self, agent_id: str, new_agent_id: str) -> AgentClonedOutput:
60
71
  """
61
72
  Destroy an agent.
62
73
  :param agent_id: The ID of the agent.
63
74
  :param new_agent_id: The ID of the new cloned agent.
64
- :return: ClonedOutput, the details of the cloning.
75
+ :return: AgentClonedOutput, the details of the cloning.
65
76
  """
66
77
  return self.post_json(
67
78
  self.format_url("/agents/clone/"),
68
79
  agent_id,
69
80
  payload={"agent_id": new_agent_id},
70
- output_class=ClonedOutput
71
- )
81
+ output_class=AgentClonedOutput,
82
+ )
83
+
84
+ def put_agent(self, agent_id: str, metadata: Dict) -> AgentUpdatedOutput:
85
+ """
86
+ Update the metadata of an agent.
87
+ :param agent_id: The ID of the agent.
88
+ :param metadata: The new metadata for the agent.
89
+ :return: AgentUpdatedOutput, the details of the update.
90
+ """
91
+ return self.put(
92
+ self.format_url("/agents/"),
93
+ agent_id,
94
+ payload={"metadata": metadata},
95
+ output_class=AgentUpdatedOutput,
96
+ )
@@ -4,7 +4,7 @@ from pydantic import BaseModel
4
4
  from cheshirecat_python_sdk.models.api.plugins import PluginToggleOutput
5
5
 
6
6
 
7
- class CreatedOutput(BaseModel):
7
+ class AgentCreatedOutput(BaseModel):
8
8
  created: bool
9
9
 
10
10
 
@@ -32,5 +32,14 @@ class ResetOutput(BaseModel):
32
32
  deleted_plugin_folders: bool
33
33
 
34
34
 
35
- class ClonedOutput(BaseModel):
35
+ class AgentClonedOutput(BaseModel):
36
36
  cloned: bool = False
37
+
38
+
39
+ class AgentUpdatedOutput(BaseModel):
40
+ updated: bool
41
+
42
+
43
+ class AgentOutput(BaseModel):
44
+ agent_id: str
45
+ metadata: Dict
@@ -1,4 +1,4 @@
1
- from typing import List
1
+ from typing import List, Any, Dict
2
2
  from pydantic import BaseModel
3
3
 
4
4
  from cheshirecat_python_sdk.models.api.nested.memories import ConversationMessage
@@ -16,9 +16,10 @@ class ConversationsResponse(BaseModel):
16
16
  chat_id: str
17
17
  name: str
18
18
  num_messages: int
19
+ metadata: Dict[str, Any]
19
20
  created_at: float | None
20
21
  updated_at: float | None
21
22
 
22
23
 
23
- class ConversationNameChangeOutput(BaseModel):
24
+ class ConversationAttributesChangeOutput(BaseModel):
24
25
  changed: bool
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "cheshirecat-python-sdk"
3
3
  description = "Python SDK for the Cloud-ready fork of the Cheshire Cat"
4
- version = "1.8.4"
4
+ version = "1.8.6"
5
5
  requires-python = ">=3.10"
6
6
  license = { file = "LICENSE" }
7
7
  authors = [