supermemory 3.0.0a29__py3-none-any.whl → 3.1.0__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.

Potentially problematic release.


This version of supermemory might be problematic. Click here for more details.

Files changed (51) hide show
  1. supermemory/__init__.py +3 -1
  2. supermemory/_base_client.py +12 -12
  3. supermemory/_client.py +17 -9
  4. supermemory/_compat.py +48 -48
  5. supermemory/_models.py +50 -44
  6. supermemory/_qs.py +7 -7
  7. supermemory/_types.py +53 -12
  8. supermemory/_utils/__init__.py +9 -2
  9. supermemory/_utils/_compat.py +45 -0
  10. supermemory/_utils/_datetime_parse.py +136 -0
  11. supermemory/_utils/_transform.py +13 -3
  12. supermemory/_utils/_typing.py +6 -1
  13. supermemory/_utils/_utils.py +4 -5
  14. supermemory/_version.py +1 -1
  15. supermemory/resources/__init__.py +14 -0
  16. supermemory/resources/connections.py +36 -36
  17. supermemory/resources/documents.py +894 -0
  18. supermemory/resources/memories.py +222 -134
  19. supermemory/resources/search.py +79 -79
  20. supermemory/resources/settings.py +31 -31
  21. supermemory/types/__init__.py +9 -0
  22. supermemory/types/connection_create_params.py +3 -2
  23. supermemory/types/connection_delete_by_provider_params.py +2 -2
  24. supermemory/types/connection_get_by_tags_params.py +2 -2
  25. supermemory/types/connection_import_params.py +2 -2
  26. supermemory/types/connection_list_documents_params.py +2 -2
  27. supermemory/types/connection_list_params.py +2 -2
  28. supermemory/types/document_add_params.py +69 -0
  29. supermemory/types/document_add_response.py +11 -0
  30. supermemory/types/document_get_response.py +104 -0
  31. supermemory/types/document_list_params.py +111 -0
  32. supermemory/types/document_list_response.py +95 -0
  33. supermemory/types/document_update_params.py +69 -0
  34. supermemory/types/document_update_response.py +11 -0
  35. supermemory/types/document_upload_file_params.py +36 -0
  36. supermemory/types/document_upload_file_response.py +11 -0
  37. supermemory/types/memory_add_params.py +39 -23
  38. supermemory/types/memory_get_response.py +21 -20
  39. supermemory/types/memory_list_params.py +79 -8
  40. supermemory/types/memory_list_response.py +18 -17
  41. supermemory/types/memory_update_params.py +31 -15
  42. supermemory/types/memory_upload_file_params.py +20 -0
  43. supermemory/types/search_documents_params.py +71 -9
  44. supermemory/types/search_execute_params.py +71 -9
  45. supermemory/types/search_memories_params.py +77 -8
  46. supermemory/types/search_memories_response.py +10 -7
  47. {supermemory-3.0.0a29.dist-info → supermemory-3.1.0.dist-info}/METADATA +18 -8
  48. supermemory-3.1.0.dist-info/RECORD +80 -0
  49. supermemory-3.0.0a29.dist-info/RECORD +0 -68
  50. {supermemory-3.0.0a29.dist-info → supermemory-3.1.0.dist-info}/WHEEL +0 -0
  51. {supermemory-3.0.0a29.dist-info → supermemory-3.1.0.dist-info}/licenses/LICENSE +0 -0
@@ -2,24 +2,38 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import List, Union
6
- from typing_extensions import Literal, Annotated, TypedDict
5
+ from typing import Union, Iterable
6
+ from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
7
7
 
8
+ from .._types import SequenceNotStr
8
9
  from .._utils import PropertyInfo
9
10
 
10
- __all__ = ["MemoryListParams"]
11
+ __all__ = [
12
+ "MemoryListParams",
13
+ "Filters",
14
+ "FiltersOr",
15
+ "FiltersOrOr",
16
+ "FiltersOrOrUnionMember0",
17
+ "FiltersOrOrOr",
18
+ "FiltersOrOrAnd",
19
+ "FiltersAnd",
20
+ "FiltersAndAnd",
21
+ "FiltersAndAndUnionMember0",
22
+ "FiltersAndAndOr",
23
+ "FiltersAndAndAnd",
24
+ ]
11
25
 
