cheshirecat-python-sdk 1.8.0__tar.gz → 1.8.2__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 (54) hide show
  1. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/PKG-INFO +1 -1
  2. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/builders/__init__.py +1 -1
  3. cheshirecat_python_sdk-1.8.2/cheshirecat_python_sdk/builders/memory.py +25 -0
  4. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/builders/why.py +8 -8
  5. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/base.py +6 -3
  6. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/file_manager.py +12 -6
  7. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/memory.py +3 -0
  8. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/rabbit_hole.py +3 -1
  9. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/models/dtos.py +1 -5
  10. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/pyproject.toml +1 -1
  11. cheshirecat_python_sdk-1.8.0/cheshirecat_python_sdk/builders/memory.py +0 -44
  12. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/.gitignore +0 -0
  13. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/LICENSE +0 -0
  14. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/Makefile +0 -0
  15. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/README.md +0 -0
  16. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/__init__.py +0 -0
  17. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/builders/base.py +0 -0
  18. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/builders/settings_input.py +0 -0
  19. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/client.py +0 -0
  20. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/clients/__init__.py +0 -0
  21. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/clients/http_client.py +0 -0
  22. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/clients/websocket_client.py +0 -0
  23. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/configuration.py +0 -0
  24. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/__init__.py +0 -0
  25. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/admins.py +0 -0
  26. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/agentic_workflow.py +0 -0
  27. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/auth.py +0 -0
  28. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/auth_handler.py +0 -0
  29. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/chunker.py +0 -0
  30. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/conversation.py +0 -0
  31. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/custom_endpoint.py +0 -0
  32. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/embedder.py +0 -0
  33. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/health_check.py +0 -0
  34. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/large_language_model.py +0 -0
  35. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/message.py +0 -0
  36. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/plugins.py +0 -0
  37. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/users.py +0 -0
  38. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/utils.py +0 -0
  39. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/endpoints/vector_database.py +0 -0
  40. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/enums.py +0 -0
  41. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/models/api/admins.py +0 -0
  42. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/models/api/conversations.py +0 -0
  43. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/models/api/factories.py +0 -0
  44. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/models/api/file_managers.py +0 -0
  45. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/models/api/memories.py +0 -0
  46. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/models/api/messages.py +0 -0
  47. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/models/api/nested/memories.py +0 -0
  48. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/models/api/nested/plugins.py +0 -0
  49. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/models/api/plugins.py +0 -0
  50. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/models/api/rabbit_holes.py +0 -0
  51. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/models/api/tokens.py +0 -0
  52. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/models/api/users.py +0 -0
  53. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/cheshirecat_python_sdk/utils.py +0 -0
  54. {cheshirecat_python_sdk-1.8.0 → cheshirecat_python_sdk-1.8.2}/requirements.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cheshirecat-python-sdk
3
- Version: 1.8.0
3
+ Version: 1.8.2
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,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
@@ -0,0 +1,25 @@
1
+ from typing import Dict, Any
2
+
3
+ from cheshirecat_python_sdk.builders.base import BaseBuilder
4
+ from cheshirecat_python_sdk.models.dtos import MemoryPoint
5
+
6
+
7
+ class MemoryPointBuilder(BaseBuilder):
8
+ def __init__(self):
9
+ self.content: str = ""
10
+ self.metadata: Dict[str, Any] = {}
11
+
12
+ @staticmethod
13
+ def create():
14
+ return MemoryPointBuilder()
15
+
16
+ def set_content(self, content: str):
17
+ self.content = content
18
+ return self
19
+
20
+ def set_metadata(self, metadata: Dict[str, Any]):
21
+ self.metadata = metadata
22
+ return self
23
+
24
+ def build(self):
25
+ return MemoryPoint(self.content, self.metadata)
@@ -1,14 +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
10
+ self.intermediate_steps: List | None = []
11
+ self.memory: List | None = []
12
12
 
13
13
  @staticmethod
14
14
  def create() -> "WhyBuilder":
@@ -18,12 +18,12 @@ class WhyBuilder(BaseBuilder):
18
18
  self.input = input
19
19
  return self
20
20
 
21
- def set_intermediate_steps(self, intermediate_steps: Dict[str, Any] | None = None) -> "WhyBuilder":
22
- self.intermediate_steps = intermediate_steps
21
+ def set_intermediate_steps(self, intermediate_steps: List | None = None) -> "WhyBuilder":
22
+ self.intermediate_steps = intermediate_steps or []
23
23
  return self
24
24
 
25
- def set_memory(self, memory: Memory) -> "WhyBuilder":
26
- self.memory = memory
25
+ def set_memory(self, memory: List | None = None) -> "WhyBuilder":
26
+ self.memory = memory or []
27
27
  return self
