cheshirecat-python-sdk 1.8.2__tar.gz → 1.8.4__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.2 → cheshirecat_python_sdk-1.8.4}/PKG-INFO +1 -1
  2. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/memory.py +28 -1
  3. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/models/dtos.py +11 -1
  4. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/pyproject.toml +1 -1
  5. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/.gitignore +0 -0
  6. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/LICENSE +0 -0
  7. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/Makefile +0 -0
  8. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/README.md +0 -0
  9. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/__init__.py +0 -0
  10. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/builders/__init__.py +0 -0
  11. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/builders/base.py +0 -0
  12. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/builders/memory.py +0 -0
  13. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/builders/settings_input.py +0 -0
  14. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/builders/why.py +0 -0
  15. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/client.py +0 -0
  16. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/clients/__init__.py +0 -0
  17. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/clients/http_client.py +0 -0
  18. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/clients/websocket_client.py +0 -0
  19. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/configuration.py +0 -0
  20. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/__init__.py +0 -0
  21. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/admins.py +0 -0
  22. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/agentic_workflow.py +0 -0
  23. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/auth.py +0 -0
  24. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/auth_handler.py +0 -0
  25. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/base.py +0 -0
  26. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/chunker.py +0 -0
  27. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/conversation.py +0 -0
  28. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/custom_endpoint.py +0 -0
  29. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/embedder.py +0 -0
  30. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/file_manager.py +0 -0
  31. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/health_check.py +0 -0
  32. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/large_language_model.py +0 -0
  33. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/message.py +0 -0
  34. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/plugins.py +0 -0
  35. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/rabbit_hole.py +0 -0
  36. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/users.py +0 -0
  37. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/utils.py +0 -0
  38. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/endpoints/vector_database.py +0 -0
  39. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/enums.py +0 -0
  40. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/models/api/admins.py +0 -0
  41. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/models/api/conversations.py +0 -0
  42. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/models/api/factories.py +0 -0
  43. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/models/api/file_managers.py +0 -0
  44. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/models/api/memories.py +0 -0
  45. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/models/api/messages.py +0 -0
  46. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/models/api/nested/memories.py +0 -0
  47. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/models/api/nested/plugins.py +0 -0
  48. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/models/api/plugins.py +0 -0
  49. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/models/api/rabbit_holes.py +0 -0
  50. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/models/api/tokens.py +0 -0
  51. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/models/api/users.py +0 -0
  52. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/cheshirecat_python_sdk/utils.py +0 -0
  53. {cheshirecat_python_sdk-1.8.2 → cheshirecat_python_sdk-1.8.4}/requirements.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cheshirecat-python-sdk
3
- Version: 1.8.2
3
+ Version: 1.8.4
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
@@ -12,7 +12,7 @@ from cheshirecat_python_sdk.models.api.memories import (
12
12
  MemoryPointsOutput,
13
13
  )
14
14
  from cheshirecat_python_sdk.models.api.nested.memories import CollectionsItem
15
- from cheshirecat_python_sdk.models.dtos import Why, MemoryPoint
15
+ from cheshirecat_python_sdk.models.dtos import Why, MemoryPoint, FilterSource
16
16
 
17
17
 
18
18
  class MemoryEndpoint(AbstractEndpoint):
@@ -242,4 +242,31 @@ class MemoryEndpoint(AbstractEndpoint):
242
242
  query=query,
243
243
  )
244
244
 
245
+ def has_source(self, agent_id: str, filter_source: FilterSource, chat_id: str | None = None) -> bool:
246
+ """
247
+ Checks if the given filter source exists for a specified agent.
248
+
249
+ This method determines whether a specific source, defined by the given filter_source, is associated with the
250
+ provided agent in the memory database.
251
+ It optionally considers a specific chat ID when filtering the data. The result indicates the existence of such a
252
+ source.
253
+
254
+ Args:
255
+ agent_id: Unique identifier of the agent for which the check is performed.
256
+ filter_source: FilterSource object that defines the source or hash to check.
257
+ chat_id: An optional chat identifier to narrow the scope of the check. If not provided, the check will
258
+ operate in a broader context.
259
+
260
+ Returns:
261
+ A boolean value indicating whether the specified filter source exists in the agent's memory database.
262
+ """
263
+ metadata = {"source": filter_source.source} if filter_source.source else {"hash": filter_source.hash}
264
+ if chat_id:
265
+ metadata["chat_id"] = chat_id
266
+
267
+ collection_name = "declarative" if chat_id is None else "episodic"
268
+ points = self.get_memory_points(collection_name, agent_id, metadata=metadata)
269
+
270
+ return len(points.points) > 0
271
+
245
272
  # END Memory Points API
@@ -1,5 +1,5 @@
1
1
  from typing import Dict, List, Any
2
- from pydantic import BaseModel, Field
2
+ from pydantic import BaseModel, Field, model_validator
3
3
 
4
4
 
5
5
  class MemoryPoint(BaseModel):
@@ -26,3 +26,13 @@ class Why(BaseModel):
26
26
  input: str | None = None
27
27
  intermediate_steps: List | None = Field(default_factory=list)
28
28
  memory: List | None = Field(default_factory=list)
29
+
30
+
31
+ class FilterSource(BaseModel):
32
+ source: str | None = None
33
+ hash: str | None = None
34
+
35
+ @model_validator(mode="after")
36
+ def validate_source_or_hash(self):
37
+ assert self.source or self.hash, "Either source or hash must be provided"
38
+ return self
@@ -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.2"
4
+ version = "1.8.4"
5
5
  requires-python = ">=3.10"
6
6
  license = { file = "LICENSE" }
7
7
  authors = [