12
26
 
13
27
  class MemoryListParams(TypedDict, total=False):
14
- container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")]
15
- """Optional tags this memory should be containerized by.
28
+ container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]
29
+ """Optional tags this document should be containerized by.
16
30
 
17
31
  This can be an ID for your user, a project ID, or any other identifier you wish
18
- to use to group memories.
32
+ to use to group documents.
19
33
  """
20
34
 
21
- filters: str
22
- """Optional filters to apply to the search"""
35
+ filters: Filters
36
+ """Optional filters to apply to the search. Can be a JSON string or Query object."""
23
37
 
24
38
  include_content: Annotated[bool, PropertyInfo(alias="includeContent")]
25
39
  """Whether to include the content field in the response.
@@ -38,3 +52,60 @@ class MemoryListParams(TypedDict, total=False):
38
52
 
39
53
  sort: Literal["createdAt", "updatedAt"]
40
54
  """Field to sort by"""
55
+
56
+
57
+ class FiltersOrOrUnionMember0(TypedDict, total=False):
58
+ key: Required[str]
59
+
60
+ value: Required[str]
61
+
62
+ filter_type: Annotated[Literal["metadata", "numeric", "array_contains"], PropertyInfo(alias="filterType")]
63
+
64
+ negate: Union[bool, Literal["true", "false"]]
65
+
66
+ numeric_operator: Annotated[Literal[">", "<", ">=", "<=", "="], PropertyInfo(alias="numericOperator")]
67
+
68
+
69
+ class FiltersOrOrOr(TypedDict, total=False):
70
+ or_: Required[Annotated[Iterable[object], PropertyInfo(alias="OR")]]
71
+
72
+
73
+ class FiltersOrOrAnd(TypedDict, total=False):
74
+ and_: Required[Annotated[Iterable[object], PropertyInfo(alias="AND")]]
75
+
76
+
77
+ FiltersOrOr: TypeAlias = Union[FiltersOrOrUnionMember0, FiltersOrOrOr, FiltersOrOrAnd]
78
+
79
+
80
+ class FiltersOr(TypedDict, total=False):
81
+ or_: Required[Annotated[Iterable[FiltersOrOr], PropertyInfo(alias="OR")]]
82
+
83
+
84
+ class FiltersAndAndUnionMember0(TypedDict, total=False):
85
+ key: Required[str]
86
+
87
+ value: Required[str]
88
+
89
+ filter_type: Annotated[Literal["metadata", "numeric", "array_contains"], PropertyInfo(alias="filterType")]
90
+
91
+ negate: Union[bool, Literal["true", "false"]]
92
+
93
+ numeric_operator: Annotated[Literal[">", "<", ">=", "<=", "="], PropertyInfo(alias="numericOperator")]
94
+
95
+
96
+ class FiltersAndAndOr(TypedDict, total=False):
97
+ or_: Required[Annotated[Iterable[object], PropertyInfo(alias="OR")]]
98
+
99
+
100
+ class FiltersAndAndAnd(TypedDict, total=False):
101
+ and_: Required[Annotated[Iterable[object], PropertyInfo(alias="AND")]]
102
+
103
+
104
+ FiltersAndAnd: TypeAlias = Union[FiltersAndAndUnionMember0, FiltersAndAndOr, FiltersAndAndAnd]
105
+
106
+
107
+ class FiltersAnd(TypedDict, total=False):
108
+ and_: Required[Annotated[Iterable[FiltersAndAnd], PropertyInfo(alias="AND")]]
109
+
110
+
111
+ Filters: TypeAlias = Union[FiltersOr, FiltersAnd]
@@ -13,40 +13,41 @@ __all__ = ["MemoryListResponse", "Memory", "Pagination"]
13
13
 