28
28
 
29
29
  def build(self) -> Why:
@@ -43,12 +43,13 @@ class AbstractEndpoint(ABC):
43
43
  output_class: Type[T] | None = None,
44
44
  query: Dict[str, Any] | None = None,
45
45
  user_id: str | None = None,
46
+ chat_id: str | None = None,
46
47
  ) -> T:
47
48
  options = {}
48
49
  if query:
49
50
  options["params"] = query
50
51
 
51
- response = self.get_http_client(agent_id, user_id).get(endpoint, **options)
52
+ response = self.get_http_client(agent_id, user_id, chat_id).get(endpoint, **options)
52
53
  response.raise_for_status()
53
54
 
54
55
  if output_class is None:
@@ -103,12 +104,13 @@ class AbstractEndpoint(ABC):
103
104
  output_class: Type[T] | None = None,
104
105
  payload: Dict[str, Any] | None = None,
105
106
  user_id: str | None = None,
107
+ chat_id: str | None = None,
106
108
  ) -> T:
107
109
  options = {}
108
110
  if payload:
109
111
  options["json"] = payload
110
112
 
111
- response = self.get_http_client(agent_id, user_id).put(endpoint, **options)
113
+ response = self.get_http_client(agent_id, user_id, chat_id).put(endpoint, **options)
112
114
  response.raise_for_status()
113
115
 
114
116
  if output_class is None:
@@ -121,13 +123,14 @@ class AbstractEndpoint(ABC):
121
123
  agent_id: str,
122
124
  output_class: Type[T] | None = None,
123
125
  user_id: str | None = None,
126
+ chat_id: str | None = None,
124
127
  payload: Dict[str, Any] | None = None,
125
128
  ) -> T:
126
129
  options = {}
127
130
  if payload:
128
131
  options["json"] = payload
129
132
 
130
- response = self.get_http_client(agent_id, user_id).delete(endpoint, **options)
133
+ response = self.get_http_client(agent_id, user_id, chat_id).delete(endpoint, **options)
131
134
  response.raise_for_status()
132
135
 
133
136
  if output_class is None:
@@ -53,22 +53,24 @@ class FileManagerEndpoint(AbstractEndpoint):
53
53
  payload=values,
54
54
  )
55
55
 
56
- def get_file_manager_attributes(self, agent_id: str) -> FileManagerAttributes:
56
+ def get_file_manager_attributes(self, agent_id: str, chat_id: str | None = None) -> FileManagerAttributes:
57
57
  """
58
58
  Get the attributes of the file manager for the agent specified by agent_id
59
59
  :param agent_id: The agent id
60
+ :param chat_id: The chat id, optional
60
61
  :return: FileManagerAttributes, the attributes of the file manager
61
62
  """
62
- return self.get(self.prefix, agent_id, output_class=FileManagerAttributes)
63
+ return self.get(self.prefix, agent_id, output_class=FileManagerAttributes, chat_id=chat_id)
63
64
 
64
- def get_file(self, agent_id: str, file_name: str) -> Response:
65
+ def get_file(self, agent_id: str, file_name: str, chat_id: str | None = None) -> Response:
65
66
  """
66
67
  Download a file from the file manager for the agent specified by agent_id
67
68
  :param agent_id: The agent id
68
69
  :param file_name: The name of the file to download
70
+ :param chat_id: The chat id, optional
69
71
  :return: Response, the response containing the file content
70
72
  """
