cheshirecat-python-sdk 1.8.4__py3-none-any.whl → 1.8.5__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,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
  )
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cheshirecat-python-sdk
3
- Version: 1.8.4
3
+ Version: 1.8.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
@@ -18,7 +18,7 @@ cheshirecat_python_sdk/endpoints/auth.py,sha256=_22fLGznoxo2pybcQGgcsHCpLoq76P6R
18
18
  cheshirecat_python_sdk/endpoints/auth_handler.py,sha256=Jfi7E7L3SIzJyECbJnUenIyl6xxkJlyC31AHpAlmqSs,2117
19
19
  cheshirecat_python_sdk/endpoints/base.py,sha256=0X2EQxRGqR6VG5gXE5XKcscmQ7rNM9de61GBrQlKD90,4210
20
20
  cheshirecat_python_sdk/endpoints/chunker.py,sha256=bgp-2gQpKt7W_B46eEb-KFRkd4eZJH0euwsf3N0jfC8,1979
21
- cheshirecat_python_sdk/endpoints/conversation.py,sha256=jG1z7ivdD53H8JZe7WZWihoBWy2_-W951SwKXmnpmTk,3282
21
+ cheshirecat_python_sdk/endpoints/conversation.py,sha256=OGxG312kQBzL5629vCmTreltUrEnoUV4JshZUcj4L2U,4335
22
22
  cheshirecat_python_sdk/endpoints/custom_endpoint.py,sha256=HVRQMqA5JfPr87gHtWpYcsXsE-TA-coXLcvsPKabqds,2791
23
23
  cheshirecat_python_sdk/endpoints/embedder.py,sha256=4B2yc3KBThKGreq_KPTTCsxt2Ekktw_muZ5gBfxrrwY,1741
24
24
  cheshirecat_python_sdk/endpoints/file_manager.py,sha256=U4kc2oR3UszK0EKzYnES_RkgF1zhaPINAW_3X2WgX7A,4614
@@ -33,7 +33,7 @@ cheshirecat_python_sdk/endpoints/utils.py,sha256=yKGrFRpu6ItLnBEuc98093LbXqGYaGd
33
33
  cheshirecat_python_sdk/endpoints/vector_database.py,sha256=Xu6zcopjZgcFVVmyN547piiqFcaTUtF35X0QxQHycXQ,2149
34
34
  cheshirecat_python_sdk/models/dtos.py,sha256=0N6Auv43Gifo0ptdZxMZXAB6QGk8NNbcf8vQGm8HClo,869
35
35
  cheshirecat_python_sdk/models/api/admins.py,sha256=sIX4NdEntjORgVACsqkBkzte4zwD6w35BdPRRG0D7uo,661
36
- cheshirecat_python_sdk/models/api/conversations.py,sha256=Ej8677MLBqZEME1lZFd4UhHokdja762zYNjV9ZaEg-I,505
36
+ cheshirecat_python_sdk/models/api/conversations.py,sha256=ifgCwbtYwPiilQ-pz1peXaR7yVDNXlmIy_eWp25LGDE,551
37
37
  cheshirecat_python_sdk/models/api/factories.py,sha256=_NWz0nKhaVYEbaphxe2YZGznDIUiMKb-xqA1xymME5A,594
38
38
  cheshirecat_python_sdk/models/api/file_managers.py,sha256=V0ZBjQWmYM1t0Qpfp3W2NDI_tScOtORB0i5YMEpTiRU,301
39
39
  cheshirecat_python_sdk/models/api/memories.py,sha256=4rqFuFNzNbmwIG1KGiSyfnv40nds5g7fSkov3drj0cc,948
@@ -44,7 +44,7 @@ cheshirecat_python_sdk/models/api/tokens.py,sha256=GavSaCq0-SRWjvLtDgrYBOdUELd7V
44
44
  cheshirecat_python_sdk/models/api/users.py,sha256=_T3-8hfmlZK9cZcqBTbNMYS74yEnDrRACRQn9PNCEiQ,280
45
45
  cheshirecat_python_sdk/models/api/nested/memories.py,sha256=ddGDsmZa2refElM0sGz9QfKHGk50wsTpkwN5qDC5bF4,946
46
46
  cheshirecat_python_sdk/models/api/nested/plugins.py,sha256=7vrwgXh0csaUn11YKY_OWnGEnD8Fu_ewKxt024VOBEs,738
47
- cheshirecat_python_sdk-1.8.4.dist-info/METADATA,sha256=f5sjZkDGm4AXlxsMLbEjOEEgD2Pyke2NMqM7zi0Ag_4,44136
48
- cheshirecat_python_sdk-1.8.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
49
- cheshirecat_python_sdk-1.8.4.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
50
- cheshirecat_python_sdk-1.8.4.dist-info/RECORD,,
47
+ cheshirecat_python_sdk-1.8.5.dist-info/METADATA,sha256=K5gpaytNWUZd-1rVwXykanO9bUztJYGQYIIZPvTXuws,44136
48
+ cheshirecat_python_sdk-1.8.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
49
+ cheshirecat_python_sdk-1.8.5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
50
+ cheshirecat_python_sdk-1.8.5.dist-info/RECORD,,