14
14
  class Memory(BaseModel):
15
15
  id: str
16
- """Unique identifier of the memory."""
16
+ """Unique identifier of the document."""
17
17
 
18
18
  connection_id: Optional[str] = FieldInfo(alias="connectionId", default=None)
19
- """Optional ID of connection the memory was created from.
19
+ """Optional ID of connection the document was created from.
20
20
 
21
- This is useful for identifying the source of the memory.
21
+ This is useful for identifying the source of the document.
22
22
  """
23
23
 
24
24
  created_at: datetime = FieldInfo(alias="createdAt")
25
25
  """Creation timestamp"""
26
26
 
27
27
  custom_id: Optional[str] = FieldInfo(alias="customId", default=None)
28
- """Optional custom ID of the memory.
28
+ """Optional custom ID of the document.
29
29
 
30
- This could be an ID from your database that will uniquely identify this memory.
30
+ This could be an ID from your database that will uniquely identify this
31
+ document.
31
32
  """
32
33
 
33
34
  metadata: Union[str, float, bool, Dict[str, object], List[object], None] = None
34
- """Optional metadata for the memory.
35
+ """Optional metadata for the document.
35
36
 
36
- This is used to store additional information about the memory. You can use this
37
- to store any additional information you need about the memory. Metadata can be
38
- filtered through. Keys must be strings and are case sensitive. Values can be
39
- strings, numbers, or booleans. You cannot nest objects.
37
+ This is used to store additional information about the document. You can use
38
+ this to store any additional information you need about the document. Metadata
39
+ can be filtered through. Keys must be strings and are case sensitive. Values can
40
+ be strings, numbers, or booleans. You cannot nest objects.
40
41
  """
41
42
 
42
43
  status: Literal["unknown", "queued", "extracting", "chunking", "embedding", "indexing", "done", "failed"]
43
- """Status of the memory"""
44
+ """Status of the document"""
44
45
 
45
46
  summary: Optional[str] = None
46
- """Summary of the memory content"""
47
+ """Summary of the document content"""
47
48
 
48
49
  title: Optional[str] = None
49
- """Title of the memory"""
50
+ """Title of the document"""
50
51
 
51
52
  type: Literal[
52
53
  "text",
@@ -61,20 +62,20 @@ class Memory(BaseModel):
61
62
  "webpage",
62
63
  "onedrive",
63
64
  ]
64
- """Type of the memory"""
65
+ """Type of the document"""
65
66
 
66
67
  updated_at: datetime = FieldInfo(alias="updatedAt")
67
68
  """Last update timestamp"""
68
69
 
69
70
  container_tags: Optional[List[str]] = FieldInfo(alias="containerTags", default=None)
70
- """Optional tags this memory should be containerized by.
71
+ """Optional tags this document should be containerized by.
71
72
 
72
73
  This can be an ID for your user, a project ID, or any other identifier you wish
73
- to use to group memories.
74
+ to use to group documents.
74
75
  """
75
76
 
76
77
  content: Optional[str] = None
77
- """Content of the memory (only included when includeContent=true)"""
78
+ """Content of the document (only included when includeContent=true)"""
78
79
 
79
80
 
80
81
  class Pagination(BaseModel):
@@ -2,9 +2,10 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, List, Union
5
+ from typing import Dict, Union
6
6
  from typing_extensions import Annotated, TypedDict
7
7
 
8
+ from .._types import SequenceNotStr
8
9
  from .._utils import PropertyInfo
9
10
 
10
11
  __all__ = ["MemoryUpdateParams"]
@@ -12,21 +13,21 @@ __all__ = ["MemoryUpdateParams"]
12
13
 
13
14
  class MemoryUpdateParams(TypedDict, total=False):
14
15
  container_tag: Annotated[str, PropertyInfo(alias="containerTag")]
15
- """Optional tag this memory should be containerized by.
16
+ """Optional tag this document should be containerized by.
16
17
 
17
18
  This can be an ID for your user, a project ID, or any other identifier you wish
