supermemory 3.7.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.
Files changed (84) hide show
  1. supermemory/__init__.py +102 -0
  2. supermemory/_base_client.py +1995 -0
  3. supermemory/_client.py +683 -0
  4. supermemory/_compat.py +219 -0
  5. supermemory/_constants.py +14 -0
  6. supermemory/_exceptions.py +108 -0
  7. supermemory/_files.py +123 -0
  8. supermemory/_models.py +857 -0
  9. supermemory/_qs.py +150 -0
  10. supermemory/_resource.py +43 -0
  11. supermemory/_response.py +832 -0
  12. supermemory/_streaming.py +331 -0
  13. supermemory/_types.py +260 -0
  14. supermemory/_utils/__init__.py +64 -0
  15. supermemory/_utils/_compat.py +45 -0
  16. supermemory/_utils/_datetime_parse.py +136 -0
  17. supermemory/_utils/_logs.py +25 -0
  18. supermemory/_utils/_proxy.py +65 -0
  19. supermemory/_utils/_reflection.py +42 -0
  20. supermemory/_utils/_resources_proxy.py +24 -0
  21. supermemory/_utils/_streams.py +12 -0
  22. supermemory/_utils/_sync.py +58 -0
  23. supermemory/_utils/_transform.py +457 -0
  24. supermemory/_utils/_typing.py +156 -0
  25. supermemory/_utils/_utils.py +421 -0
  26. supermemory/_version.py +4 -0
  27. supermemory/lib/.keep +4 -0
  28. supermemory/py.typed +0 -0
  29. supermemory/resources/__init__.py +75 -0
  30. supermemory/resources/connections.py +807 -0
  31. supermemory/resources/documents.py +830 -0
  32. supermemory/resources/memories.py +830 -0
  33. supermemory/resources/search.py +657 -0
  34. supermemory/resources/settings.py +278 -0
  35. supermemory/types/__init__.py +51 -0
  36. supermemory/types/add_response.py +13 -0
  37. supermemory/types/client_add_params.py +36 -0
  38. supermemory/types/client_profile_params.py +21 -0
  39. supermemory/types/connection_create_params.py +21 -0
  40. supermemory/types/connection_create_response.py +19 -0
  41. supermemory/types/connection_delete_by_id_response.py +11 -0
  42. supermemory/types/connection_delete_by_provider_params.py +15 -0
  43. supermemory/types/connection_delete_by_provider_response.py +11 -0
  44. supermemory/types/connection_get_by_id_response.py +25 -0
  45. supermemory/types/connection_get_by_tags_params.py +15 -0
  46. supermemory/types/connection_get_by_tags_response.py +25 -0
  47. supermemory/types/connection_import_params.py +15 -0
  48. supermemory/types/connection_import_response.py +7 -0
  49. supermemory/types/connection_list_documents_params.py +15 -0
  50. supermemory/types/connection_list_documents_response.py +29 -0
  51. supermemory/types/connection_list_params.py +15 -0
  52. supermemory/types/connection_list_response.py +29 -0
  53. supermemory/types/document_add_params.py +36 -0
  54. supermemory/types/document_add_response.py +13 -0
  55. supermemory/types/document_get_response.py +103 -0
  56. supermemory/types/document_list_params.py +52 -0
  57. supermemory/types/document_list_response.py +94 -0
  58. supermemory/types/document_update_params.py +55 -0
  59. supermemory/types/document_update_response.py +13 -0
  60. supermemory/types/document_upload_file_params.py +44 -0
  61. supermemory/types/document_upload_file_response.py +13 -0
  62. supermemory/types/memory_add_params.py +36 -0
  63. supermemory/types/memory_add_response.py +13 -0
  64. supermemory/types/memory_get_response.py +103 -0
  65. supermemory/types/memory_list_params.py +52 -0
  66. supermemory/types/memory_list_response.py +94 -0
  67. supermemory/types/memory_update_params.py +55 -0
  68. supermemory/types/memory_update_response.py +13 -0
  69. supermemory/types/memory_upload_file_params.py +44 -0
  70. supermemory/types/memory_upload_file_response.py +13 -0
  71. supermemory/types/profile_response.py +35 -0
  72. supermemory/types/search_documents_params.py +93 -0
  73. supermemory/types/search_documents_response.py +60 -0
  74. supermemory/types/search_execute_params.py +93 -0
  75. supermemory/types/search_execute_response.py +60 -0
  76. supermemory/types/search_memories_params.py +75 -0
  77. supermemory/types/search_memories_response.py +123 -0
  78. supermemory/types/setting_get_response.py +43 -0
  79. supermemory/types/setting_update_params.py +44 -0
  80. supermemory/types/setting_update_response.py +51 -0
  81. supermemory-3.7.0.dist-info/METADATA +447 -0
  82. supermemory-3.7.0.dist-info/RECORD +84 -0
  83. supermemory-3.7.0.dist-info/WHEEL +4 -0
  84. supermemory-3.7.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,94 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Dict, List, Union, Optional
