supermemory 0.1.0a1__py3-none-any.whl → 3.0.0a2__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.
- supermemory/__init__.py +7 -1
- supermemory/_base_client.py +44 -2
- supermemory/_client.py +21 -29
- supermemory/_models.py +2 -0
- supermemory/_types.py +2 -0
- supermemory/_utils/_proxy.py +4 -1
- supermemory/_utils/_resources_proxy.py +24 -0
- supermemory/_version.py +1 -1
- supermemory/resources/__init__.py +26 -40
- supermemory/resources/{connection.py → connections.py} +86 -80
- supermemory/resources/{memory.py → memories.py} +224 -176
- supermemory/resources/settings.py +102 -19
- supermemory/types/__init__.py +6 -7
- supermemory/types/connection_create_params.py +7 -2
- supermemory/types/connection_create_response.py +7 -1
- supermemory/types/connection_get_response.py +25 -0
- supermemory/types/memory_add_params.py +46 -0
- supermemory/types/{memory_create_response.py → memory_add_response.py} +2 -2
- supermemory/types/memory_get_response.py +79 -9
- supermemory/types/memory_update_params.py +46 -0
- supermemory/types/{memory_delete_response.py → memory_update_response.py} +5 -3
- supermemory/types/setting_get_response.py +45 -0
- supermemory/types/setting_update_params.py +28 -12
- supermemory/types/setting_update_response.py +31 -13
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a2.dist-info}/METADATA +52 -15
- supermemory-3.0.0a2.dist-info/RECORD +46 -0
- supermemory/resources/search.py +0 -254
- supermemory/types/memory_create_params.py +0 -23
- supermemory/types/memory_list_params.py +0 -24
- supermemory/types/memory_list_response.py +0 -59
- supermemory/types/search_execute_params.py +0 -56
- supermemory/types/search_execute_response.py +0 -52
- supermemory-0.1.0a1.dist-info/RECORD +0 -47
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a2.dist-info}/WHEEL +0 -0
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a2.dist-info}/licenses/LICENSE +0 -0
@@ -1,35 +1,53 @@
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
2
|
|
3
|
-
from typing import List, Optional
|
3
|
+
from typing import Dict, List, Union, Optional
|
4
4
|
|
5
5
|
from pydantic import Field as FieldInfo
|
6
6
|
|
7
7
|
from .._models import BaseModel
|
8
8
|
|
9
|
-
__all__ = ["SettingUpdateResponse", "
|
9
|
+
__all__ = ["SettingUpdateResponse", "Updated"]
|
10
10
|
|
11
11
|
|
12
|
-
class
|
13
|
-
|
12
|
+
class Updated(BaseModel):
|
13
|
+
exclude_items: Union[str, float, bool, Dict[str, object], List[object], None] = FieldInfo(
|
14
|
+
alias="excludeItems", default=None
|
15
|
+
)
|
14
16
|
|
15
|
-
|
17
|
+
filter_prompt: Optional[str] = FieldInfo(alias="filterPrompt", default=None)
|
16
18
|
|
19
|
+
filter_tags: Union[str, float, bool, Dict[str, object], List[object], None] = FieldInfo(
|
20
|
+
alias="filterTags", default=None
|
21
|
+
)
|
17
22
|
|
18
|
-
|
19
|
-
categories: Optional[List[str]] = None
|
23
|
+
google_drive_client_id: Optional[str] = FieldInfo(alias="googleDriveClientId", default=None)
|
20
24
|
|
21
|
-
|
25
|
+
google_drive_client_secret: Optional[str] = FieldInfo(alias="googleDriveClientSecret", default=None)
|
22
26
|
|
23
|
-
|
27
|
+
google_drive_custom_key_enabled: Optional[bool] = FieldInfo(alias="googleDriveCustomKeyEnabled", default=None)
|
28
|
+
|
29
|
+
include_items: Union[str, float, bool, Dict[str, object], List[object], None] = FieldInfo(
|
30
|
+
alias="includeItems", default=None
|
31
|
+
)
|
32
|
+
|
33
|
+
notion_client_id: Optional[str] = FieldInfo(alias="notionClientId", default=None)
|
24
34
|
|
25
|
-
|
35
|
+
notion_client_secret: Optional[str] = FieldInfo(alias="notionClientSecret", default=None)
|
26
36
|
|
27
|
-
|
37
|
+
notion_custom_key_enabled: Optional[bool] = FieldInfo(alias="notionCustomKeyEnabled", default=None)
|
38
|
+
|
39
|
+
onedrive_client_id: Optional[str] = FieldInfo(alias="onedriveClientId", default=None)
|
40
|
+
|
41
|
+
onedrive_client_secret: Optional[str] = FieldInfo(alias="onedriveClientSecret", default=None)
|
42
|
+
|
43
|
+
onedrive_custom_key_enabled: Optional[bool] = FieldInfo(alias="onedriveCustomKeyEnabled", default=None)
|
28
44
|
|
29
45
|
should_llm_filter: Optional[bool] = FieldInfo(alias="shouldLLMFilter", default=None)
|
30
46
|
|
31
47
|
|
32
48
|
class SettingUpdateResponse(BaseModel):
|
33
|
-
|
49
|
+
org_id: str = FieldInfo(alias="orgId")
|
50
|
+
|
51
|
+
org_slug: str = FieldInfo(alias="orgSlug")
|
34
52
|
|
35
|
-
|
53
|
+
updated: Updated
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: supermemory
|
3
|
-
Version: 0.
|
3
|
+
Version: 3.0.0a2
|
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
|
@@ -27,11 +27,14 @@ Requires-Dist: httpx<1,>=0.23.0
|
|
27
27
|
Requires-Dist: pydantic<3,>=1.9.0
|
28
28
|
Requires-Dist: sniffio
|
29
29
|
Requires-Dist: typing-extensions<5,>=4.10
|
30
|
+
Provides-Extra: aiohttp
|
31
|
+
Requires-Dist: aiohttp; extra == 'aiohttp'
|
32
|
+
Requires-Dist: httpx-aiohttp>=0.1.6; extra == 'aiohttp'
|
30
33
|
Description-Content-Type: text/markdown
|
31
34
|
|
32
35
|
# Supermemory Python API library
|
33
36
|
|
34
|
-
[](https://pypi.org/project/supermemory/)
|
37
|
+
[>)](https://pypi.org/project/supermemory/)
|
35
38
|
|
36
39
|
The Supermemory Python library provides convenient access to the Supermemory REST API from any Python 3.8+
|
37
40
|
application. The library includes type definitions for all request params and response fields,
|
@@ -62,10 +65,10 @@ client = Supermemory(
|
|
62
65
|
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
|
63
66
|
)
|
64
67
|
|
65
|
-
response = client.
|
66
|
-
|
68
|
+
response = client.memories.add(
|
69
|
+
content="This is a detailed article about machine learning concepts...",
|
67
70
|
)
|
68
|
-
print(response.
|
71
|
+
print(response.id)
|
69
72
|
```
|
70
73
|
|
71
74
|
While you can provide an `api_key` keyword argument,
|
@@ -88,10 +91,10 @@ client = AsyncSupermemory(
|
|
88
91
|
|
89
92
|
|
90
93
|
async def main() -> None:
|
91
|
-
response = await client.
|
92
|
-
|
94
|
+
response = await client.memories.add(
|
95
|
+
content="This is a detailed article about machine learning concepts...",
|
93
96
|
)
|
94
|
-
print(response.
|
97
|
+
print(response.id)
|
95
98
|
|
96
99
|
|
97
100
|
asyncio.run(main())
|
@@ -99,6 +102,40 @@ asyncio.run(main())
|
|
99
102
|
|
100
103
|
Functionality between the synchronous and asynchronous clients is otherwise identical.
|
101
104
|
|
105
|
+
### With aiohttp
|
106
|
+
|
107
|
+
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
|
108
|
+
|
109
|
+
You can enable this by installing `aiohttp`:
|
110
|
+
|
111
|
+
```sh
|
112
|
+
# install from PyPI
|
113
|
+
pip install --pre supermemory[aiohttp]
|
114
|
+
```
|
115
|
+
|
116
|
+
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
117
|
+
|
118
|
+
```python
|
119
|
+
import os
|
120
|
+
import asyncio
|
121
|
+
from supermemory import DefaultAioHttpClient
|
122
|
+
from supermemory import AsyncSupermemory
|
123
|
+
|
124
|
+
|
125
|
+
async def main() -> None:
|
126
|
+
async with AsyncSupermemory(
|
127
|
+
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
|
128
|
+
http_client=DefaultAioHttpClient(),
|
129
|
+
) as client:
|
130
|
+
response = await client.memories.add(
|
131
|
+
content="This is a detailed article about machine learning concepts...",
|
132
|
+
)
|
133
|
+
print(response.id)
|
134
|
+
|
135
|
+
|
136
|
+
asyncio.run(main())
|
137
|
+
```
|
138
|
+
|
102
139
|
## Using types
|
103
140
|
|
104
141
|
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
|
@@ -124,7 +161,7 @@ from supermemory import Supermemory
|
|
124
161
|
client = Supermemory()
|
125
162
|
|
126
163
|
try:
|
127
|
-
client.
|
164
|
+
client.memories.add(
|
128
165
|
content="This is a detailed article about machine learning concepts...",
|
129
166
|
)
|
130
167
|
except supermemory.APIConnectionError as e:
|
@@ -169,7 +206,7 @@ client = Supermemory(
|
|
169
206
|
)
|
170
207
|
|
171
208
|
# Or, configure per-request:
|
172
|
-
client.with_options(max_retries=5).
|
209
|
+
client.with_options(max_retries=5).memories.add(
|
173
210
|
content="This is a detailed article about machine learning concepts...",
|
174
211
|
)
|
175
212
|
```
|
@@ -177,7 +214,7 @@ client.with_options(max_retries=5).memory.create(
|
|
177
214
|
### Timeouts
|
178
215
|
|
179
216
|
By default requests time out after 1 minute. You can configure this with a `timeout` option,
|
180
|
-
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
|
217
|
+
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
181
218
|
|
182
219
|
```python
|
183
220
|
from supermemory import Supermemory
|
@@ -194,7 +231,7 @@ client = Supermemory(
|
|
194
231
|
)
|
195
232
|
|
196
233
|
# Override per-request:
|
197
|
-
client.with_options(timeout=5.0).
|
234
|
+
client.with_options(timeout=5.0).memories.add(
|
198
235
|
content="This is a detailed article about machine learning concepts...",
|
199
236
|
)
|
200
237
|
```
|
@@ -237,12 +274,12 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
237
274
|
from supermemory import Supermemory
|
238
275
|
|
239
276
|
client = Supermemory()
|
240
|
-
response = client.
|
277
|
+
response = client.memories.with_raw_response.add(
|
241
278
|
content="This is a detailed article about machine learning concepts...",
|
242
279
|
)
|
243
280
|
print(response.headers.get('X-My-Header'))
|
244
281
|
|
245
|
-
memory = response.parse() # get the object that `
|
282
|
+
memory = response.parse() # get the object that `memories.add()` would have returned
|
246
283
|
print(memory.id)
|
247
284
|
```
|
248
285
|
|
@@ -257,7 +294,7 @@ The above interface eagerly reads the full response body when you make the reque
|
|
257
294
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
258
295
|
|
259
296
|
```python
|
260
|
-
with client.
|
297
|
+
with client.memories.with_streaming_response.add(
|
261
298
|
content="This is a detailed article about machine learning concepts...",
|
262
299
|
) as response:
|
263
300
|
print(response.headers.get("X-My-Header"))
|
@@ -0,0 +1,46 @@
|
|
1
|
+
supermemory/__init__.py,sha256=PDWpv0_OWO8lBFh21lQl5k0zrlBzcGf643CKXRoQgzM,2664
|
2
|
+
supermemory/_base_client.py,sha256=r19iD2PFXhH75y9v6TNYPwd5NdYjZj3shFhuUnHZqlU,66720
|
3
|
+
supermemory/_client.py,sha256=IMo1vJ8G5Ha05IPVyuUEFXrCOY83gKJGB6sdyAb-rUk,16388
|
4
|
+
supermemory/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
|
5
|
+
supermemory/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
|
6
|
+
supermemory/_exceptions.py,sha256=5nnX7W8L_eA6LkX3SBl7csJy5d9QEcDqRVuwDq8wVh8,3230
|
7
|
+
supermemory/_files.py,sha256=mf4dOgL4b0ryyZlbqLhggD3GVgDf6XxdGFAgce01ugE,3549
|
8
|
+
supermemory/_models.py,sha256=G1vczEodX0vUySeVKbF-mbzlaObNL1oVAYH4c65agRk,29131
|
9
|
+
supermemory/_qs.py,sha256=AOkSz4rHtK4YI3ZU_kzea-zpwBUgEY8WniGmTPyEimc,4846
|
10
|
+
supermemory/_resource.py,sha256=_wuaB1exMy-l-qqdJJdTv15hH5qBSN2Rj9CFwjXTZJU,1130
|
11
|
+
supermemory/_response.py,sha256=Yh869-U8INkojKZHFsNw69z5Y2BrK2isgRJ8mifEURM,28848
|
12
|
+
supermemory/_streaming.py,sha256=MGbosxSTqq0_JG52hvH2Z-Mr_Y95ws5UdFw77_iYukc,10120
|
13
|
+
supermemory/_types.py,sha256=ohS8PFDHBFM-0ua6YsUlS55BPHft3xY6DhiIKaYrlN0,6202
|
14
|
+
supermemory/_version.py,sha256=DjAIaWTz347eKyBKuH3jzyz6mfi63Q9mefpND-W6XbY,171
|
15
|
+
supermemory/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
+
supermemory/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
|
17
|
+
supermemory/_utils/_logs.py,sha256=iceljYaEUb4Q4q1SgbSzwSrlJA64ISbaccczzZ8Z9Vg,789
|
18
|
+
supermemory/_utils/_proxy.py,sha256=aglnj2yBTDyGX9Akk2crZHrl10oqRmceUy2Zp008XEs,1975
|
19
|
+
supermemory/_utils/_reflection.py,sha256=ZmGkIgT_PuwedyNBrrKGbxoWtkpytJNU1uU4QHnmEMU,1364
|
20
|
+
supermemory/_utils/_resources_proxy.py,sha256=9MqlmhIEoyeVraNz90vnq1pS6EOxSqvYVlVK-CvLMmQ,614
|
21
|
+
supermemory/_utils/_streams.py,sha256=SMC90diFFecpEg_zgDRVbdR3hSEIgVVij4taD-noMLM,289
|
22
|
+
supermemory/_utils/_sync.py,sha256=TpGLrrhRNWTJtODNE6Fup3_k7zrWm1j2RlirzBwre-0,2862
|
23
|
+
supermemory/_utils/_transform.py,sha256=n7kskEWz6o__aoNvhFoGVyDoalNe6mJwp-g7BWkdj88,15617
|
24
|
+
supermemory/_utils/_typing.py,sha256=D0DbbNu8GnYQTSICnTSHDGsYXj8TcAKyhejb0XcnjtY,4602
|
25
|
+
supermemory/_utils/_utils.py,sha256=ts4CiiuNpFiGB6YMdkQRh2SZvYvsl7mAF-JWHCcLDf4,12312
|
26
|
+
supermemory/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
27
|
+
supermemory/resources/__init__.py,sha256=iYwzfeiqmu2Lorat88bYVkp4CobBt60Gq_6GcygldLE,1569
|
28
|
+
supermemory/resources/connections.py,sha256=PERpnnUiu2hQjDvX_toy1thiipXu25RQaahTIeUwb3w,10656
|
29
|
+
supermemory/resources/memories.py,sha256=yUR8DBlJxp-1G-TIFXNyDZxdLdG-P1-c-k297JbPgUg,21235
|
30
|
+
supermemory/resources/settings.py,sha256=hzijwhQ9U_W5zDRbDjW27QdQU4CwqLkPRWkcALYSCok,12175
|
31
|
+
supermemory/types/__init__.py,sha256=RUzJ7f0cZIPrg4CtIO6SRTpu_tEUrQzjGTrnzl2k0y4,990
|
32
|
+
supermemory/types/connection_create_params.py,sha256=bYYKu3ns60PX6Mt34UQUpYwThB3SBZsKn5tW0c46DUM,630
|
33
|
+
supermemory/types/connection_create_response.py,sha256=i4sb0DSRs7wVVd8xDBOtr7vw-YbaeZ7MydlQLYvlvJs,468
|
34
|
+
supermemory/types/connection_get_response.py,sha256=9ujakZecSs89sItCpsyDQWWB59BtymxspKQKVJBofIg,606
|
35
|
+
supermemory/types/memory_add_params.py,sha256=QG_aD0YXTJ8aSzwlKkv18nkrzl3asUakfFfR65mk9ss,1528
|
36
|
+
supermemory/types/memory_add_response.py,sha256=5lim8sVXM7WzG8tUuKORHEe2lJc6yVWvyjylzNsLGjw,219
|
37
|
+
supermemory/types/memory_get_response.py,sha256=sSCvX54IIoaVuifygi0IxiwHMKNNIGgg8eJJ-xu37BI,2850
|
38
|
+
supermemory/types/memory_update_params.py,sha256=swEIF-CfcxWGzsiT8O_AbtzkyujMiafZpbi2GEXPuuw,1534
|
39
|
+
supermemory/types/memory_update_response.py,sha256=fvfO9lGM8xv2EUOQfOSxqig6fx6-ykq7syW69er_2ng,225
|
40
|
+
supermemory/types/setting_get_response.py,sha256=_CWSr9_-0alw57qSQOaMm-e_FsdXmxIRYhcmTMpdado,1789
|
41
|
+
supermemory/types/setting_update_params.py,sha256=EWbqdSsoTJohQ1nbEbBdAvtR5co_hh7huH6XZ-t7MRM,1854
|
42
|
+
supermemory/types/setting_update_response.py,sha256=Evd1U6QQDYyhD_hpKqS9k7ctvh0GNX4GHPdwBChVB44,1947
|
43
|
+
supermemory-3.0.0a2.dist-info/METADATA,sha256=-eB-dUw_U1qP97DHMd44NppIToCRka4IZiphMdzOGiU,14364
|
44
|
+
supermemory-3.0.0a2.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
45
|
+
supermemory-3.0.0a2.dist-info/licenses/LICENSE,sha256=M2NcpYEBpakciOULpWzo-xO2Lincf74gGwfaU00Sct0,11341
|
46
|
+
supermemory-3.0.0a2.dist-info/RECORD,,
|
supermemory/resources/search.py
DELETED
@@ -1,254 +0,0 @@
|
|
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 List
|
6
|
-
from typing_extensions import Literal
|
7
|
-
|
8
|
-
import httpx
|
9
|
-
|
10
|
-
from ..types import search_execute_params
|
11
|
-
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
12
|
-
from .._utils import maybe_transform, async_maybe_transform
|
13
|
-
from .._compat import cached_property
|
14
|
-
from .._resource import SyncAPIResource, AsyncAPIResource
|
15
|
-
from .._response import (
|
16
|
-
to_raw_response_wrapper,
|
17
|
-
to_streamed_response_wrapper,
|
18
|
-
async_to_raw_response_wrapper,
|
19
|
-
async_to_streamed_response_wrapper,
|
20
|
-
)
|
21
|
-
from .._base_client import make_request_options
|
22
|
-
from ..types.search_execute_response import SearchExecuteResponse
|
23
|
-
|
24
|
-
__all__ = ["SearchResource", "AsyncSearchResource"]
|
25
|
-
|
26
|
-
|
27
|
-
class SearchResource(SyncAPIResource):
|
28
|
-
@cached_property
|
29
|
-
def with_raw_response(self) -> SearchResourceWithRawResponse:
|
30
|
-
"""
|
31
|
-
This property can be used as a prefix for any HTTP method call to return
|
32
|
-
the raw response object instead of the parsed content.
|
33
|
-
|
34
|
-
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
35
|
-
"""
|
36
|
-
return SearchResourceWithRawResponse(self)
|
37
|
-
|
38
|
-
@cached_property
|
39
|
-
def with_streaming_response(self) -> SearchResourceWithStreamingResponse:
|
40
|
-
"""
|
41
|
-
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
42
|
-
|
43
|
-
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
44
|
-
"""
|
45
|
-
return SearchResourceWithStreamingResponse(self)
|
46
|
-
|
47
|
-
def execute(
|
48
|
-
self,
|
49
|
-
*,
|
50
|
-
q: str,
|
51
|
-
categories_filter: List[Literal["technology", "science", "business", "health"]] | NotGiven = NOT_GIVEN,
|
52
|
-
chunk_threshold: float | NotGiven = NOT_GIVEN,
|
53
|
-
doc_id: str | NotGiven = NOT_GIVEN,
|
54
|
-
document_threshold: float | NotGiven = NOT_GIVEN,
|
55
|
-
filters: search_execute_params.Filters | NotGiven = NOT_GIVEN,
|
56
|
-
include_summary: bool | NotGiven = NOT_GIVEN,
|
57
|
-
limit: int | NotGiven = NOT_GIVEN,
|
58
|
-
only_matching_chunks: bool | NotGiven = NOT_GIVEN,
|
59
|
-
user_id: str | NotGiven = NOT_GIVEN,
|
60
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
61
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
62
|
-
extra_headers: Headers | None = None,
|
63
|
-
extra_query: Query | None = None,
|
64
|
-
extra_body: Body | None = None,
|
65
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
66
|
-
) -> SearchExecuteResponse:
|
67
|
-
"""
|
68
|
-
Search through documents with metadata filtering
|
69
|
-
|
70
|
-
Args:
|
71
|
-
q: Search query string
|
72
|
-
|
73
|
-
categories_filter: Optional category filters
|
74
|
-
|
75
|
-
chunk_threshold: Maximum number of chunks to return
|
76
|
-
|
77
|
-
doc_id: Optional document ID to search within
|
78
|
-
|
79
|
-
document_threshold: Maximum number of documents to return
|
80
|
-
|
81
|
-
filters: Optional filters to apply to the search
|
82
|
-
|
83
|
-
include_summary: If true, include document summary in the response. This is helpful if you want a
|
84
|
-
chatbot to know the context of the document.
|
85
|
-
|
86
|
-
limit: Maximum number of results to return
|
87
|
-
|
88
|
-
only_matching_chunks: If true, only return matching chunks without context
|
89
|
-
|
90
|
-
user_id: End user ID this search is associated with
|
91
|
-
|
92
|
-
extra_headers: Send extra headers
|
93
|
-
|
94
|
-
extra_query: Add additional query parameters to the request
|
95
|
-
|
96
|
-
extra_body: Add additional JSON properties to the request
|
97
|
-
|
98
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
99
|
-
"""
|
100
|
-
return self._post(
|
101
|
-
"/search",
|
102
|
-
body=maybe_transform(
|
103
|
-
{
|
104
|
-
"q": q,
|
105
|
-
"categories_filter": categories_filter,
|
106
|
-
"chunk_threshold": chunk_threshold,
|
107
|
-
"doc_id": doc_id,
|
108
|
-
"document_threshold": document_threshold,
|
109
|
-
"filters": filters,
|
110
|
-
"include_summary": include_summary,
|
111
|
-
"limit": limit,
|
112
|
-
"only_matching_chunks": only_matching_chunks,
|
113
|
-
"user_id": user_id,
|
114
|
-
},
|
115
|
-
search_execute_params.SearchExecuteParams,
|
116
|
-
),
|
117
|
-
options=make_request_options(
|
118
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
119
|
-
),
|
120
|
-
cast_to=SearchExecuteResponse,
|
121
|
-
)
|
122
|
-
|
123
|
-
|
124
|
-
class AsyncSearchResource(AsyncAPIResource):
|
125
|
-
@cached_property
|
126
|
-
def with_raw_response(self) -> AsyncSearchResourceWithRawResponse:
|
127
|
-
"""
|
128
|
-
This property can be used as a prefix for any HTTP method call to return
|
129
|
-
the raw response object instead of the parsed content.
|
130
|
-
|
131
|
-
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
132
|
-
"""
|
133
|
-
return AsyncSearchResourceWithRawResponse(self)
|
134
|
-
|
135
|
-
@cached_property
|
136
|
-
def with_streaming_response(self) -> AsyncSearchResourceWithStreamingResponse:
|
137
|
-
"""
|
138
|
-
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
139
|
-
|
140
|
-
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
141
|
-
"""
|
142
|
-
return AsyncSearchResourceWithStreamingResponse(self)
|
143
|
-
|
144
|
-
async def execute(
|
145
|
-
self,
|
146
|
-
*,
|
147
|
-
q: str,
|
148
|
-
categories_filter: List[Literal["technology", "science", "business", "health"]] | NotGiven = NOT_GIVEN,
|
149
|
-
chunk_threshold: float | NotGiven = NOT_GIVEN,
|
150
|
-
doc_id: str | NotGiven = NOT_GIVEN,
|
151
|
-
document_threshold: float | NotGiven = NOT_GIVEN,
|
152
|
-
filters: search_execute_params.Filters | NotGiven = NOT_GIVEN,
|
153
|
-
include_summary: bool | NotGiven = NOT_GIVEN,
|
154
|
-
limit: int | NotGiven = NOT_GIVEN,
|
155
|
-
only_matching_chunks: bool | NotGiven = NOT_GIVEN,
|
156
|
-
user_id: str | NotGiven = NOT_GIVEN,
|
157
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
158
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
159
|
-
extra_headers: Headers | None = None,
|
160
|
-
extra_query: Query | None = None,
|
161
|
-
extra_body: Body | None = None,
|
162
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
163
|
-
) -> SearchExecuteResponse:
|
164
|
-
"""
|
165
|
-
Search through documents with metadata filtering
|
166
|
-
|
167
|
-
Args:
|
168
|
-
q: Search query string
|
169
|
-
|
170
|
-
categories_filter: Optional category filters
|
171
|
-
|
172
|
-
chunk_threshold: Maximum number of chunks to return
|
173
|
-
|
174
|
-
doc_id: Optional document ID to search within
|
175
|
-
|
176
|
-
document_threshold: Maximum number of documents to return
|
177
|
-
|
178
|
-
filters: Optional filters to apply to the search
|
179
|
-
|
180
|
-
include_summary: If true, include document summary in the response. This is helpful if you want a
|
181
|
-
chatbot to know the context of the document.
|
182
|
-
|
183
|
-
limit: Maximum number of results to return
|
184
|
-
|
185
|
-
only_matching_chunks: If true, only return matching chunks without context
|
186
|
-
|
187
|
-
user_id: End user ID this search is associated with
|
188
|
-
|
189
|
-
extra_headers: Send extra headers
|
190
|
-
|
191
|
-
extra_query: Add additional query parameters to the request
|
192
|
-
|
193
|
-
extra_body: Add additional JSON properties to the request
|
194
|
-
|
195
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
196
|
-
"""
|
197
|
-
return await self._post(
|
198
|
-
"/search",
|
199
|
-
body=await async_maybe_transform(
|
200
|
-
{
|
201
|
-
"q": q,
|
202
|
-
"categories_filter": categories_filter,
|
203
|
-
"chunk_threshold": chunk_threshold,
|
204
|
-
"doc_id": doc_id,
|
205
|
-
"document_threshold": document_threshold,
|
206
|
-
"filters": filters,
|
207
|
-
"include_summary": include_summary,
|
208
|
-
"limit": limit,
|
209
|
-
"only_matching_chunks": only_matching_chunks,
|
210
|
-
"user_id": user_id,
|
211
|
-
},
|
212
|
-
search_execute_params.SearchExecuteParams,
|
213
|
-
),
|
214
|
-
options=make_request_options(
|
215
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
216
|
-
),
|
217
|
-
cast_to=SearchExecuteResponse,
|
218
|
-
)
|
219
|
-
|
220
|
-
|
221
|
-
class SearchResourceWithRawResponse:
|
222
|
-
def __init__(self, search: SearchResource) -> None:
|
223
|
-
self._search = search
|
224
|
-
|
225
|
-
self.execute = to_raw_response_wrapper(
|
226
|
-
search.execute,
|
227
|
-
)
|
228
|
-
|
229
|
-
|
230
|
-
class AsyncSearchResourceWithRawResponse:
|
231
|
-
def __init__(self, search: AsyncSearchResource) -> None:
|
232
|
-
self._search = search
|
233
|
-
|
234
|
-
self.execute = async_to_raw_response_wrapper(
|
235
|
-
search.execute,
|
236
|
-
)
|
237
|
-
|
238
|
-
|
239
|
-
class SearchResourceWithStreamingResponse:
|
240
|
-
def __init__(self, search: SearchResource) -> None:
|
241
|
-
self._search = search
|
242
|
-
|
243
|
-
self.execute = to_streamed_response_wrapper(
|
244
|
-
search.execute,
|
245
|
-
)
|
246
|
-
|
247
|
-
|
248
|
-
class AsyncSearchResourceWithStreamingResponse:
|
249
|
-
def __init__(self, search: AsyncSearchResource) -> None:
|
250
|
-
self._search = search
|
251
|
-
|
252
|
-
self.execute = async_to_streamed_response_wrapper(
|
253
|
-
search.execute,
|
254
|
-
)
|
@@ -1,23 +0,0 @@
|
|
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 Required, Annotated, TypedDict
|
7
|
-
|
8
|
-
from .._utils import PropertyInfo
|
9
|
-
|
10
|
-
__all__ = ["MemoryCreateParams"]
|
11
|
-
|
12
|
-
|
13
|
-
class MemoryCreateParams(TypedDict, total=False):
|
14
|
-
content: Required[str]
|
15
|
-
"""Content of the memory"""
|
16
|
-
|
17
|
-
id: str
|
18
|
-
|
19
|
-
metadata: Dict[str, Union[str, float, bool]]
|
20
|
-
"""Optional metadata for the memory"""
|
21
|
-
|
22
|
-
user_id: Annotated[str, PropertyInfo(alias="userId")]
|
23
|
-
"""Optional end user ID this memory belongs to"""
|
@@ -1,24 +0,0 @@
|
|
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 Literal, TypedDict
|
6
|
-
|
7
|
-
__all__ = ["MemoryListParams"]
|
8
|
-
|
9
|
-
|
10
|
-
class MemoryListParams(TypedDict, total=False):
|
11
|
-
filters: str
|
12
|
-
"""Optional filters to apply to the search"""
|
13
|
-
|
14
|
-
limit: str
|
15
|
-
"""Number of items per page"""
|
16
|
-
|
17
|
-
order: Literal["asc", "desc"]
|
18
|
-
"""Sort order"""
|
19
|
-
|
20
|
-
page: str
|
21
|
-
"""Page number to fetch"""
|
22
|
-
|
23
|
-
sort: Literal["createdAt", "updatedAt"]
|
24
|
-
"""Field to sort by"""
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
-
|
3
|
-
from typing import Dict, List, Optional
|
4
|
-
from datetime import datetime
|
5
|
-
from typing_extensions import Literal
|
6
|
-
|
7
|
-
from pydantic import Field as FieldInfo
|
8
|
-
|
9
|
-
from .._models import BaseModel
|
10
|
-
|
11
|
-
__all__ = ["MemoryListResponse", "Memory", "Pagination"]
|
12
|
-
|
13
|
-
|
14
|
-
class Memory(BaseModel):
|
15
|
-
id: str
|
16
|
-
"""Unique identifier of the memory"""
|
17
|
-
|
18
|
-
created_at: datetime = FieldInfo(alias="createdAt")
|
19
|
-
"""Creation timestamp"""
|
20
|
-
|
21
|
-
metadata: Dict[str, object]
|
22
|
-
"""Custom metadata associated with the memory"""
|
23
|
-
|
24
|
-
status: Optional[Literal["queued", "extracting", "chunking", "embedding", "indexing", "done", "failed"]] = None
|
25
|
-
"""Processing status of the memory"""
|
26
|
-
|
27
|
-
summary: Optional[str] = None
|
28
|
-
"""Summary of the memory content"""
|
29
|
-
|
30
|
-
title: str
|
31
|
-
"""Title of the memory"""
|
32
|
-
|
33
|
-
updated_at: datetime = FieldInfo(alias="updatedAt")
|
34
|
-
"""Last update timestamp"""
|
35
|
-
|
36
|
-
url: Optional[str] = None
|
37
|
-
"""Source URL of the memory"""
|
38
|
-
|
39
|
-
workflow_status: Optional[Literal["PENDING", "IN_PROGRESS", "COMPLETED", "FAILED"]] = FieldInfo(
|
40
|
-
alias="workflowStatus", default=None
|
41
|
-
)
|
42
|
-
"""Current workflow status"""
|
43
|
-
|
44
|
-
|
45
|
-
class Pagination(BaseModel):
|
46
|
-
current_page: float = FieldInfo(alias="currentPage")
|
47
|
-
|
48
|
-
limit: float
|
49
|
-
|
50
|
-
total_items: float = FieldInfo(alias="totalItems")
|
51
|
-
|
52
|
-
total_pages: float = FieldInfo(alias="totalPages")
|
53
|
-
|
54
|
-
|
55
|
-
class MemoryListResponse(BaseModel):
|
56
|
-
memories: List[Memory]
|
57
|
-
|
58
|
-
pagination: Pagination
|
59
|
-
"""Pagination metadata"""
|