18
- to use to group memories.
19
+ to use to group documents.
19
20
  """
20
21
 
21
- container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")]
22
+ container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]
22
23
  """
23
- (DEPRECATED: Use containerTag instead) Optional tags this memory should be
24
+ (DEPRECATED: Use containerTag instead) Optional tags this document should be
24
25
  containerized by. This can be an ID for your user, a project ID, or any other
25
- identifier you wish to use to group memories.
26
+ identifier you wish to use to group documents.
26
27
  """
27
28
 
28
29
  content: str
29
- """The content to extract and process into a memory.
30
+ """The content to extract and process into a document.
30
31
 
31
32
  This can be a URL to a website, a PDF, an image, or a video.
32
33
 
@@ -38,16 +39,31 @@ class MemoryUpdateParams(TypedDict, total=False):
38
39
  """
39
40
 
40
41
  custom_id: Annotated[str, PropertyInfo(alias="customId")]
41
- """Optional custom ID of the memory.
42
+ """Optional custom ID of the document.
42
43
 
43
- This could be an ID from your database that will uniquely identify this memory.
44
+ This could be an ID from your database that will uniquely identify this
45
+ document.
44
46
  """
45
47
 
46
- metadata: Dict[str, Union[str, float, bool]]
47
- """Optional metadata for the memory.
48
+ file_type: Annotated[str, PropertyInfo(alias="fileType")]
49
+ """Optional file type override to force specific processing behavior.
48
50
 
49
- This is used to store additional information about the memory. You can use this
50
- to store any additional information you need about the memory. Metadata can be
51
- filtered through. Keys must be strings and are case sensitive. Values can be
52
- strings, numbers, or booleans. You cannot nest objects.
51
+ Valid values: text, pdf, tweet, google_doc, google_slide, google_sheet, image,
52
+ video, notion_doc, webpage, onedrive
53
+ """
54
+
55
+ metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]]
56
+ """Optional metadata for the document.
57
+
58
+ This is used to store additional information about the document. You can use
59
+ this to store any additional information you need about the document. Metadata
60
+ can be filtered through. Keys must be strings and are case sensitive. Values can
61
+ be strings, numbers, or booleans. You cannot nest objects.
62
+ """
63
+
64
+ mime_type: Annotated[str, PropertyInfo(alias="mimeType")]
65
+ """Required when fileType is 'image' or 'video'.
66
+
67
+ Specifies the exact MIME type to use (e.g., 'image/png', 'image/jpeg',
68
+ 'video/mp4', 'video/webm')
53
69
  """
@@ -12,5 +12,25 @@ __all__ = ["MemoryUploadFileParams"]
12
12
 
13
13
  class MemoryUploadFileParams(TypedDict, total=False):
14
14
  file: Required[FileTypes]
15
+ """File to upload and process"""
15
16
 
16
17
  container_tags: Annotated[str, PropertyInfo(alias="containerTags")]
18
+ """Optional JSON string of container tags array.
19
+
20
+ This can be an ID for your user, a project ID, or any other identifier you wish
21
+ to use to group documents.
22
+ """
23
+
24
+ file_type: Annotated[str, PropertyInfo(alias="fileType")]
25
+ """Optional file type override to force specific processing behavior.
26
+
27
+ Valid values: text, pdf, tweet, google_doc, google_slide, google_sheet, image,
28
+ video, notion_doc, webpage, onedrive
29
+ """
30
+
31
+ mime_type: Annotated[str, PropertyInfo(alias="mimeType")]
32
+ """Required when fileType is 'image' or 'video'.
33
+
34
+ Specifies the exact MIME type to use (e.g., 'image/png', 'image/jpeg',
35
+ 'video/mp4', 'video/webm')
36
+ """
@@ -2,12 +2,26 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, List, Union, Iterable
5
+ from typing import List, Union, Iterable
6
6
  from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
7
7
 
8
+ from .._types import SequenceNotStr
8
9
  from .._utils import PropertyInfo
9
10
 