4
+ from typing_extensions import Literal
5
+
6
+ from pydantic import Field as FieldInfo
7
+
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["MemoryListResponse", "Memory", "Pagination"]
11
+
12
+
13
+ class Memory(BaseModel):
14
+ id: str
15
+ """Unique identifier of the document."""
16
+
17
+ connection_id: Optional[str] = FieldInfo(alias="connectionId", default=None)
18
+ """Optional ID of connection the document was created from.
19
+
20
+ This is useful for identifying the source of the document.
21
+ """
22
+
23
+ created_at: str = FieldInfo(alias="createdAt")
24
+ """Creation timestamp"""
25
+
26
+ custom_id: Optional[str] = FieldInfo(alias="customId", default=None)
27
+ """Optional custom ID of the document.
28
+
29
+ This could be an ID from your database that will uniquely identify this
30
+ document.
31
+ """
32
+
33
+ metadata: Union[str, float, bool, Dict[str, object], List[object], None] = None
34
+ """Optional metadata for the document.
35
+
36
+ This is used to store additional information about the document. You can use
37
+ this to store any additional information you need about the document. Metadata
38
+ can be filtered through. Keys must be strings and are case sensitive. Values can
39
+ be strings, numbers, or booleans. You cannot nest objects.
40
+ """
41
+
42
+ status: Literal["unknown", "queued", "extracting", "chunking", "embedding", "indexing", "done", "failed"]
43
+ """Status of the document"""
44
+
45
+ summary: Optional[str] = None
46
+ """Summary of the document content"""
47
+
48
+ title: Optional[str] = None
49
+ """Title of the document"""
50
+
51
+ type: Literal[
52
+ "text",
53
+ "pdf",
54
+ "tweet",
55
+ "google_doc",
56
+ "google_slide",
57
+ "google_sheet",
58
+ "image",
59
+ "video",
60
+ "notion_doc",
61
+ "webpage",
62
+ "onedrive",
63
+ ]
64
+ """Type of the document"""
65
+
66
+ updated_at: str = FieldInfo(alias="updatedAt")
67
+ """Last update timestamp"""
68
+
69
+ container_tags: Optional[List[str]] = FieldInfo(alias="containerTags", default=None)
70
+ """Optional tags this document should be containerized by.
71
+
72
+ This can be an ID for your user, a project ID, or any other identifier you wish
73
+ to use to group documents.
74
+ """
75
+
76
+ content: Optional[str] = None
77
+ """Content of the document (only included when includeContent=true)"""
78
+
79
+
80
+ class Pagination(BaseModel):
81
+ current_page: float = FieldInfo(alias="currentPage")
82
+
83
+ total_items: float = FieldInfo(alias="totalItems")
84
+
85
+ total_pages: float = FieldInfo(alias="totalPages")
86
+
87
+ limit: Optional[float] = None
88
+
89
+
90
+ class MemoryListResponse(BaseModel):
91
+ memories: List[Memory]
92
+
93
+ pagination: Pagination
94
+ """Pagination metadata"""
@@ -0,0 +1,55 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Dict, Union
6
+ from typing_extensions import Annotated, TypedDict
7
+
8
+ from .._types import SequenceNotStr
9
+ from .._utils import PropertyInfo
10
+
11
+ __all__ = ["MemoryUpdateParams"]
12
+
13
+
14
+ class MemoryUpdateParams(TypedDict, total=False):
15
+ container_tag: Annotated[str, PropertyInfo(alias="containerTag")]
16
+ """Optional tag this document should be containerized by.
17
+
18
+ This can be an ID for your user, a project ID, or any other identifier you wish
19
+ to use to group documents.
20
+ """
21
+
22
+ container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]
23
+ """
24
+ (DEPRECATED: Use containerTag instead) Optional tags this document should be
25
+ containerized by. This can be an ID for your user, a project ID, or any other
26
+ identifier you wish to use to group documents.
27
+ """
28
+
29
+ content: str
30
+ """The content to extract and process into a document.
31
+
32
+ This can be a URL to a website, a PDF, an image, or a video.
33
+
34
+ Plaintext: Any plaintext format
35
+
36
+ URL: A URL to a website, PDF, image, or video
37
+
38
+ We automatically detect the content type from the url's response format.
39
+ """
40
+
41
+ custom_id: Annotated[str, PropertyInfo(alias="customId")]
42
+ """Optional custom ID of the document.
43
+
44
+ This could be an ID from your database that will uniquely identify this
45
+ document.
46
+ """
47
+
48
+ metadata: Dict[str, Union[str, float, bool, SequenceNotStr[str]]]
49
+ """Optional metadata for the document.
50
+
51
+ This is used to store additional information about the document. You can use
52
+ this to store any additional information you need about the document. Metadata
53
+ can be filtered through. Keys must be strings and are case sensitive. Values can
54
+ be strings, numbers, or booleans. You cannot nest objects.
55
+ """
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .._models import BaseModel
4
+
5
+ __all__ = ["MemoryUpdateResponse"]
6
+
7
+
8
+ class MemoryUpdateResponse(BaseModel):
9
+ id: str
10
+ """Unique identifier of the document"""
11
+
12
+ status: str
13
+ """Status of the document"""
@@ -0,0 +1,44 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Required, Annotated, TypedDict
6
+
7
+ from .._types import FileTypes
8
+ from .._utils import PropertyInfo
9
+
10
+ __all__ = ["MemoryUploadFileParams"]
11
+
12
+
13
+ class MemoryUploadFileParams(TypedDict, total=False):
14
+ file: Required[FileTypes]
15
+ """File to upload and process"""
16
+
17
+ container_tags: Annotated[str, PropertyInfo(alias="containerTags")]
18
+ """Optional container tags.
19
+
20
+ Can be either a JSON string of an array (e.g., '["user_123", "project_123"]') or
21
+ a single string (e.g., 'user_123'). Single strings will be automatically
22
+ converted to an array.
23
+ """
24
+
25
+ file_type: Annotated[str, PropertyInfo(alias="fileType")]
26
+ """Optional file type override to force specific processing behavior.
27
+
28
+ Valid values: text, pdf, tweet, google_doc, google_slide, google_sheet, image,
29
+ video, notion_doc, webpage, onedrive
30
+ """
31
+
32
+ metadata: str
33
+ """Optional metadata for the document as a JSON string.
34
+
35
+ This is used to store additional information about the document. Keys must be
36
+ strings and values can be strings, numbers, or booleans.
37
+ """
38
+
39
+ mime_type: Annotated[str, PropertyInfo(alias="mimeType")]
40
+ """Required when fileType is 'image' or 'video'.
41
+
42
+ Specifies the exact MIME type to use (e.g., 'image/png', 'image/jpeg',
43
+ 'video/mp4', 'video/webm')
44
+ """
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .._models import BaseModel
4
+
5
+ __all__ = ["MemoryUploadFileResponse"]
6
+
7
+
8
+ class MemoryUploadFileResponse(BaseModel):
9
+ id: str
10
+ """Unique identifier of the document"""
11
+
12
+ status: str
13
+ """Status of the document"""
@@ -0,0 +1,35 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+
5
+ from pydantic import Field as FieldInfo
6
+
7
+ from .._models import BaseModel
8
+
9
+ __all__ = ["ProfileResponse", "Profile", "SearchResults"]
10
+
11
+
12
+ class Profile(BaseModel):
13
+ dynamic: List[str]
14
+ """Dynamic profile information (recent memories)"""
15
+
16
+ static: List[str]
17
+ """Static profile information that remains relevant long-term"""
18
+
19
+
20
+ class SearchResults(BaseModel):
21
+ results: List[object]
22
+ """Search results for the provided query"""
23
+
24
+ timing: float
25
+ """Search timing in milliseconds"""
26
+
27
+ total: float
28
+ """Total number of search results"""
29
+
30
+
31
+ class ProfileResponse(BaseModel):
32
+ profile: Profile
33
+
34
+ search_results: Optional[SearchResults] = FieldInfo(alias="searchResults", default=None)
35
+ """Search results if a search query was provided"""
@@ -0,0 +1,93 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Union, Iterable
6
+ from typing_extensions import Required, Annotated, TypeAlias, TypedDict
7
+
8
+ from .._types import SequenceNotStr
9
+ from .._utils import PropertyInfo
10
+
11
+ __all__ = ["SearchDocumentsParams", "Filters", "FiltersOr", "FiltersAnd"]
12
+
13
+
14
+ class SearchDocumentsParams(TypedDict, total=False):
15
+ q: Required[str]
16
+ """Search query string"""
17
+
18
+ categories_filter: Annotated[SequenceNotStr[str], PropertyInfo(alias="categoriesFilter")]
19
+ """DEPRECATED: Optional category filters"""
20
+
21
+ chunk_threshold: Annotated[float, PropertyInfo(alias="chunkThreshold")]
22
+ """Threshold / sensitivity for chunk selection.
23
+
24
+ 0 is least sensitive (returns most chunks, more results), 1 is most sensitive
25
+ (returns lesser chunks, accurate results)
26
+ """
27
+
28
+ container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]
29
+ """Optional tags this search should be containerized by.
30
+
31
+ This can be an ID for your user, a project ID, or any other identifier you wish
32
+ to use to filter documents.
33
+ """
34
+
35
+ doc_id: Annotated[str, PropertyInfo(alias="docId")]
36
+ """Optional document ID to search within.
37
+
38
+ You can use this to find chunks in a very large document.
39
+ """
40
+
41
+ document_threshold: Annotated[float, PropertyInfo(alias="documentThreshold")]
42
+ """DEPRECATED: This field is no longer used in v3 search.
43
+
44
+ The search now uses chunkThreshold only. This parameter will be ignored.
45
+ """
46
+
47
+ filters: Filters
48
+ """Optional filters to apply to the search. Can be a JSON string or Query object."""
49
+
50
+ include_full_docs: Annotated[bool, PropertyInfo(alias="includeFullDocs")]
51
+ """If true, include full document in the response.
52
+
53
+ This is helpful if you want a chatbot to know the full context of the document.
54
+ """
55
+
56
+ include_summary: Annotated[bool, PropertyInfo(alias="includeSummary")]
57
+ """If true, include document summary in the response.
58
+
59
+ This is helpful if you want a chatbot to know the full context of the document.
60
+ """
61
+
62
+ limit: int
63
+ """Maximum number of results to return"""
64
+
65
+ only_matching_chunks: Annotated[bool, PropertyInfo(alias="onlyMatchingChunks")]
66
+ """If true, only return matching chunks without context.
67
+
68
+ Normally, we send the previous and next chunk to provide more context for LLMs.
69
+ If you only want the matching chunk, set this to true.
70
+ """
71
+
72
+ rerank: bool
73
+ """If true, rerank the results based on the query.
74
+
75
+ This is helpful if you want to ensure the most relevant results are returned.
76
+ """
77
+
78
+ rewrite_query: Annotated[bool, PropertyInfo(alias="rewriteQuery")]
79
+ """If true, rewrites the query to make it easier to find documents.
80
+
81
+ This increases the latency by about 400ms
82
+ """
83
+
84
+
85
+ class FiltersOr(TypedDict, total=False):
86
+ or_: Required[Annotated[Iterable[object], PropertyInfo(alias="OR")]]
87
+
88
+
89
+ class FiltersAnd(TypedDict, total=False):
90
+ and_: Required[Annotated[Iterable[object], PropertyInfo(alias="AND")]]
91
+
92
+
93
+ Filters: TypeAlias = Union[FiltersOr, FiltersAnd]
@@ -0,0 +1,60 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Dict, List, Optional
4
+
5
+ from pydantic import Field as FieldInfo
6
+
7
+ from .._models import BaseModel
8
+
9
+ __all__ = ["SearchDocumentsResponse", "Result", "ResultChunk"]
10
+
11
+
12
+ class ResultChunk(BaseModel):
13
+ content: str
14
+ """Content of the matching chunk"""
15
+
16
+ is_relevant: bool = FieldInfo(alias="isRelevant")
17
+ """Whether this chunk is relevant to the query"""
18
+
19
+ score: float
20
+ """Similarity score for this chunk"""
21
+
22
+
23
+ class Result(BaseModel):
24
+ chunks: List[ResultChunk]
25
+ """Matching content chunks from the document"""
26
+
27
+ created_at: str = FieldInfo(alias="createdAt")
28
+ """Document creation date"""
29
+
30
+ document_id: str = FieldInfo(alias="documentId")
31
+ """ID of the matching document"""
32
+
33
+ metadata: Optional[Dict[str, object]] = None
34
+ """Document metadata"""
35
+
36
+ score: float
37
+ """Relevance score of the match"""
38
+
39
+ title: Optional[str] = None
40
+ """Document title"""
41
+
42
+ type: Optional[str] = None
43
+ """Document type"""
44
+
45
+ updated_at: str = FieldInfo(alias="updatedAt")
46
+ """Document last update date"""
47
+
48
+ content: Optional[str] = None
49
+ """Full document content (only included when includeFullDocs=true)"""
50
+
51
+ summary: Optional[str] = None
52
+ """Document summary"""
53
+
54
+
55
+ class SearchDocumentsResponse(BaseModel):
56
+ results: List[Result]
57
+
58
+ timing: float
59
+
60
+ total: float
@@ -0,0 +1,93 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Union, Iterable
6
+ from typing_extensions import Required, Annotated, TypeAlias, TypedDict
7
+
8
+ from .._types import SequenceNotStr
9
+ from .._utils import PropertyInfo
10
+
11
+ __all__ = ["SearchExecuteParams", "Filters", "FiltersOr", "FiltersAnd"]
12
+
13
+
14
+ class SearchExecuteParams(TypedDict, total=False):
15
+ q: Required[str]
16
+ """Search query string"""
17
+
18
+ categories_filter: Annotated[SequenceNotStr[str], PropertyInfo(alias="categoriesFilter")]
19
+ """DEPRECATED: Optional category filters"""
20
+
21
+ chunk_threshold: Annotated[float, PropertyInfo(alias="chunkThreshold")]
22
+ """Threshold / sensitivity for chunk selection.
23
+
24
+ 0 is least sensitive (returns most chunks, more results), 1 is most sensitive
25
+ (returns lesser chunks, accurate results)
26
+ """
27
+
28
+ container_tags: Annotated[SequenceNotStr[str], PropertyInfo(alias="containerTags")]
29
+ """Optional tags this search should be containerized by.
30
+
31
+ This can be an ID for your user, a project ID, or any other identifier you wish
32
+ to use to filter documents.
33
+ """
34
+
35
+ doc_id: Annotated[str, PropertyInfo(alias="docId")]
36
+ """Optional document ID to search within.
37
+
38
+ You can use this to find chunks in a very large document.
39
+ """
40
+
41
+ document_threshold: Annotated[float, PropertyInfo(alias="documentThreshold")]
42
+ """DEPRECATED: This field is no longer used in v3 search.
43
+
44
+ The search now uses chunkThreshold only. This parameter will be ignored.
45
+ """
46
+
47
+ filters: Filters
48
+ """Optional filters to apply to the search. Can be a JSON string or Query object."""
49
+
50
+ include_full_docs: Annotated[bool, PropertyInfo(alias="includeFullDocs")]
51
+ """If true, include full document in the response.
52
+
53
+ This is helpful if you want a chatbot to know the full context of the document.
54
+ """
55
+
56
+ include_summary: Annotated[bool, PropertyInfo(alias="includeSummary")]
57
+ """If true, include document summary in the response.
58
+
59
+ This is helpful if you want a chatbot to know the full context of the document.
60
+ """
61
+
62
+ limit: int
63
+ """Maximum number of results to return"""
64
+
65
+ only_matching_chunks: Annotated[bool, PropertyInfo(alias="onlyMatchingChunks")]
66
+ """If true, only return matching chunks without context.
67
+
68
+ Normally, we send the previous and next chunk to provide more context for LLMs.
69
+ If you only want the matching chunk, set this to true.
70
+ """
71
+
72
+ rerank: bool
73
+ """If true, rerank the results based on the query.
74
+
75
+ This is helpful if you want to ensure the most relevant results are returned.
76
+ """
77
+
78
+ rewrite_query: Annotated[bool, PropertyInfo(alias="rewriteQuery")]
79
+ """If true, rewrites the query to make it easier to find documents.
80
+
81
+ This increases the latency by about 400ms
82
+ """
83
+
84
+
85
+ class FiltersOr(TypedDict, total=False):
86
+ or_: Required[Annotated[Iterable[object], PropertyInfo(alias="OR")]]
87
+
88
+
89
+ class FiltersAnd(TypedDict, total=False):
90
+ and_: Required[Annotated[Iterable[object], PropertyInfo(alias="AND")]]
91
+
92
+
93
+ Filters: TypeAlias = Union[FiltersOr, FiltersAnd]
@@ -0,0 +1,60 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Dict, List, Optional
4
+
5
+ from pydantic import Field as FieldInfo
6
+
7
+ from .._models import BaseModel
8
+
9
+ __all__ = ["SearchExecuteResponse", "Result", "ResultChunk"]
10
+
11
+
12
+ class ResultChunk(BaseModel):
13
+ content: str
14
+ """Content of the matching chunk"""
15
+
16
+ is_relevant: bool = FieldInfo(alias="isRelevant")
17
+ """Whether this chunk is relevant to the query"""
18
+
19
+ score: float
20
+ """Similarity score for this chunk"""
21
+
22
+
23
+ class Result(BaseModel):
24
+ chunks: List[ResultChunk]
25
+ """Matching content chunks from the document"""
26
+
27
+ created_at: str = FieldInfo(alias="createdAt")
28
+ """Document creation date"""
29
+
30
+ document_id: str = FieldInfo(alias="documentId")
31
+ """ID of the matching document"""
32
+
33
+ metadata: Optional[Dict[str, object]] = None
34
+ """Document metadata"""
35
+
36
+ score: float
37
+ """Relevance score of the match"""
38
+
39
+ title: Optional[str] = None
40
+ """Document title"""
41
+
42
+ type: Optional[str] = None
43
+ """Document type"""
44
+
45
+ updated_at: str = FieldInfo(alias="updatedAt")
46
+ """Document last update date"""
47
+
48
+ content: Optional[str] = None
49
+ """Full document content (only included when includeFullDocs=true)"""
50
+
51
+ summary: Optional[str] = None
52
+ """Document summary"""
53
+
54
+
55
+ class SearchExecuteResponse(BaseModel):
56
+ results: List[Result]
57
+
58
+ timing: float
59
+
60
+ total: float
@@ -0,0 +1,75 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Union, Iterable
6
+ from typing_extensions import Required, Annotated, TypeAlias, TypedDict
7
+
8
+ from .._utils import PropertyInfo
9
+
10
+ __all__ = ["SearchMemoriesParams", "Filters", "FiltersOr", "FiltersAnd", "Include"]
11
+
12
+
13
+ class SearchMemoriesParams(TypedDict, total=False):
14
+ q: Required[str]
15
+ """Search query string"""
16
+
17
+ container_tag: Annotated[str, PropertyInfo(alias="containerTag")]
18
+ """Optional tag this search should be containerized by.
19
+
20
+ This can be an ID for your user, a project ID, or any other identifier you wish
21
+ to use to filter memories.
22
+ """
23
+
24
+ filters: Filters
25
+ """Optional filters to apply to the search. Can be a JSON string or Query object."""
26
+
27
+ include: Include
28
+
29
+ limit: int
30
+ """Maximum number of results to return"""
31
+
32
+ rerank: bool
33
+ """If true, rerank the results based on the query.
34
+
35
+ This is helpful if you want to ensure the most relevant results are returned.
36
+ """
37
+
38
+ rewrite_query: Annotated[bool, PropertyInfo(alias="rewriteQuery")]
39
+ """If true, rewrites the query to make it easier to find documents.
40
+
41
+ This increases the latency by about 400ms
42
+ """
43
+
44
+ threshold: float
45
+ """Threshold / sensitivity for memories selection.
46
+
47
+ 0 is least sensitive (returns most memories, more results), 1 is most sensitive
48
+ (returns lesser memories, accurate results)
49
+ """
50
+
51
+
52
+ class FiltersOr(TypedDict, total=False):
53
+ or_: Required[Annotated[Iterable[object], PropertyInfo(alias="OR")]]
54
+
55
+
56
+ class FiltersAnd(TypedDict, total=False):
57
+ and_: Required[Annotated[Iterable[object], PropertyInfo(alias="AND")]]
58
+
59
+
60
+ Filters: TypeAlias = Union[FiltersOr, FiltersAnd]
61
+
62
+
63
+ class Include(TypedDict, total=False):
64
+ documents: bool
65
+
66
+ forgotten_memories: Annotated[bool, PropertyInfo(alias="forgottenMemories")]
67
+ """If true, include forgotten memories in search results.
68
+
69
+ Forgotten memories are memories that have been explicitly forgotten or have
70
+ passed their expiration date.
71
+ """
72
+
73
+ related_memories: Annotated[bool, PropertyInfo(alias="relatedMemories")]
74
+
75
+ summaries: bool