71
- response = self.get_http_client(agent_id).get(
73
+ response = self.get_http_client(agent_id, chat_id=chat_id).get(
72
74
  self.format_url(f"/files/{file_name}"),
73
75
  stream=True,
74
76
  headers={"Accept": "application/octet-stream"}
@@ -77,27 +79,31 @@ class FileManagerEndpoint(AbstractEndpoint):
77
79
 
78
80
  return response
79
81
 
80
- def delete_file(self, agent_id: str, file_name: str) -> FileManagerDeletedFiles:
82
+ def delete_file(self, agent_id: str, file_name: str, chat_id: str | None = None) -> FileManagerDeletedFiles:
81
83
  """
82
84
  Download a file from the file manager for the agent specified by agent_id
83
85
  :param agent_id: The agent id
84
86
  :param file_name: The name of the file to delete
87
+ :param chat_id: The chat id, optional
85
88
  :return: FileManagerDeletedFiles, the response containing info about the deleted file
86
89
  """
87
90
  return self.delete(
88
91
  self.format_url(f"/files/{file_name}"),
89
92
  agent_id,
90
93
  output_class=FileManagerDeletedFiles,
94
+ chat_id=chat_id,
91
95
  )
92
96
 
93
- def delete_files(self, agent_id: str) -> FileManagerDeletedFiles:
97
+ def delete_files(self, agent_id: str, chat_id: str | None = None) -> FileManagerDeletedFiles:
94
98
  """
95
99
  Download a file from the file manager for the agent specified by agent_id
96
100
  :param agent_id: The agent id
101
+ :param chat_id: The chat id, optional
97
102
  :return: bool, True if all files were deleted successfully
98
103
  """
99
104
  return self.delete(
100
105
  self.format_url("/files"),
101
106
  agent_id,
102
107
  output_class=FileManagerDeletedFiles,
108
+ chat_id=chat_id,
103
109
  )
@@ -85,6 +85,7 @@ class MemoryEndpoint(AbstractEndpoint):
85
85
  user_id: str,
86
86
  k: int | None = None,
87
87
  metadata: Dict[str, Any] | None = None,
88
+ chat_id: str | None = None,
88
89
  ) -> MemoryRecallOutput:
89
90
  """
90
91
  This endpoint retrieves memory points based on the input text. The text parameter is the input text for which
@@ -94,6 +95,7 @@ class MemoryEndpoint(AbstractEndpoint):
94
95
  :param user_id: The user ID to filter the memory points.
95
96
  :param k: The number of memory points to retrieve.
96
97
  :param metadata: The metadata to filter the memory points.
98
+ :param chat_id: The chat id, optional
97
99
  :return: MemoryRecallOutput, a list of memory points retrieved.
98
100
  """
99
101
  query = {"text": text}
@@ -108,6 +110,7 @@ class MemoryEndpoint(AbstractEndpoint):
108
110
  output_class=MemoryRecallOutput,
109
111
  user_id=user_id,
110
112
  query=query,
113
+ chat_id=chat_id,
111
114
  )
112
115
 
113
116
  def post_memory_point(
@@ -158,14 +158,16 @@ class RabbitHoleEndpoint(AbstractEndpoint):
158
158
  output_class=AllowedMimeTypesOutput
159
159
  )
160
160
 
161
- def get_web_sources(self, agent_id: str) -> List[str]:
161
+ def get_web_sources(self, agent_id: str, chat_id: str | None = None) -> List[str]:
162
162
  """
163
163
  This method retrieves the web sources for the RabbitHole API. The web sources are the web URLs that are allowed
164
164
  to be uploaded to the RabbitHole API. The web sources are returned in a list.
165
165
  :param agent_id: The ID of the agent.
166
+ :param chat_id: The chat id, optional
166
167
  :return: List[str]
167
168
  """
168
169
  return self.get(
169
170
  self.format_url("/web"),
170
171
  agent_id,
172
+ chat_id=chat_id,
171
173
  )
@@ -2,10 +2,6 @@ from typing import Dict, List, Any
2
2
  from pydantic import BaseModel, Field
3
3
 
4
4
 
5
- class Memory(BaseModel):
6
- declarative: List | None = Field(default_factory=list)
7
-
8
-
9
5
  class MemoryPoint(BaseModel):
10
6
  content: str
11
7
  metadata: Dict[str, Any]
@@ -29,4 +25,4 @@ class SettingInput(BaseModel):
29
25
  class Why(BaseModel):
30
26
  input: str | None = None
31
27
  intermediate_steps: List | None = Field(default_factory=list)
32
- memory: Memory = Field(default_factory=Memory)
28
+ memory: List | None = Field(default_factory=list)
@@ -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.0"
4
+ version = "1.8.2"
5
5
  requires-python = ">=3.10"
6
6
  license = { file = "LICENSE" }
7
7
  authors = [
@@ -1,44 +0,0 @@
1
- from typing import Dict, Any
2
-
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.declarative: Dict[str, Any] | None = None
10
-
11
- @staticmethod
12
- def create():
13
- return MemoryBuilder()
14
-
15
- def set_declarative(self, declarative: Dict[str, Any] | None = None):
16
- self.declarative = declarative or {}
17
- return self
18
-
19
- def build(self):
20
- memory = Memory()
21
- memory.declarative = self.declarative
22
-
23
- return memory
24
-
25
-
26
- class MemoryPointBuilder(BaseBuilder):
27
- def __init__(self):
28
- self.content: str = ""
29
- self.metadata: Dict[str, Any] = {}
30
-
31
- @staticmethod
32
- def create():
33
- return MemoryPointBuilder()
34
-
35
- def set_content(self, content: str):
36
- self.content = content
37
- return self
38
-
39
- def set_metadata(self, metadata: Dict[str, Any]):
40
- self.metadata = metadata
41
- return self
42
-
43
- def build(self):
44
- return MemoryPoint(self.content, self.metadata)