10
- __all__ = ["SearchDocumentsParams", "Filters", "FiltersUnionMember0"]
11
+ __all__ = [
12
+ "SearchDocumentsParams",
13
+ "Filters",
14
+ "FiltersOr",
15
+ "FiltersOrOr",
16
+ "FiltersOrOrUnionMember0",
17
+ "FiltersOrOrOr",
18
+ "FiltersOrOrAnd",
19
+ "FiltersAnd",
20
+ "FiltersAndAnd",
21
+ "FiltersAndAndUnionMember0",
22
+ "FiltersAndAndOr",
23
+ "FiltersAndAndAnd",
24
+ ]
11
25
 
12
26
 
13
27
  class SearchDocumentsParams(TypedDict, total=False):
@@ -26,11 +40,11 @@ class SearchDocumentsParams(TypedDict, total=False):
26
40
  (returns lesser chunks, accurate results)
27
41
  """
28
42
 
29
- container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")]
43
+ container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]
30
44
  """Optional tags this search should be containerized by.
31
45
 
32
46
  This can be an ID for your user, a project ID, or any other identifier you wish
33
- to use to filter memories.
47
+ to use to filter documents.
34
48
  """
35
49
 
36
50
  doc_id: Annotated[str, PropertyInfo(alias="docId")]
@@ -47,7 +61,7 @@ class SearchDocumentsParams(TypedDict, total=False):
47
61
  """
48
62
 
49
63
  filters: Filters
50
- """Optional filters to apply to the search"""
64
+ """Optional filters to apply to the search. Can be a JSON string or Query object."""
51
65
 
52
66
  include_full_docs: Annotated[bool, PropertyInfo(alias="includeFullDocs")]
53
67
  """If true, include full document in the response.
@@ -84,10 +98,58 @@ class SearchDocumentsParams(TypedDict, total=False):
84
98
  """
85
99
 
86
100
 
87
- class FiltersUnionMember0(TypedDict, total=False):
88
- and_: Annotated[Iterable[object], PropertyInfo(alias="AND")]
101
+ class FiltersOrOrUnionMember0(TypedDict, total=False):
102
+ key: Required[str]
89
103
 
90
- or_: Annotated[Iterable[object], PropertyInfo(alias="OR")]
104
+ value: Required[str]
91
105
 
106
+ filter_type: Annotated[Literal["metadata", "numeric", "array_contains"], PropertyInfo(alias="filterType")]
92
107
 
93
- Filters: TypeAlias = Union[FiltersUnionMember0, Dict[str, object]]
108
+ negate: Union[bool, Literal["true", "false"]]
109
+
110
+ numeric_operator: Annotated[Literal[">", "<", ">=", "<=", "="], PropertyInfo(alias="numericOperator")]
111
+
112
+
113
+ class FiltersOrOrOr(TypedDict, total=False):
114
+ or_: Required[Annotated[Iterable[object], PropertyInfo(alias="OR")]]
115
+
116
+
117
+ class FiltersOrOrAnd(TypedDict, total=False):
118
+ and_: Required[Annotated[Iterable[object], PropertyInfo(alias="AND")]]
119
+
120
+
121
+ FiltersOrOr: TypeAlias = Union[FiltersOrOrUnionMember0, FiltersOrOrOr, FiltersOrOrAnd]
122
+
123
+
124
+ class FiltersOr(TypedDict, total=False):
125
+ or_: Required[Annotated[Iterable[FiltersOrOr], PropertyInfo(alias="OR")]]
126
+
127
+
128
+ class FiltersAndAndUnionMember0(TypedDict, total=False):
129
+ key: Required[str]
130
+
131
+ value: Required[str]
132
+
133
+ filter_type: Annotated[Literal["metadata", "numeric", "array_contains"], PropertyInfo(alias="filterType")]
134
+
135
+ negate: Union[bool, Literal["true", "false"]]
136
+
137
+ numeric_operator: Annotated[Literal[">", "<", ">=", "<=", "="], PropertyInfo(alias="numericOperator")]
138
+
139
+
140
+ class FiltersAndAndOr(TypedDict, total=False):
141
+ or_: Required[Annotated[Iterable[object], PropertyInfo(alias="OR")]]
142
+
143
+
144
+ class FiltersAndAndAnd(TypedDict, total=False):
145
+ and_: Required[Annotated[Iterable[object], PropertyInfo(alias="AND")]]
146
+
147
+
148
+ FiltersAndAnd: TypeAlias = Union[FiltersAndAndUnionMember0, FiltersAndAndOr, FiltersAndAndAnd]
149
+
150
+
151
+ class FiltersAnd(TypedDict, total=False):
152
+ and_: Required[Annotated[Iterable[FiltersAndAnd], PropertyInfo(alias="AND")]]
153
+
154
+
155
+ Filters: TypeAlias = Union[FiltersOr, FiltersAnd]
@@ -2,12 +2,26 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, List, Union, Iterable
5
+ from typing import List, Union, Iterable
6
6
  from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
