supermemory 3.0.0a19__py3-none-any.whl → 3.0.0a20__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-3.0.0a19.dist-info → supermemory-3.0.0a20.dist-info}/METADATA +32 -49
- supermemory-3.0.0a20.dist-info/RECORD +60 -0
- {supermemory → supermemory_new}/__init__.py +2 -2
- {supermemory → supermemory_new}/_base_client.py +1 -1
- {supermemory → supermemory_new}/_client.py +11 -3
- {supermemory → supermemory_new}/_files.py +1 -1
- {supermemory → supermemory_new}/_response.py +4 -4
- {supermemory → supermemory_new}/_types.py +1 -1
- {supermemory → supermemory_new}/_utils/_logs.py +2 -2
- {supermemory → supermemory_new}/_utils/_resources_proxy.py +4 -4
- supermemory_new/_version.py +4 -0
- {supermemory → supermemory_new}/resources/__init__.py +14 -0
- supermemory_new/resources/connections.py +728 -0
- {supermemory → supermemory_new}/resources/memories.py +138 -95
- supermemory_new/resources/search.py +300 -0
- supermemory_new/types/__init__.py +30 -0
- supermemory_new/types/connection_delete_by_provider_params.py +15 -0
- supermemory/types/memory_upload_file_response.py → supermemory_new/types/connection_delete_by_provider_response.py +3 -3
- supermemory/types/connection_get_response.py → supermemory_new/types/connection_get_by_id_response.py +2 -2
- supermemory_new/types/connection_get_by_tags_params.py +15 -0
- supermemory_new/types/connection_get_by_tags_response.py +25 -0
- supermemory_new/types/connection_import_params.py +15 -0
- supermemory_new/types/connection_list_documents_params.py +15 -0
- supermemory_new/types/connection_list_documents_response.py +29 -0
- supermemory_new/types/connection_list_params.py +15 -0
- supermemory_new/types/connection_list_response.py +29 -0
- supermemory_new/types/memory_list_params.py +34 -0
- supermemory_new/types/memory_list_response.py +91 -0
- supermemory_new/types/search_execute_params.py +93 -0
- supermemory_new/types/search_execute_response.py +55 -0
- supermemory/_version.py +0 -4
- supermemory/resources/connections.py +0 -273
- supermemory/types/__init__.py +0 -17
- supermemory/types/memory_upload_file_params.py +0 -13
- supermemory-3.0.0a19.dist-info/RECORD +0 -48
- {supermemory-3.0.0a19.dist-info → supermemory-3.0.0a20.dist-info}/WHEEL +0 -0
- {supermemory-3.0.0a19.dist-info → supermemory-3.0.0a20.dist-info}/licenses/LICENSE +0 -0
- {supermemory → supermemory_new}/_compat.py +0 -0
- {supermemory → supermemory_new}/_constants.py +0 -0
- {supermemory → supermemory_new}/_exceptions.py +0 -0
- {supermemory → supermemory_new}/_models.py +0 -0
- {supermemory → supermemory_new}/_qs.py +0 -0
- {supermemory → supermemory_new}/_resource.py +0 -0
- {supermemory → supermemory_new}/_streaming.py +0 -0
- {supermemory → supermemory_new}/_utils/__init__.py +0 -0
- {supermemory → supermemory_new}/_utils/_proxy.py +0 -0
- {supermemory → supermemory_new}/_utils/_reflection.py +0 -0
- {supermemory → supermemory_new}/_utils/_streams.py +0 -0
- {supermemory → supermemory_new}/_utils/_sync.py +0 -0
- {supermemory → supermemory_new}/_utils/_transform.py +0 -0
- {supermemory → supermemory_new}/_utils/_typing.py +0 -0
- {supermemory → supermemory_new}/_utils/_utils.py +0 -0
- {supermemory → supermemory_new}/lib/.keep +0 -0
- {supermemory → supermemory_new}/py.typed +0 -0
- {supermemory → supermemory_new}/resources/settings.py +0 -0
- {supermemory → supermemory_new}/types/connection_create_params.py +0 -0
- {supermemory → supermemory_new}/types/connection_create_response.py +0 -0
- {supermemory → supermemory_new}/types/memory_add_params.py +0 -0
- {supermemory → supermemory_new}/types/memory_add_response.py +0 -0
- {supermemory → supermemory_new}/types/memory_get_response.py +0 -0
- {supermemory → supermemory_new}/types/memory_update_params.py +0 -0
- {supermemory → supermemory_new}/types/memory_update_response.py +0 -0
- {supermemory → supermemory_new}/types/setting_get_response.py +0 -0
- {supermemory → supermemory_new}/types/setting_update_params.py +0 -0
- {supermemory → supermemory_new}/types/setting_update_response.py +0 -0
@@ -2,13 +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
|
6
|
+
from typing_extensions import Literal
|
6
7
|
|
7
8
|
import httpx
|
8
9
|
|
9
|
-
from ..types import memory_add_params,
|
10
|
-
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
11
|
-
from .._utils import
|
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
|
12
13
|
from .._compat import cached_property
|
13
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
14
15
|
from .._response import (
|
@@ -20,8 +21,8 @@ from .._response import (
|
|
20
21
|
from .._base_client import make_request_options
|
21
22
|
from ..types.memory_add_response import MemoryAddResponse
|
22
23
|
from ..types.memory_get_response import MemoryGetResponse
|
24
|
+
from ..types.memory_list_response import MemoryListResponse
|
23
25
|
from ..types.memory_update_response import MemoryUpdateResponse
|
24
|
-
from ..types.memory_upload_file_response import MemoryUploadFileResponse
|
25
26
|
|
26
27
|
__all__ = ["MemoriesResource", "AsyncMemoriesResource"]
|
27
28
|
|
@@ -113,6 +114,66 @@ class MemoriesResource(SyncAPIResource):
|
|
113
114
|
cast_to=MemoryUpdateResponse,
|
114
115
|
)
|
115
116
|
|
117
|
+
def list(
|
118
|
+
self,
|
119
|
+
*,
|
120
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
121
|
+
filters: str | NotGiven = NOT_GIVEN,
|
122
|
+
limit: Union[str, float] | NotGiven = NOT_GIVEN,
|
123
|
+
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
124
|
+
page: Union[str, float] | NotGiven = NOT_GIVEN,
|
125
|
+
sort: Literal["createdAt", "updatedAt"] | NotGiven = NOT_GIVEN,
|
126
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
127
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
128
|
+
extra_headers: Headers | None = None,
|
129
|
+
extra_query: Query | None = None,
|
130
|
+
extra_body: Body | None = None,
|
131
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
132
|
+
) -> MemoryListResponse:
|
133
|
+
"""
|
134
|
+
Retrieves a paginated list of memories with their metadata and workflow status
|
135
|
+
|
136
|
+
Args:
|
137
|
+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
138
|
+
user, a project ID, or any other identifier you wish to use to group memories.
|
139
|
+
|
140
|
+
filters: Optional filters to apply to the search
|
141
|
+
|
142
|
+
limit: Number of items per page
|
143
|
+
|
144
|
+
order: Sort order
|
145
|
+
|
146
|
+
page: Page number to fetch
|
147
|
+
|
148
|
+
sort: Field to sort by
|
149
|
+
|
150
|
+
extra_headers: Send extra headers
|
151
|
+
|
152
|
+
extra_query: Add additional query parameters to the request
|
153
|
+
|
154
|
+
extra_body: Add additional JSON properties to the request
|
155
|
+
|
156
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
157
|
+
"""
|
158
|
+
return self._post(
|
159
|
+
"/v3/memories/list",
|
160
|
+
body=maybe_transform(
|
161
|
+
{
|
162
|
+
"container_tags": container_tags,
|
163
|
+
"filters": filters,
|
164
|
+
"limit": limit,
|
165
|
+
"order": order,
|
166
|
+
"page": page,
|
167
|
+
"sort": sort,
|
168
|
+
},
|
169
|
+
memory_list_params.MemoryListParams,
|
170
|
+
),
|
171
|
+
options=make_request_options(
|
172
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
173
|
+
),
|
174
|
+
cast_to=MemoryListResponse,
|
175
|
+
)
|
176
|
+
|
116
177
|
def delete(
|
117
178
|
self,
|
118
179
|
id: str,
|
@@ -244,45 +305,6 @@ class MemoriesResource(SyncAPIResource):
|
|
244
305
|
cast_to=MemoryGetResponse,
|
245
306
|
)
|
246
307
|
|
247
|
-
def upload_file(
|
248
|
-
self,
|
249
|
-
*,
|
250
|
-
file: FileTypes,
|
251
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
252
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
253
|
-
extra_headers: Headers | None = None,
|
254
|
-
extra_query: Query | None = None,
|
255
|
-
extra_body: Body | None = None,
|
256
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
257
|
-
) -> MemoryUploadFileResponse:
|
258
|
-
"""
|
259
|
-
Upload a file to be processed
|
260
|
-
|
261
|
-
Args:
|
262
|
-
extra_headers: Send extra headers
|
263
|
-
|
264
|
-
extra_query: Add additional query parameters to the request
|
265
|
-
|
266
|
-
extra_body: Add additional JSON properties to the request
|
267
|
-
|
268
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
269
|
-
"""
|
270
|
-
body = deepcopy_minimal({"file": file})
|
271
|
-
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
272
|
-
# It should be noted that the actual Content-Type header that will be
|
273
|
-
# sent to the server will contain a `boundary` parameter, e.g.
|
274
|
-
# multipart/form-data; boundary=---abc--
|
275
|
-
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
276
|
-
return self._post(
|
277
|
-
"/v3/memories/file",
|
278
|
-
body=maybe_transform(body, memory_upload_file_params.MemoryUploadFileParams),
|
279
|
-
files=files,
|
280
|
-
options=make_request_options(
|
281
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
282
|
-
),
|
283
|
-
cast_to=MemoryUploadFileResponse,
|
284
|
-
)
|
285
|
-
|
286
308
|
|
287
309
|
class AsyncMemoriesResource(AsyncAPIResource):
|
288
310
|
@cached_property
|
@@ -371,6 +393,66 @@ class AsyncMemoriesResource(AsyncAPIResource):
|
|
371
393
|
cast_to=MemoryUpdateResponse,
|
372
394
|
)
|
373
395
|
|
396
|
+
async def list(
|
397
|
+
self,
|
398
|
+
*,
|
399
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
400
|
+
filters: str | NotGiven = NOT_GIVEN,
|
401
|
+
limit: Union[str, float] | NotGiven = NOT_GIVEN,
|
402
|
+
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
403
|
+
page: Union[str, float] | NotGiven = NOT_GIVEN,
|
404
|
+
sort: Literal["createdAt", "updatedAt"] | NotGiven = NOT_GIVEN,
|
405
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
406
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
407
|
+
extra_headers: Headers | None = None,
|
408
|
+
extra_query: Query | None = None,
|
409
|
+
extra_body: Body | None = None,
|
410
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
411
|
+
) -> MemoryListResponse:
|
412
|
+
"""
|
413
|
+
Retrieves a paginated list of memories with their metadata and workflow status
|
414
|
+
|
415
|
+
Args:
|
416
|
+
container_tags: Optional tags this memory should be containerized by. This can be an ID for your
|
417
|
+
user, a project ID, or any other identifier you wish to use to group memories.
|
418
|
+
|
419
|
+
filters: Optional filters to apply to the search
|
420
|
+
|
421
|
+
limit: Number of items per page
|
422
|
+
|
423
|
+
order: Sort order
|
424
|
+
|
425
|
+
page: Page number to fetch
|
426
|
+
|
427
|
+
sort: Field to sort by
|
428
|
+
|
429
|
+
extra_headers: Send extra headers
|
430
|
+
|
431
|
+
extra_query: Add additional query parameters to the request
|
432
|
+
|
433
|
+
extra_body: Add additional JSON properties to the request
|
434
|
+
|
435
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
436
|
+
"""
|
437
|
+
return await self._post(
|
438
|
+
"/v3/memories/list",
|
439
|
+
body=await async_maybe_transform(
|
440
|
+
{
|
441
|
+
"container_tags": container_tags,
|
442
|
+
"filters": filters,
|
443
|
+
"limit": limit,
|
444
|
+
"order": order,
|
445
|
+
"page": page,
|
446
|
+
"sort": sort,
|
447
|
+
},
|
448
|
+
memory_list_params.MemoryListParams,
|
449
|
+
),
|
450
|
+
options=make_request_options(
|
451
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
452
|
+
),
|
453
|
+
cast_to=MemoryListResponse,
|
454
|
+
)
|
455
|
+
|
374
456
|
async def delete(
|
375
457
|
self,
|
376
458
|
id: str,
|
@@ -502,45 +584,6 @@ class AsyncMemoriesResource(AsyncAPIResource):
|
|
502
584
|
cast_to=MemoryGetResponse,
|
503
585
|
)
|
504
586
|
|
505
|
-
async def upload_file(
|
506
|
-
self,
|
507
|
-
*,
|
508
|
-
file: FileTypes,
|
509
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
510
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
511
|
-
extra_headers: Headers | None = None,
|
512
|
-
extra_query: Query | None = None,
|
513
|
-
extra_body: Body | None = None,
|
514
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
515
|
-
) -> MemoryUploadFileResponse:
|
516
|
-
"""
|
517
|
-
Upload a file to be processed
|
518
|
-
|
519
|
-
Args:
|
520
|
-
extra_headers: Send extra headers
|
521
|
-
|
522
|
-
extra_query: Add additional query parameters to the request
|
523
|
-
|
524
|
-
extra_body: Add additional JSON properties to the request
|
525
|
-
|
526
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
527
|
-
"""
|
528
|
-
body = deepcopy_minimal({"file": file})
|
529
|
-
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
530
|
-
# It should be noted that the actual Content-Type header that will be
|
531
|
-
# sent to the server will contain a `boundary` parameter, e.g.
|
532
|
-
# multipart/form-data; boundary=---abc--
|
533
|
-
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
534
|
-
return await self._post(
|
535
|
-
"/v3/memories/file",
|
536
|
-
body=await async_maybe_transform(body, memory_upload_file_params.MemoryUploadFileParams),
|
537
|
-
files=files,
|
538
|
-
options=make_request_options(
|
539
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
540
|
-
),
|
541
|
-
cast_to=MemoryUploadFileResponse,
|
542
|
-
)
|
543
|
-
|
544
587
|
|
545
588
|
class MemoriesResourceWithRawResponse:
|
546
589
|
def __init__(self, memories: MemoriesResource) -> None:
|
@@ -549,6 +592,9 @@ class MemoriesResourceWithRawResponse:
|
|
549
592
|
self.update = to_raw_response_wrapper(
|
550
593
|
memories.update,
|
551
594
|
)
|
595
|
+
self.list = to_raw_response_wrapper(
|
596
|
+
memories.list,
|
597
|
+
)
|
552
598
|
self.delete = to_raw_response_wrapper(
|
553
599
|
memories.delete,
|
554
600
|
)
|
@@ -558,9 +604,6 @@ class MemoriesResourceWithRawResponse:
|
|
558
604
|
self.get = to_raw_response_wrapper(
|
559
605
|
memories.get,
|
560
606
|
)
|
561
|
-
self.upload_file = to_raw_response_wrapper(
|
562
|
-
memories.upload_file,
|
563
|
-
)
|
564
607
|
|
565
608
|
|
566
609
|
class AsyncMemoriesResourceWithRawResponse:
|
@@ -570,6 +613,9 @@ class AsyncMemoriesResourceWithRawResponse:
|
|
570
613
|
self.update = async_to_raw_response_wrapper(
|
571
614
|
memories.update,
|
572
615
|
)
|
616
|
+
self.list = async_to_raw_response_wrapper(
|
617
|
+
memories.list,
|
618
|
+
)
|
573
619
|
self.delete = async_to_raw_response_wrapper(
|
574
620
|
memories.delete,
|
575
621
|
)
|
@@ -579,9 +625,6 @@ class AsyncMemoriesResourceWithRawResponse:
|
|
579
625
|
self.get = async_to_raw_response_wrapper(
|
580
626
|
memories.get,
|
581
627
|
)
|
582
|
-
self.upload_file = async_to_raw_response_wrapper(
|
583
|
-
memories.upload_file,
|
584
|
-
)
|
585
628
|
|
586
629
|
|
587
630
|
class MemoriesResourceWithStreamingResponse:
|
@@ -591,6 +634,9 @@ class MemoriesResourceWithStreamingResponse:
|
|
591
634
|
self.update = to_streamed_response_wrapper(
|
592
635
|
memories.update,
|
593
636
|
)
|
637
|
+
self.list = to_streamed_response_wrapper(
|
638
|
+
memories.list,
|
639
|
+
)
|
594
640
|
self.delete = to_streamed_response_wrapper(
|
595
641
|
memories.delete,
|
596
642
|
)
|
@@ -600,9 +646,6 @@ class MemoriesResourceWithStreamingResponse:
|
|
600
646
|
self.get = to_streamed_response_wrapper(
|
601
647
|
memories.get,
|
602
648
|
)
|
603
|
-
self.upload_file = to_streamed_response_wrapper(
|
604
|
-
memories.upload_file,
|
605
|
-
)
|
606
649
|
|
607
650
|
|
608
651
|
class AsyncMemoriesResourceWithStreamingResponse:
|
@@ -612,6 +655,9 @@ class AsyncMemoriesResourceWithStreamingResponse:
|
|
612
655
|
self.update = async_to_streamed_response_wrapper(
|
613
656
|
memories.update,
|
614
657
|
)
|
658
|
+
self.list = async_to_streamed_response_wrapper(
|
659
|
+
memories.list,
|
660
|
+
)
|
615
661
|
self.delete = async_to_streamed_response_wrapper(
|
616
662
|
memories.delete,
|
617
663
|
)
|
@@ -621,6 +667,3 @@ class AsyncMemoriesResourceWithStreamingResponse:
|
|
621
667
|
self.get = async_to_streamed_response_wrapper(
|
622
668
|
memories.get,
|
623
669
|
)
|
624
|
-
self.upload_file = async_to_streamed_response_wrapper(
|
625
|
-
memories.upload_file,
|
626
|
-
)
|
@@ -0,0 +1,300 @@
|
|
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
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
54
|
+
doc_id: str | NotGiven = NOT_GIVEN,
|
55
|
+
document_threshold: float | NotGiven = NOT_GIVEN,
|
56
|
+
filters: search_execute_params.Filters | NotGiven = NOT_GIVEN,
|
57
|
+
include_full_docs: bool | NotGiven = NOT_GIVEN,
|
58
|
+
include_summary: bool | NotGiven = NOT_GIVEN,
|
59
|
+
limit: int | NotGiven = NOT_GIVEN,
|
60
|
+
only_matching_chunks: bool | NotGiven = NOT_GIVEN,
|
61
|
+
rerank: bool | NotGiven = NOT_GIVEN,
|
62
|
+
rewrite_query: bool | NotGiven = NOT_GIVEN,
|
63
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
64
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
65
|
+
extra_headers: Headers | None = None,
|
66
|
+
extra_query: Query | None = None,
|
67
|
+
extra_body: Body | None = None,
|
68
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
69
|
+
) -> SearchExecuteResponse:
|
70
|
+
"""
|
71
|
+
Search memories with advanced filtering
|
72
|
+
|
73
|
+
Args:
|
74
|
+
q: Search query string
|
75
|
+
|
76
|
+
categories_filter: Optional category filters
|
77
|
+
|
78
|
+
chunk_threshold: Threshold / sensitivity for chunk selection. 0 is least sensitive (returns most
|
79
|
+
chunks, more results), 1 is most sensitive (returns lesser chunks, accurate
|
80
|
+
results)
|
81
|
+
|
82
|
+
container_tags: Optional tags this search should be containerized by. This can be an ID for your
|
83
|
+
user, a project ID, or any other identifier you wish to use to filter memories.
|
84
|
+
|
85
|
+
doc_id: Optional document ID to search within. You can use this to find chunks in a very
|
86
|
+
large document.
|
87
|
+
|
88
|
+
document_threshold: Threshold / sensitivity for document selection. 0 is least sensitive (returns
|
89
|
+
most documents, more results), 1 is most sensitive (returns lesser documents,
|
90
|
+
accurate results)
|
91
|
+
|
92
|
+
filters: Optional filters to apply to the search
|
93
|
+
|
94
|
+
include_full_docs: If true, include full document in the response. This is helpful if you want a
|
95
|
+
chatbot to know the full context of the document.
|
96
|
+
|
97
|
+
include_summary: If true, include document summary in the response. This is helpful if you want a
|
98
|
+
chatbot to know the full context of the document.
|
99
|
+
|
100
|
+
limit: Maximum number of results to return
|
101
|
+
|
102
|
+
only_matching_chunks: If true, only return matching chunks without context. Normally, we send the
|
103
|
+
previous and next chunk to provide more context for LLMs. If you only want the
|
104
|
+
matching chunk, set this to true.
|
105
|
+
|
106
|
+
rerank: If true, rerank the results based on the query. This is helpful if you want to
|
107
|
+
ensure the most relevant results are returned.
|
108
|
+
|
109
|
+
rewrite_query: If true, rewrites the query to make it easier to find documents. This increases
|
110
|
+
the latency by about 400ms
|
111
|
+
|
112
|
+
extra_headers: Send extra headers
|
113
|
+
|
114
|
+
extra_query: Add additional query parameters to the request
|
115
|
+
|
116
|
+
extra_body: Add additional JSON properties to the request
|
117
|
+
|
118
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
119
|
+
"""
|
120
|
+
return self._post(
|
121
|
+
"/v3/search",
|
122
|
+
body=maybe_transform(
|
123
|
+
{
|
124
|
+
"q": q,
|
125
|
+
"categories_filter": categories_filter,
|
126
|
+
"chunk_threshold": chunk_threshold,
|
127
|
+
"container_tags": container_tags,
|
128
|
+
"doc_id": doc_id,
|
129
|
+
"document_threshold": document_threshold,
|
130
|
+
"filters": filters,
|
131
|
+
"include_full_docs": include_full_docs,
|
132
|
+
"include_summary": include_summary,
|
133
|
+
"limit": limit,
|
134
|
+
"only_matching_chunks": only_matching_chunks,
|
135
|
+
"rerank": rerank,
|
136
|
+
"rewrite_query": rewrite_query,
|
137
|
+
},
|
138
|
+
search_execute_params.SearchExecuteParams,
|
139
|
+
),
|
140
|
+
options=make_request_options(
|
141
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
142
|
+
),
|
143
|
+
cast_to=SearchExecuteResponse,
|
144
|
+
)
|
145
|
+
|
146
|
+
|
147
|
+
class AsyncSearchResource(AsyncAPIResource):
|
148
|
+
@cached_property
|
149
|
+
def with_raw_response(self) -> AsyncSearchResourceWithRawResponse:
|
150
|
+
"""
|
151
|
+
This property can be used as a prefix for any HTTP method call to return
|
152
|
+
the raw response object instead of the parsed content.
|
153
|
+
|
154
|
+
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
155
|
+
"""
|
156
|
+
return AsyncSearchResourceWithRawResponse(self)
|
157
|
+
|
158
|
+
@cached_property
|
159
|
+
def with_streaming_response(self) -> AsyncSearchResourceWithStreamingResponse:
|
160
|
+
"""
|
161
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
162
|
+
|
163
|
+
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
164
|
+
"""
|
165
|
+
return AsyncSearchResourceWithStreamingResponse(self)
|
166
|
+
|
167
|
+
async def execute(
|
168
|
+
self,
|
169
|
+
*,
|
170
|
+
q: str,
|
171
|
+
categories_filter: List[Literal["technology", "science", "business", "health"]] | NotGiven = NOT_GIVEN,
|
172
|
+
chunk_threshold: float | NotGiven = NOT_GIVEN,
|
173
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
174
|
+
doc_id: str | NotGiven = NOT_GIVEN,
|
175
|
+
document_threshold: float | NotGiven = NOT_GIVEN,
|
176
|
+
filters: search_execute_params.Filters | NotGiven = NOT_GIVEN,
|
177
|
+
include_full_docs: bool | NotGiven = NOT_GIVEN,
|
178
|
+
include_summary: bool | NotGiven = NOT_GIVEN,
|
179
|
+
limit: int | NotGiven = NOT_GIVEN,
|
180
|
+
only_matching_chunks: bool | NotGiven = NOT_GIVEN,
|
181
|
+
rerank: bool | NotGiven = NOT_GIVEN,
|
182
|
+
rewrite_query: bool | NotGiven = NOT_GIVEN,
|
183
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
184
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
185
|
+
extra_headers: Headers | None = None,
|
186
|
+
extra_query: Query | None = None,
|
187
|
+
extra_body: Body | None = None,
|
188
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
189
|
+
) -> SearchExecuteResponse:
|
190
|
+
"""
|
191
|
+
Search memories with advanced filtering
|
192
|
+
|
193
|
+
Args:
|
194
|
+
q: Search query string
|
195
|
+
|
196
|
+
categories_filter: Optional category filters
|
197
|
+
|
198
|
+
chunk_threshold: Threshold / sensitivity for chunk selection. 0 is least sensitive (returns most
|
199
|
+
chunks, more results), 1 is most sensitive (returns lesser chunks, accurate
|
200
|
+
results)
|
201
|
+
|
202
|
+
container_tags: Optional tags this search should be containerized by. This can be an ID for your
|
203
|
+
user, a project ID, or any other identifier you wish to use to filter memories.
|
204
|
+
|
205
|
+
doc_id: Optional document ID to search within. You can use this to find chunks in a very
|
206
|
+
large document.
|
207
|
+
|
208
|
+
document_threshold: Threshold / sensitivity for document selection. 0 is least sensitive (returns
|
209
|
+
most documents, more results), 1 is most sensitive (returns lesser documents,
|
210
|
+
accurate results)
|
211
|
+
|
212
|
+
filters: Optional filters to apply to the search
|
213
|
+
|
214
|
+
include_full_docs: If true, include full document in the response. This is helpful if you want a
|
215
|
+
chatbot to know the full context of the document.
|
216
|
+
|
217
|
+
include_summary: If true, include document summary in the response. This is helpful if you want a
|
218
|
+
chatbot to know the full context of the document.
|
219
|
+
|
220
|
+
limit: Maximum number of results to return
|
221
|
+
|
222
|
+
only_matching_chunks: If true, only return matching chunks without context. Normally, we send the
|
223
|
+
previous and next chunk to provide more context for LLMs. If you only want the
|
224
|
+
matching chunk, set this to true.
|
225
|
+
|
226
|
+
rerank: If true, rerank the results based on the query. This is helpful if you want to
|
227
|
+
ensure the most relevant results are returned.
|
228
|
+
|
229
|
+
rewrite_query: If true, rewrites the query to make it easier to find documents. This increases
|
230
|
+
the latency by about 400ms
|
231
|
+
|
232
|
+
extra_headers: Send extra headers
|
233
|
+
|
234
|
+
extra_query: Add additional query parameters to the request
|
235
|
+
|
236
|
+
extra_body: Add additional JSON properties to the request
|
237
|
+
|
238
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
239
|
+
"""
|
240
|
+
return await self._post(
|
241
|
+
"/v3/search",
|
242
|
+
body=await async_maybe_transform(
|
243
|
+
{
|
244
|
+
"q": q,
|
245
|
+
"categories_filter": categories_filter,
|
246
|
+
"chunk_threshold": chunk_threshold,
|
247
|
+
"container_tags": container_tags,
|
248
|
+
"doc_id": doc_id,
|
249
|
+
"document_threshold": document_threshold,
|
250
|
+
"filters": filters,
|
251
|
+
"include_full_docs": include_full_docs,
|
252
|
+
"include_summary": include_summary,
|
253
|
+
"limit": limit,
|
254
|
+
"only_matching_chunks": only_matching_chunks,
|
255
|
+
"rerank": rerank,
|
256
|
+
"rewrite_query": rewrite_query,
|
257
|
+
},
|
258
|
+
search_execute_params.SearchExecuteParams,
|
259
|
+
),
|
260
|
+
options=make_request_options(
|
261
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
262
|
+
),
|
263
|
+
cast_to=SearchExecuteResponse,
|
264
|
+
)
|
265
|
+
|
266
|
+
|
267
|
+
class SearchResourceWithRawResponse:
|
268
|
+
def __init__(self, search: SearchResource) -> None:
|
269
|
+
self._search = search
|
270
|
+
|
271
|
+
self.execute = to_raw_response_wrapper(
|
272
|
+
search.execute,
|
273
|
+
)
|
274
|
+
|
275
|
+
|
276
|
+
class AsyncSearchResourceWithRawResponse:
|
277
|
+
def __init__(self, search: AsyncSearchResource) -> None:
|
278
|
+
self._search = search
|
279
|
+
|
280
|
+
self.execute = async_to_raw_response_wrapper(
|
281
|
+
search.execute,
|
282
|
+
)
|
283
|
+
|
284
|
+
|
285
|
+
class SearchResourceWithStreamingResponse:
|
286
|
+
def __init__(self, search: SearchResource) -> None:
|
287
|
+
self._search = search
|
288
|
+
|
289
|
+
self.execute = to_streamed_response_wrapper(
|
290
|
+
search.execute,
|
291
|
+
)
|
292
|
+
|
293
|
+
|
294
|
+
class AsyncSearchResourceWithStreamingResponse:
|
295
|
+
def __init__(self, search: AsyncSearchResource) -> None:
|
296
|
+
self._search = search
|
297
|
+
|
298
|
+
self.execute = async_to_streamed_response_wrapper(
|
299
|
+
search.execute,
|
300
|
+
)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from .memory_add_params import MemoryAddParams as MemoryAddParams
|
6
|
+
from .memory_list_params import MemoryListParams as MemoryListParams
|
7
|
+
from .memory_add_response import MemoryAddResponse as MemoryAddResponse
|
8
|
+
from .memory_get_response import MemoryGetResponse as MemoryGetResponse
|
9
|
+
from .memory_list_response import MemoryListResponse as MemoryListResponse
|
10
|
+
from .memory_update_params import MemoryUpdateParams as MemoryUpdateParams
|
11
|
+
from .setting_get_response import SettingGetResponse as SettingGetResponse
|
12
|
+
from .search_execute_params import SearchExecuteParams as SearchExecuteParams
|
13
|
+
from .setting_update_params import SettingUpdateParams as SettingUpdateParams
|
14
|
+
from .connection_list_params import ConnectionListParams as ConnectionListParams
|
15
|
+
from .memory_update_response import MemoryUpdateResponse as MemoryUpdateResponse
|
16
|
+
from .search_execute_response import SearchExecuteResponse as SearchExecuteResponse
|
17
|
+
from .setting_update_response import SettingUpdateResponse as SettingUpdateResponse
|
18
|
+
from .connection_create_params import ConnectionCreateParams as ConnectionCreateParams
|
19
|
+
from .connection_import_params import ConnectionImportParams as ConnectionImportParams
|
20
|
+
from .connection_list_response import ConnectionListResponse as ConnectionListResponse
|
21
|
+
from .connection_create_response import ConnectionCreateResponse as ConnectionCreateResponse
|
22
|
+
from .connection_get_by_id_response import ConnectionGetByIDResponse as ConnectionGetByIDResponse
|
23
|
+
from .connection_get_by_tags_params import ConnectionGetByTagsParams as ConnectionGetByTagsParams
|
24
|
+
from .connection_get_by_tags_response import ConnectionGetByTagsResponse as ConnectionGetByTagsResponse
|
25
|
+
from .connection_list_documents_params import ConnectionListDocumentsParams as ConnectionListDocumentsParams
|
26
|
+
from .connection_list_documents_response import ConnectionListDocumentsResponse as ConnectionListDocumentsResponse
|
27
|
+
from .connection_delete_by_provider_params import ConnectionDeleteByProviderParams as ConnectionDeleteByProviderParams
|
28
|
+
from .connection_delete_by_provider_response import (
|
29
|
+
ConnectionDeleteByProviderResponse as ConnectionDeleteByProviderResponse,
|
30
|
+
)
|
@@ -0,0 +1,15 @@
|
|
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 Required, Annotated, TypedDict
|
7
|
+
|
8
|
+
from .._utils import PropertyInfo
|
9
|
+
|
10
|
+
__all__ = ["ConnectionDeleteByProviderParams"]
|
11
|
+
|
12
|
+
|
13
|
+
class ConnectionDeleteByProviderParams(TypedDict, total=False):
|
14
|
+
container_tags: Required[Annotated[List[str], PropertyInfo(alias="containerTags")]]
|
15
|
+
"""Optional comma-separated list of container tags to filter connections by"""
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
from .._models import BaseModel
|
4
4
|
|
5
|
-
__all__ = ["
|
5
|
+
__all__ = ["ConnectionDeleteByProviderResponse"]
|
6
6
|
|
7
7
|
|
8
|
-
class
|
8
|
+
class ConnectionDeleteByProviderResponse(BaseModel):
|
9
9
|
id: str
|
10
10
|
|
11
|
-
|
11
|
+
provider: str
|