supermemory 3.0.0a25__tar.gz → 3.0.0a26__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.

Potentially problematic release.


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

Files changed (106) hide show
  1. supermemory-3.0.0a26/.release-please-manifest.json +3 -0
  2. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/CHANGELOG.md +10 -0
  3. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/PKG-INFO +37 -4
  4. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/README.md +36 -3
  5. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/api.md +5 -1
  6. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/pyproject.toml +1 -1
  7. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_files.py +1 -1
  8. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_version.py +1 -1
  9. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/resources/memories.py +107 -4
  10. supermemory-3.0.0a26/src/supermemory/resources/search.py +664 -0
  11. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/__init__.py +6 -0
  12. supermemory-3.0.0a26/src/supermemory/types/memory_upload_file_params.py +16 -0
  13. supermemory-3.0.0a26/src/supermemory/types/memory_upload_file_response.py +11 -0
  14. supermemory-3.0.0a26/src/supermemory/types/search_documents_params.py +93 -0
  15. supermemory-3.0.0a26/src/supermemory/types/search_documents_response.py +61 -0
  16. supermemory-3.0.0a26/src/supermemory/types/search_memories_params.py +66 -0
  17. supermemory-3.0.0a26/src/supermemory/types/search_memories_response.py +121 -0
  18. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/api_resources/test_memories.py +87 -0
  19. supermemory-3.0.0a26/tests/api_resources/test_search.py +446 -0
  20. supermemory-3.0.0a25/.release-please-manifest.json +0 -3
  21. supermemory-3.0.0a25/src/supermemory/resources/search.py +0 -300
  22. supermemory-3.0.0a25/tests/api_resources/test_search.py +0 -164
  23. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/.gitignore +0 -0
  24. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/CONTRIBUTING.md +0 -0
  25. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/LICENSE +0 -0
  26. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/SECURITY.md +0 -0
  27. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/bin/check-release-environment +0 -0
  28. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/bin/publish-pypi +0 -0
  29. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/examples/.keep +0 -0
  30. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/mypy.ini +0 -0
  31. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/noxfile.py +0 -0
  32. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/release-please-config.json +0 -0
  33. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/requirements-dev.lock +0 -0
  34. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/requirements.lock +0 -0
  35. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/__init__.py +0 -0
  36. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_base_client.py +0 -0
  37. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_client.py +0 -0
  38. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_compat.py +0 -0
  39. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_constants.py +0 -0
  40. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_exceptions.py +0 -0
  41. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_models.py +0 -0
  42. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_qs.py +0 -0
  43. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_resource.py +0 -0
  44. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_response.py +0 -0
  45. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_streaming.py +0 -0
  46. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_types.py +0 -0
  47. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_utils/__init__.py +0 -0
  48. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_utils/_logs.py +0 -0
  49. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_utils/_proxy.py +0 -0
  50. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_utils/_reflection.py +0 -0
  51. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_utils/_resources_proxy.py +0 -0
  52. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_utils/_streams.py +0 -0
  53. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_utils/_sync.py +0 -0
  54. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_utils/_transform.py +0 -0
  55. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_utils/_typing.py +0 -0
  56. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/_utils/_utils.py +0 -0
  57. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/lib/.keep +0 -0
  58. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/py.typed +0 -0
  59. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/resources/__init__.py +0 -0
  60. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/resources/connections.py +0 -0
  61. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/resources/settings.py +0 -0
  62. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/connection_create_params.py +0 -0
  63. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/connection_create_response.py +0 -0
  64. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/connection_delete_by_id_response.py +0 -0
  65. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/connection_delete_by_provider_params.py +0 -0
  66. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/connection_delete_by_provider_response.py +0 -0
  67. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/connection_get_by_id_response.py +0 -0
  68. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/connection_get_by_tags_params.py +0 -0
  69. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/connection_get_by_tags_response.py +0 -0
  70. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/connection_import_params.py +0 -0
  71. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/connection_list_documents_params.py +0 -0
  72. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/connection_list_documents_response.py +0 -0
  73. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/connection_list_params.py +0 -0
  74. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/connection_list_response.py +0 -0
  75. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/memory_add_params.py +0 -0
  76. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/memory_add_response.py +0 -0
  77. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/memory_get_response.py +0 -0
  78. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/memory_list_params.py +0 -0
  79. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/memory_list_response.py +0 -0
  80. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/memory_update_params.py +0 -0
  81. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/memory_update_response.py +0 -0
  82. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/search_execute_params.py +0 -0
  83. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/search_execute_response.py +0 -0
  84. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/setting_get_response.py +0 -0
  85. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/setting_update_params.py +0 -0
  86. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory/types/setting_update_response.py +0 -0
  87. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/src/supermemory_new/lib/.keep +0 -0
  88. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/__init__.py +0 -0
  89. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/api_resources/__init__.py +0 -0
  90. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/api_resources/test_connections.py +0 -0
  91. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/api_resources/test_settings.py +0 -0
  92. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/conftest.py +0 -0
  93. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/sample_file.txt +0 -0
  94. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/test_client.py +0 -0
  95. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/test_deepcopy.py +0 -0
  96. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/test_extract_files.py +0 -0
  97. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/test_files.py +0 -0
  98. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/test_models.py +0 -0
  99. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/test_qs.py +0 -0
  100. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/test_required_args.py +0 -0
  101. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/test_response.py +0 -0
  102. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/test_streaming.py +0 -0
  103. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/test_transform.py +0 -0
  104. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/test_utils/test_proxy.py +0 -0
  105. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/test_utils/test_typing.py +0 -0
  106. {supermemory-3.0.0a25 → supermemory-3.0.0a26}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "3.0.0-alpha.26"