7
7
 
8
+ from .._types import SequenceNotStr
8
9
  from .._utils import PropertyInfo
9
10
 
10
- __all__ = ["SearchExecuteParams", "Filters", "FiltersUnionMember0"]
11
+ __all__ = [
12
+ "SearchExecuteParams",
13
+ "Filters",
14
+ "FiltersOr",
15
+ "FiltersOrOr",
16
+ "FiltersOrOrUnionMember0",
17
+ "FiltersOrOrOr",
18
+ "FiltersOrOrAnd",
19
+ "FiltersAnd",
20
+ "FiltersAndAnd",
21
+ "FiltersAndAndUnionMember0",
22
+ "FiltersAndAndOr",
23
+ "FiltersAndAndAnd",
24
+ ]
11
25
 
12
26
 
13
27
  class SearchExecuteParams(TypedDict, total=False):
@@ -26,11 +40,11 @@ class SearchExecuteParams(TypedDict, total=False):
26
40
  (returns lesser chunks, accurate results)
27
41
  """
28
42
 
29
- container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")]
43
+ container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]
30
44
  """Optional tags this search should be containerized by.
31
45
 
32
46
  This can be an ID for your user, a project ID, or any other identifier you wish
33
- to use to filter memories.
47
+ to use to filter documents.
34
48
  """
35
49
 
36
50
  doc_id: Annotated[str, PropertyInfo(alias="docId")]
@@ -47,7 +61,7 @@ class SearchExecuteParams(TypedDict, total=False):
47
61
  """
48
62
 
49
63
  filters: Filters
50
- """Optional filters to apply to the search"""
64
+ """Optional filters to apply to the search. Can be a JSON string or Query object."""
51
65
 
52
66
  include_full_docs: Annotated[bool, PropertyInfo(alias="includeFullDocs")]
53
67
  """If true, include full document in the response.
@@ -84,10 +98,58 @@ class SearchExecuteParams(TypedDict, total=False):
84
98
  """
85
99
 
86
100
 
87
- class FiltersUnionMember0(TypedDict, total=False):
88
- and_: Annotated[Iterable[object], PropertyInfo(alias="AND")]
101
+ class FiltersOrOrUnionMember0(TypedDict, total=False):
102
+ key: Required[str]
89
103
 
90
- or_: Annotated[Iterable[object], PropertyInfo(alias="OR")]
104
+ value: Required[str]
91
105
 
106
+ filter_type: Annotated[Literal["metadata", "numeric", "array_contains"], PropertyInfo(alias="filterType")]
92
107
 
93
- Filters: TypeAlias = Union[FiltersUnionMember0, Dict[str, object]]
108
+ negate: Union[bool, Literal["true", "false"]]
109
+
110
+ numeric_operator: Annotated[Literal[">", "<", ">=", "<=", "="], PropertyInfo(alias="numericOperator")]
111
+
112
+
113
+ class FiltersOrOrOr(TypedDict, total=False):
114
+ or_: Required[Annotated[Iterable[object], PropertyInfo(alias="OR")]]
115
+
116
+
117
+ class FiltersOrOrAnd(TypedDict, total=False):
118
+ and_: Required[Annotated[Iterable[object], PropertyInfo(alias="AND")]]
119
+
120
+
121
+ FiltersOrOr: TypeAlias = Union[FiltersOrOrUnionMember0, FiltersOrOrOr, FiltersOrOrAnd]
122
+
123
+
124
+ class FiltersOr(TypedDict, total=False):
125
+ or_: Required[Annotated[Iterable[FiltersOrOr], PropertyInfo(alias="OR")]]
126
+
127
+
128
+ class FiltersAndAndUnionMember0(TypedDict, total=False):
129
+ key: Required[str]
130
+
131
+ value: Required[str]
132
+
133
+ filter_type: Annotated[Literal["metadata", "numeric", "array_contains"], PropertyInfo(alias="filterType")]
134
+
135
+ negate: Union[bool, Literal["true", "false"]]
136
+
137
+ numeric_operator: Annotated[Literal[">", "<", ">=", "<=", "="], PropertyInfo(alias="numericOperator")]
138
+
139
+
140
+ class FiltersAndAndOr(TypedDict, total=False):
141
+ or_: Required[Annotated[Iterable[object], PropertyInfo(alias="OR")]]
142
+
143
+
144
+ class FiltersAndAndAnd(TypedDict, total=False):
145
+ and_: Required[Annotated[Iterable[object], PropertyInfo(alias="AND")]]
146
+
147
+
148
+ FiltersAndAnd: TypeAlias = Union[FiltersAndAndUnionMember0, FiltersAndAndOr, FiltersAndAndAnd]
149
+
150
+
151
+ class FiltersAnd(TypedDict, total=False):
152
+ and_: Required[Annotated[Iterable[FiltersAndAnd], PropertyInfo(alias="AND")]]
153
+
154
+
155
+ Filters: TypeAlias = Union[FiltersOr, FiltersAnd]
@@ -2,12 +2,26 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, Union, Iterable
6
- from typing_extensions import Required, Annotated, TypeAlias, TypedDict
5
+ from typing import Union, Iterable
6
+ from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
7
7
 
8
8
  from .._utils import PropertyInfo
9
9
 
10
- __all__ = ["SearchMemoriesParams", "Filters", "FiltersUnionMember0", "Include"]
10
+ __all__ = [
11
+ "SearchMemoriesParams",
12
+ "Filters",
13
+ "FiltersOr",
14
+ "FiltersOrOr",
15
+ "FiltersOrOrUnionMember0",
16
+ "FiltersOrOrOr",
17
+ "FiltersOrOrAnd",
18
+ "FiltersAnd",
19
+ "FiltersAndAnd",
20
+ "FiltersAndAndUnionMember0",
21
+ "FiltersAndAndOr",
22
+ "FiltersAndAndAnd",
23
+ "Include",
24
+ ]
11
25
 
12
26
 
13
27
  class SearchMemoriesParams(TypedDict, total=False):
@@ -22,7 +36,7 @@ class SearchMemoriesParams(TypedDict, total=False):
22
36
  """
23
37
 
24
38
  filters: Filters
25
- """Optional filters to apply to the search"""
39
+ """Optional filters to apply to the search. Can be a JSON string or Query object."""
26
40
 
27
41
  include: Include
28
42
 
@@ -49,18 +63,73 @@ class SearchMemoriesParams(TypedDict, total=False):
49
63
  """
50
64
 
51
65
 
52
- class FiltersUnionMember0(TypedDict, total=False):
53
- and_: Annotated[Iterable[object], PropertyInfo(alias="AND")]
66
+ class FiltersOrOrUnionMember0(TypedDict, total=False):
67
+ key: Required[str]
54
68
 
55
- or_: Annotated[Iterable[object], PropertyInfo(alias="OR")]
69
+ value: Required[str]
56
70
 
71
+ filter_type: Annotated[Literal["metadata", "numeric", "array_contains"], PropertyInfo(alias="filterType")]
57
72
 