3
+ }
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.0-alpha.26 (2025-08-15)
4
+
5
+ Full Changelog: [v3.0.0-alpha.25...v3.0.0-alpha.26](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.25...v3.0.0-alpha.26)
6
+
7
+ ### Features
8
+
9
+ * **api:** manual updates ([c2623b2](https://github.com/supermemoryai/python-sdk/commit/c2623b2b645eefd7e2cbb5027eb5a46cee7b62eb))
10
+ * **api:** manual updates ([9e373ef](https://github.com/supermemoryai/python-sdk/commit/9e373ef0b585eb15cb04b95a1bab46c8c102970c))
11
+ * **api:** manual updates ([fa75aff](https://github.com/supermemoryai/python-sdk/commit/fa75affffb701259be14445da95c77a1cdde512b))
12
+
3
13
  ## 3.0.0-alpha.25 (2025-08-15)
4
14
 
5
15
  Full Changelog: [v3.0.0-alpha.24...v3.0.0-alpha.25](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.24...v3.0.0-alpha.25)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: supermemory
3
- Version: 3.0.0a25
3
+ Version: 3.0.0a26
4
4
  Summary: The official Python library for the supermemory API
5
5
  Project-URL: Homepage, https://github.com/supermemoryai/python-sdk
6
6
  Project-URL: Repository, https://github.com/supermemoryai/python-sdk
@@ -67,7 +67,7 @@ client = Supermemory(
67
67
  api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
68
68
  )
69
69
 
70
- response = client.search.execute(
70
+ response = client.search.documents(
71
71
  q="documents related to python",
72
72
  )
73
73
  print(response.results)
@@ -93,7 +93,7 @@ client = AsyncSupermemory(
93
93
 
94
94
 
95
95
  async def main() -> None:
96
- response = await client.search.execute(
96
+ response = await client.search.documents(
97
97
  q="documents related to python",
98
98
  )
99
99
  print(response.results)
@@ -128,7 +128,7 @@ async def main() -> None:
128
128
  api_key="My API Key",
129
129
  http_client=DefaultAioHttpClient(),
130
130
  ) as client:
131
- response = await client.search.execute(
131
+ response = await client.search.documents(
132
132
  q="documents related to python",
133
133
  )
134
134
  print(response.results)
@@ -146,6 +146,39 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
146
146
 
147
147
  Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
148
148
 
149
+ ## Nested params
150
+
151
+ Nested parameters are dictionaries, typed using `TypedDict`, for example:
152
+
153
+ ```python
154
+ from supermemory import Supermemory
155
+
156
+ client = Supermemory()
157
+
158
+ response = client.search.memories(
159
+ q="machine learning concepts",
160
+ include={},
161
+ )
162
+ print(response.include)
163
+ ```
164
+
165
+ ## File uploads
166
+
167
+ Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
168
+
169
+ ```python
170
+ from pathlib import Path
171
+ from supermemory import Supermemory
172
+
173
+ client = Supermemory()
174
+
175
+ client.memories.upload_file(
176
+ file=Path("/path/to/file"),
177
+ )
178
+ ```
179
+
180
+ The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
181
+
149
182
  ## Handling errors
150
183
 
151
184
  When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `supermemory.APIConnectionError` is raised.
@@ -32,7 +32,7 @@ client = Supermemory(
32
32
  api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
33
33
  )
34
34
 
35
- response = client.search.execute(
35
+ response = client.search.documents(
36
36
  q="documents related to python",
37
37
  )
38
38
  print(response.results)
@@ -58,7 +58,7 @@ client = AsyncSupermemory(
58
58
 
59
59
 
60
60
  async def main() -> None:
61
- response = await client.search.execute(
61
+ response = await client.search.documents(
62
62
  q="documents related to python",
63
63
  )
64
64
  print(response.results)
@@ -93,7 +93,7 @@ async def main() -> None:
93
93
  api_key="My API Key",
94
94
  http_client=DefaultAioHttpClient(),
95
95
  ) as client:
96
- response = await client.search.execute(
96
+ response = await client.search.documents(
97
97
  q="documents related to python",
98
98
  )
99
99
  print(response.results)
@@ -111,6 +111,39 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
111
111
 
112
112
  Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
113
113
 
114
+ ## Nested params
115
+
116
+ Nested parameters are dictionaries, typed using `TypedDict`, for example:
117
+
118
+ ```python
119
+ from supermemory import Supermemory
120
+
121
+ client = Supermemory()
122
+
123
+ response = client.search.memories(
124
+ q="machine learning concepts",
125
+ include={},
126
+ )
127
+ print(response.include)
128
+ ```
129
+
130
+ ## File uploads
131
+
132
+ Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
133
+
134
+ ```python
135
+ from pathlib import Path
136
+ from supermemory import Supermemory
137
+
138
+ client = Supermemory()
139
+
140
+ client.memories.upload_file(
141
+ file=Path("/path/to/file"),
142
+ )
143
+ ```
144
+
145
+ The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
146
+
114
147
  ## Handling errors
115
148
 
116
149
  When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `supermemory.APIConnectionError` is raised.
@@ -8,6 +8,7 @@ from supermemory.types import (
8
8
  MemoryListResponse,
9
9
  MemoryAddResponse,
10
10
  MemoryGetResponse,
11
+ MemoryUploadFileResponse,
11
12
  )
12
13
  ```
13
14
 
@@ -18,18 +19,21 @@ Methods:
18
19
  - <code title="delete /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">delete</a>(id) -> None</code>
19
20
  - <code title="post /v3/memories">client.memories.<a href="./src/supermemory/resources/memories.py">add</a>(\*\*<a href="src/supermemory/types/memory_add_params.py">params</a>) -> <a href="./src/supermemory/types/memory_add_response.py">MemoryAddResponse</a></code>
20
21
  - <code title="get /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">get</a>(id) -> <a href="./src/supermemory/types/memory_get_response.py">MemoryGetResponse</a></code>
22
+ - <code title="post /v3/memories/file">client.memories.<a href="./src/supermemory/resources/memories.py">upload_file</a>(\*\*<a href="src/supermemory/types/memory_upload_file_params.py">params</a>) -> <a href="./src/supermemory/types/memory_upload_file_response.py">MemoryUploadFileResponse</a></code>
21
23
 
22
24
  # Search
23
25
 
24
26
  Types:
25
27
 
26
28
  ```python
27
- from supermemory.types import SearchExecuteResponse
29
+ from supermemory.types import SearchDocumentsResponse, SearchExecuteResponse, SearchMemoriesResponse
28
30
  ```
29
31
 
30
32
  Methods:
31
33
 
34
+ - <code title="post /v3/search">client.search.<a href="./src/supermemory/resources/search.py">documents</a>(\*\*<a href="src/supermemory/types/search_documents_params.py">params</a>) -> <a href="./src/supermemory/types/search_documents_response.py">SearchDocumentsResponse</a></code>
32
35
  - <code title="post /v3/search">client.search.<a href="./src/supermemory/resources/search.py">execute</a>(\*\*<a href="src/supermemory/types/search_execute_params.py">params</a>) -> <a href="./src/supermemory/types/search_execute_response.py">SearchExecuteResponse</a></code>
36
+ - <code title="post /v4/search">client.search.<a href="./src/supermemory/resources/search.py">memories</a>(\*\*<a href="src/supermemory/types/search_memories_params.py">params</a>) -> <a href="./src/supermemory/types/search_memories_response.py">SearchMemoriesResponse</a></code>
33
37
 
34
38
  # Settings
35
39
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "supermemory"
3
- version = "3.0.0-alpha.25"
3
+ version = "3.0.0-alpha.26"
4
4
  description = "The official Python library for the supermemory API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None:
34
34
  if not is_file_content(obj):
35
35
  prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`"
36
36
  raise RuntimeError(
37
- f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead."
37
+ f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/supermemoryai/python-sdk/tree/main#file-uploads"
38
38
  ) from None
39
39
 
40
40
 
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "supermemory"
4
- __version__ = "3.0.0-alpha.25" # x-release-please-version
4
+ __version__ = "3.0.0-alpha.26" # x-release-please-version
@@ -2,14 +2,14 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, List, Union
5
+ from typing import Dict, List, Union, Mapping, cast
6
6
  from typing_extensions import Literal
7
7
 
8
8
  import httpx
9
9
 
10
- from ..types import memory_add_params, memory_list_params, memory_update_params
11
- from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
12
- from .._utils import maybe_transform, async_maybe_transform
10
+ from ..types import memory_add_params, memory_list_params, memory_update_params, memory_upload_file_params
11
+ from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes
12
+ from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
13
13
  from .._compat import cached_property
14
14
  from .._resource import SyncAPIResource, AsyncAPIResource
15
15
  from .._response import (
@@ -23,6 +23,7 @@ from ..types.memory_add_response import MemoryAddResponse
23
23
  from ..types.memory_get_response import MemoryGetResponse
24
24
  from ..types.memory_list_response import MemoryListResponse
25
25
  from ..types.memory_update_response import MemoryUpdateResponse
26
+ from ..types.memory_upload_file_response import MemoryUploadFileResponse
26
27
 
27
28
  __all__ = ["MemoriesResource", "AsyncMemoriesResource"]
28
29
 
@@ -305,6 +306,51 @@ class MemoriesResource(SyncAPIResource):
305
306
  cast_to=MemoryGetResponse,
306
307
  )
307
308
 
309
+ def upload_file(
310
+ self,
311
+ *,
312
+ file: FileTypes,
313
+ container_tags: str | NotGiven = NOT_GIVEN,
314
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
315
+ # The extra values given here take precedence over values defined on the client or passed to this method.
316
+ extra_headers: Headers | None = None,
317
+ extra_query: Query | None = None,
318
+ extra_body: Body | None = None,
319
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
320
+ ) -> MemoryUploadFileResponse:
321
+ """
322
+ Upload a file to be processed
323
+
324
+ Args:
325
+ extra_headers: Send extra headers
326
+
327
+ extra_query: Add additional query parameters to the request
328
+
329
+ extra_body: Add additional JSON properties to the request
330
+
331
+ timeout: Override the client-level default timeout for this request, in seconds
332
+ """
333
+ body = deepcopy_minimal(
334
+ {
335
+ "file": file,
336
+ "container_tags": container_tags,
337
+ }
338
+ )
339
+ files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
340
+ # It should be noted that the actual Content-Type header that will be
341
+ # sent to the server will contain a `boundary` parameter, e.g.
342
+ # multipart/form-data; boundary=---abc--
343
+ extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
344
+ return self._post(
345
+ "/v3/memories/file",
346
+ body=maybe_transform(body, memory_upload_file_params.MemoryUploadFileParams),
347
+ files=files,
348
+ options=make_request_options(
349
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
350
+ ),
351
+ cast_to=MemoryUploadFileResponse,
352
+ )
353
+
308
354
 
309
355
  class AsyncMemoriesResource(AsyncAPIResource):
310
356
  @cached_property
@@ -584,6 +630,51 @@ class AsyncMemoriesResource(AsyncAPIResource):
584
630
  cast_to=MemoryGetResponse,
585
631
  )
586
632
 
633
+ async def upload_file(
634
+ self,
635
+ *,
636
+ file: FileTypes,
637
+ container_tags: str | NotGiven = NOT_GIVEN,
638
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
639
+ # The extra values given here take precedence over values defined on the client or passed to this method.
640
+ extra_headers: Headers | None = None,
641
+ extra_query: Query | None = None,
642
+ extra_body: Body | None = None,
643
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
644
+ ) -> MemoryUploadFileResponse:
645
+ """
646
+ Upload a file to be processed
647
+
648
+ Args:
649
+ extra_headers: Send extra headers
650
+
651
+ extra_query: Add additional query parameters to the request
652
+
653
+ extra_body: Add additional JSON properties to the request
654
+
655
+ timeout: Override the client-level default timeout for this request, in seconds
656
+ """
657
+ body = deepcopy_minimal(
658
+ {
659
+ "file": file,
660
+ "container_tags": container_tags,
661
+ }
662
+ )
663
+ files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
664
+ # It should be noted that the actual Content-Type header that will be
665
+ # sent to the server will contain a `boundary` parameter, e.g.
666
+ # multipart/form-data; boundary=---abc--
667
+ extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
668
+ return await self._post(
669
+ "/v3/memories/file",
670
+ body=await async_maybe_transform(body, memory_upload_file_params.MemoryUploadFileParams),
671
+ files=files,
672
+ options=make_request_options(
673
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
674
+ ),
675
+ cast_to=MemoryUploadFileResponse,
676
+ )
677
+
587
678
 
588
679
  class MemoriesResourceWithRawResponse:
589
680
  def __init__(self, memories: MemoriesResource) -> None:
@@ -604,6 +695,9 @@ class MemoriesResourceWithRawResponse:
604
695
  self.get = to_raw_response_wrapper(
605
696
  memories.get,
606
697
  )
698
+ self.upload_file = to_raw_response_wrapper(
699
+ memories.upload_file,
700
+ )
607
701
 
608
702
 
609
703
  class AsyncMemoriesResourceWithRawResponse:
@@ -625,6 +719,9 @@ class AsyncMemoriesResourceWithRawResponse:
625
719
  self.get = async_to_raw_response_wrapper(
626
720
  memories.get,
627
721
  )
722
+ self.upload_file = async_to_raw_response_wrapper(
723
+ memories.upload_file,
724
+ )
628
725
 
629
726
 
630
727
  class MemoriesResourceWithStreamingResponse:
@@ -646,6 +743,9 @@ class MemoriesResourceWithStreamingResponse:
646
743
  self.get = to_streamed_response_wrapper(
647
744
  memories.get,
648
745
  )
746
+ self.upload_file = to_streamed_response_wrapper(
747
+ memories.upload_file,
748
+ )
649
749
 
650
750
 
651
751
  class AsyncMemoriesResourceWithStreamingResponse:
@@ -667,3 +767,6 @@ class AsyncMemoriesResourceWithStreamingResponse:
667
767
  self.get = async_to_streamed_response_wrapper(
668
768
  memories.get,
669
769
  )
770
+ self.upload_file = async_to_streamed_response_wrapper(
771
+ memories.upload_file,
772
+ )