58
- Filters: TypeAlias = Union[FiltersUnionMember0, Dict[str, object]]
73
+ negate: Union[bool, Literal["true", "false"]]
74
+
75
+ numeric_operator: Annotated[Literal[">", "<", ">=", "<=", "="], PropertyInfo(alias="numericOperator")]
76
+
77
+
78
+ class FiltersOrOrOr(TypedDict, total=False):
79
+ or_: Required[Annotated[Iterable[object], PropertyInfo(alias="OR")]]
80
+
81
+
82
+ class FiltersOrOrAnd(TypedDict, total=False):
83
+ and_: Required[Annotated[Iterable[object], PropertyInfo(alias="AND")]]
84
+
85
+
86
+ FiltersOrOr: TypeAlias = Union[FiltersOrOrUnionMember0, FiltersOrOrOr, FiltersOrOrAnd]
87
+
88
+
89
+ class FiltersOr(TypedDict, total=False):
90
+ or_: Required[Annotated[Iterable[FiltersOrOr], PropertyInfo(alias="OR")]]
91
+
92
+
93
+ class FiltersAndAndUnionMember0(TypedDict, total=False):
94
+ key: Required[str]
95
+
96
+ value: Required[str]
97
+
98
+ filter_type: Annotated[Literal["metadata", "numeric", "array_contains"], PropertyInfo(alias="filterType")]
99
+
100
+ negate: Union[bool, Literal["true", "false"]]
101
+
102
+ numeric_operator: Annotated[Literal[">", "<", ">=", "<=", "="], PropertyInfo(alias="numericOperator")]
103
+
104
+
105
+ class FiltersAndAndOr(TypedDict, total=False):
106
+ or_: Required[Annotated[Iterable[object], PropertyInfo(alias="OR")]]
107
+
108
+
109
+ class FiltersAndAndAnd(TypedDict, total=False):
110
+ and_: Required[Annotated[Iterable[object], PropertyInfo(alias="AND")]]
111
+
112
+
113
+ FiltersAndAnd: TypeAlias = Union[FiltersAndAndUnionMember0, FiltersAndAndOr, FiltersAndAndAnd]
114
+
115
+
116
+ class FiltersAnd(TypedDict, total=False):
117
+ and_: Required[Annotated[Iterable[FiltersAndAnd], PropertyInfo(alias="AND")]]
118
+
119
+
120
+ Filters: TypeAlias = Union[FiltersOr, FiltersAnd]
59
121
 
60
122
 
61
123
  class Include(TypedDict, total=False):
62
124
  documents: bool
63
125
 
126
+ forgotten_memories: Annotated[bool, PropertyInfo(alias="forgottenMemories")]
127
+ """If true, include forgotten memories in search results.
128
+
129
+ Forgotten memories are memories that have been explicitly forgotten or have
130
+ passed their expiration date.
131
+ """
132
+
64
133
  related_memories: Annotated[bool, PropertyInfo(alias="relatedMemories")]
65
134
 
66
135
  summaries: bool
@@ -71,17 +71,20 @@ class ResultDocument(BaseModel):
71
71
  created_at: datetime = FieldInfo(alias="createdAt")
72
72
  """Document creation date"""
73
73
 
74
+ updated_at: datetime = FieldInfo(alias="updatedAt")
75
+ """Document last update date"""
76
+
74
77
  metadata: Optional[Dict[str, object]] = None
75
- """Document metadata"""
78
+ """Document metadata (only included when documents=true)"""
76
79
 
77
- title: str
78
- """Document title"""
80
+ summary: Optional[str] = None
81
+ """Document summary (only included when summaries=true)"""
79
82
 
80
- type: str
81
- """Document type"""
83
+ title: Optional[str] = None
84
+ """Document title (only included when documents=true)"""
82
85
 
83
- updated_at: datetime = FieldInfo(alias="updatedAt")
84
- """Document last update date"""
86
+ type: Optional[str] = None
87
+ """Document type (only included when documents=true)"""
85
88
 
86
89
 
87
90
  class Result(BaseModel):