supermemory 3.0.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 +2 -1
- supermemory/_base_client.py +44 -2
- supermemory/_client.py +1 -9
- supermemory/_files.py +1 -1
- supermemory/_models.py +2 -0
- supermemory/_types.py +2 -0
- supermemory/_version.py +1 -1
- supermemory/resources/__init__.py +0 -14
- supermemory/resources/connections.py +30 -117
- supermemory/resources/memories.py +102 -230
- supermemory/resources/settings.py +47 -11
- supermemory/types/__init__.py +0 -9
- supermemory/types/connection_create_params.py +5 -3
- supermemory/types/connection_get_response.py +4 -0
- supermemory/types/memory_add_params.py +28 -0
- supermemory/types/memory_get_response.py +87 -1
- supermemory/types/memory_update_params.py +28 -0
- supermemory/types/setting_get_response.py +36 -2
- supermemory/types/setting_update_params.py +30 -6
- supermemory/types/setting_update_response.py +34 -8
- {supermemory-3.0.0a1.dist-info → supermemory-3.0.0a2.dist-info}/METADATA +44 -24
- supermemory-3.0.0a2.dist-info/RECORD +46 -0
- supermemory/resources/search.py +0 -296
- supermemory/types/connection_list_params.py +0 -13
- supermemory/types/connection_list_response.py +0 -25
- supermemory/types/memory_delete_response.py +0 -9
- supermemory/types/memory_list_params.py +0 -24
- supermemory/types/memory_list_response.py +0 -95
- supermemory/types/memory_upload_file_params.py +0 -13
- supermemory/types/memory_upload_file_response.py +0 -11
- supermemory/types/search_execute_params.py +0 -86
- supermemory/types/search_execute_response.py +0 -52
- supermemory-3.0.0a1.dist-info/RECORD +0 -56
- {supermemory-3.0.0a1.dist-info → supermemory-3.0.0a2.dist-info}/WHEEL +0 -0
- {supermemory-3.0.0a1.dist-info → supermemory-3.0.0a2.dist-info}/licenses/LICENSE +0 -0
supermemory/resources/search.py
DELETED
@@ -1,296 +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
|
-
rerank: bool | NotGiven = NOT_GIVEN,
|
60
|
-
rewrite_query: bool | NotGiven = NOT_GIVEN,
|
61
|
-
user_id: str | NotGiven = NOT_GIVEN,
|
62
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
63
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
64
|
-
extra_headers: Headers | None = None,
|
65
|
-
extra_query: Query | None = None,
|
66
|
-
extra_body: Body | None = None,
|
67
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
68
|
-
) -> SearchExecuteResponse:
|
69
|
-
"""
|
70
|
-
Search memories with filtering
|
71
|
-
|
72
|
-
Args:
|
73
|
-
q: Search query string
|
74
|
-
|
75
|
-
categories_filter: Optional category filters
|
76
|
-
|
77
|
-
chunk_threshold: Threshold / sensitivity for chunk selection. 0 is least sensitive (returns most
|
78
|
-
chunks, more results), 1 is most sensitive (returns lesser chunks, accurate
|
79
|
-
results)
|
80
|
-
|
81
|
-
doc_id: Optional document ID to search within. You can use this to find chunks in a very
|
82
|
-
large document.
|
83
|
-
|
84
|
-
document_threshold: Threshold / sensitivity for document selection. 0 is least sensitive (returns
|
85
|
-
most documents, more results), 1 is most sensitive (returns lesser documents,
|
86
|
-
accurate results)
|
87
|
-
|
88
|
-
filters: Optional filters to apply to the search
|
89
|
-
|
90
|
-
include_summary: If true, include document summary in the response. This is helpful if you want a
|
91
|
-
chatbot to know the full context of the document.
|
92
|
-
|
93
|
-
limit: Maximum number of results to return
|
94
|
-
|
95
|
-
only_matching_chunks: If true, only return matching chunks without context. Normally, we send the
|
96
|
-
previous and next chunk to provide more context for LLMs. If you only want the
|
97
|
-
matching chunk, set this to true.
|
98
|
-
|
99
|
-
rerank: If true, rerank the results based on the query. This is helpful if you want to
|
100
|
-
ensure the most relevant results are returned.
|
101
|
-
|
102
|
-
rewrite_query: If true, rewrites the query to make it easier to find documents. This increases
|
103
|
-
the latency by about 400ms
|
104
|
-
|
105
|
-
user_id: End user ID this search is associated with. NOTE: This also acts as a filter for
|
106
|
-
the search.
|
107
|
-
|
108
|
-
extra_headers: Send extra headers
|
109
|
-
|
110
|
-
extra_query: Add additional query parameters to the request
|
111
|
-
|
112
|
-
extra_body: Add additional JSON properties to the request
|
113
|
-
|
114
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
115
|
-
"""
|
116
|
-
return self._get(
|
117
|
-
"/v3/search",
|
118
|
-
options=make_request_options(
|
119
|
-
extra_headers=extra_headers,
|
120
|
-
extra_query=extra_query,
|
121
|
-
extra_body=extra_body,
|
122
|
-
timeout=timeout,
|
123
|
-
query=maybe_transform(
|
124
|
-
{
|
125
|
-
"q": q,
|
126
|
-
"categories_filter": categories_filter,
|
127
|
-
"chunk_threshold": chunk_threshold,
|
128
|
-
"doc_id": doc_id,
|
129
|
-
"document_threshold": document_threshold,
|
130
|
-
"filters": filters,
|
131
|
-
"include_summary": include_summary,
|
132
|
-
"limit": limit,
|
133
|
-
"only_matching_chunks": only_matching_chunks,
|
134
|
-
"rerank": rerank,
|
135
|
-
"rewrite_query": rewrite_query,
|
136
|
-
"user_id": user_id,
|
137
|
-
},
|
138
|
-
search_execute_params.SearchExecuteParams,
|
139
|
-
),
|
140
|
-
),
|
141
|
-
cast_to=SearchExecuteResponse,
|
142
|
-
)
|
143
|
-
|
144
|
-
|
145
|
-
class AsyncSearchResource(AsyncAPIResource):
|
146
|
-
@cached_property
|
147
|
-
def with_raw_response(self) -> AsyncSearchResourceWithRawResponse:
|
148
|
-
"""
|
149
|
-
This property can be used as a prefix for any HTTP method call to return
|
150
|
-
the raw response object instead of the parsed content.
|
151
|
-
|
152
|
-
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
153
|
-
"""
|
154
|
-
return AsyncSearchResourceWithRawResponse(self)
|
155
|
-
|
156
|
-
@cached_property
|
157
|
-
def with_streaming_response(self) -> AsyncSearchResourceWithStreamingResponse:
|
158
|
-
"""
|
159
|
-
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
160
|
-
|
161
|
-
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
162
|
-
"""
|
163
|
-
return AsyncSearchResourceWithStreamingResponse(self)
|
164
|
-
|
165
|
-
async def execute(
|
166
|
-
self,
|
167
|
-
*,
|
168
|
-
q: str,
|
169
|
-
categories_filter: List[Literal["technology", "science", "business", "health"]] | NotGiven = NOT_GIVEN,
|
170
|
-
chunk_threshold: float | NotGiven = NOT_GIVEN,
|
171
|
-
doc_id: str | NotGiven = NOT_GIVEN,
|
172
|
-
document_threshold: float | NotGiven = NOT_GIVEN,
|
173
|
-
filters: search_execute_params.Filters | NotGiven = NOT_GIVEN,
|
174
|
-
include_summary: bool | NotGiven = NOT_GIVEN,
|
175
|
-
limit: int | NotGiven = NOT_GIVEN,
|
176
|
-
only_matching_chunks: bool | NotGiven = NOT_GIVEN,
|
177
|
-
rerank: bool | NotGiven = NOT_GIVEN,
|
178
|
-
rewrite_query: bool | NotGiven = NOT_GIVEN,
|
179
|
-
user_id: str | NotGiven = NOT_GIVEN,
|
180
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
181
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
182
|
-
extra_headers: Headers | None = None,
|
183
|
-
extra_query: Query | None = None,
|
184
|
-
extra_body: Body | None = None,
|
185
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
186
|
-
) -> SearchExecuteResponse:
|
187
|
-
"""
|
188
|
-
Search memories with filtering
|
189
|
-
|
190
|
-
Args:
|
191
|
-
q: Search query string
|
192
|
-
|
193
|
-
categories_filter: Optional category filters
|
194
|
-
|
195
|
-
chunk_threshold: Threshold / sensitivity for chunk selection. 0 is least sensitive (returns most
|
196
|
-
chunks, more results), 1 is most sensitive (returns lesser chunks, accurate
|
197
|
-
results)
|
198
|
-
|
199
|
-
doc_id: Optional document ID to search within. You can use this to find chunks in a very
|
200
|
-
large document.
|
201
|
-
|
202
|
-
document_threshold: Threshold / sensitivity for document selection. 0 is least sensitive (returns
|
203
|
-
most documents, more results), 1 is most sensitive (returns lesser documents,
|
204
|
-
accurate results)
|
205
|
-
|
206
|
-
filters: Optional filters to apply to the search
|
207
|
-
|
208
|
-
include_summary: If true, include document summary in the response. This is helpful if you want a
|
209
|
-
chatbot to know the full context of the document.
|
210
|
-
|
211
|
-
limit: Maximum number of results to return
|
212
|
-
|
213
|
-
only_matching_chunks: If true, only return matching chunks without context. Normally, we send the
|
214
|
-
previous and next chunk to provide more context for LLMs. If you only want the
|
215
|
-
matching chunk, set this to true.
|
216
|
-
|
217
|
-
rerank: If true, rerank the results based on the query. This is helpful if you want to
|
218
|
-
ensure the most relevant results are returned.
|
219
|
-
|
220
|
-
rewrite_query: If true, rewrites the query to make it easier to find documents. This increases
|
221
|
-
the latency by about 400ms
|
222
|
-
|
223
|
-
user_id: End user ID this search is associated with. NOTE: This also acts as a filter for
|
224
|
-
the search.
|
225
|
-
|
226
|
-
extra_headers: Send extra headers
|
227
|
-
|
228
|
-
extra_query: Add additional query parameters to the request
|
229
|
-
|
230
|
-
extra_body: Add additional JSON properties to the request
|
231
|
-
|
232
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
233
|
-
"""
|
234
|
-
return await self._get(
|
235
|
-
"/v3/search",
|
236
|
-
options=make_request_options(
|
237
|
-
extra_headers=extra_headers,
|
238
|
-
extra_query=extra_query,
|
239
|
-
extra_body=extra_body,
|
240
|
-
timeout=timeout,
|
241
|
-
query=await async_maybe_transform(
|
242
|
-
{
|
243
|
-
"q": q,
|
244
|
-
"categories_filter": categories_filter,
|
245
|
-
"chunk_threshold": chunk_threshold,
|
246
|
-
"doc_id": doc_id,
|
247
|
-
"document_threshold": document_threshold,
|
248
|
-
"filters": filters,
|
249
|
-
"include_summary": include_summary,
|
250
|
-
"limit": limit,
|
251
|
-
"only_matching_chunks": only_matching_chunks,
|
252
|
-
"rerank": rerank,
|
253
|
-
"rewrite_query": rewrite_query,
|
254
|
-
"user_id": user_id,
|
255
|
-
},
|
256
|
-
search_execute_params.SearchExecuteParams,
|
257
|
-
),
|
258
|
-
),
|
259
|
-
cast_to=SearchExecuteResponse,
|
260
|
-
)
|
261
|
-
|
262
|
-
|
263
|
-
class SearchResourceWithRawResponse:
|
264
|
-
def __init__(self, search: SearchResource) -> None:
|
265
|
-
self._search = search
|
266
|
-
|
267
|
-
self.execute = to_raw_response_wrapper(
|
268
|
-
search.execute,
|
269
|
-
)
|
270
|
-
|
271
|
-
|
272
|
-
class AsyncSearchResourceWithRawResponse:
|
273
|
-
def __init__(self, search: AsyncSearchResource) -> None:
|
274
|
-
self._search = search
|
275
|
-
|
276
|
-
self.execute = async_to_raw_response_wrapper(
|
277
|
-
search.execute,
|
278
|
-
)
|
279
|
-
|
280
|
-
|
281
|
-
class SearchResourceWithStreamingResponse:
|
282
|
-
def __init__(self, search: SearchResource) -> None:
|
283
|
-
self._search = search
|
284
|
-
|
285
|
-
self.execute = to_streamed_response_wrapper(
|
286
|
-
search.execute,
|
287
|
-
)
|
288
|
-
|
289
|
-
|
290
|
-
class AsyncSearchResourceWithStreamingResponse:
|
291
|
-
def __init__(self, search: AsyncSearchResource) -> None:
|
292
|
-
self._search = search
|
293
|
-
|
294
|
-
self.execute = async_to_streamed_response_wrapper(
|
295
|
-
search.execute,
|
296
|
-
)
|
@@ -1,13 +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 Annotated, TypedDict
|
6
|
-
|
7
|
-
from .._utils import PropertyInfo
|
8
|
-
|
9
|
-
__all__ = ["ConnectionListParams"]
|
10
|
-
|
11
|
-
|
12
|
-
class ConnectionListParams(TypedDict, total=False):
|
13
|
-
end_user_id: Annotated[str, PropertyInfo(alias="endUserId")]
|
@@ -1,25 +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 typing_extensions import TypeAlias
|
5
|
-
|
6
|
-
from pydantic import Field as FieldInfo
|
7
|
-
|
8
|
-
from .._models import BaseModel
|
9
|
-
|
10
|
-
__all__ = ["ConnectionListResponse", "ConnectionListResponseItem"]
|
11
|
-
|
12
|
-
|
13
|
-
class ConnectionListResponseItem(BaseModel):
|
14
|
-
id: str
|
15
|
-
|
16
|
-
created_at: float = FieldInfo(alias="createdAt")
|
17
|
-
|
18
|
-
provider: str
|
19
|
-
|
20
|
-
expires_at: Optional[float] = FieldInfo(alias="expiresAt", default=None)
|
21
|
-
|
22
|
-
metadata: Optional[Dict[str, object]] = None
|
23
|
-
|
24
|
-
|
25
|
-
ConnectionListResponse: TypeAlias = List[ConnectionListResponseItem]
|
@@ -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,95 +0,0 @@
|
|
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 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
|
-
content: Optional[str] = None
|
19
|
-
"""The content to extract and process into a memory.
|
20
|
-
|
21
|
-
This can be a URL to a website, a PDF, an image, or a video.
|
22
|
-
|
23
|
-
Plaintext: Any plaintext format
|
24
|
-
|
25
|
-
URL: A URL to a website, PDF, image, or video
|
26
|
-
|
27
|
-
We automatically detect the content type from the url's response format.
|
28
|
-
"""
|
29
|
-
|
30
|
-
created_at: datetime = FieldInfo(alias="createdAt")
|
31
|
-
"""Creation timestamp"""
|
32
|
-
|
33
|
-
custom_id: Optional[str] = FieldInfo(alias="customId", default=None)
|
34
|
-
"""Optional custom ID of the memory.
|
35
|
-
|
36
|
-
This could be an ID from your database that will uniquely identify this memory.
|
37
|
-
"""
|
38
|
-
|
39
|
-
metadata: Union[str, float, bool, Dict[str, object], List[object], None] = None
|
40
|
-
"""Optional metadata for the memory.
|
41
|
-
|
42
|
-
This is used to store additional information about the memory. You can use this
|
43
|
-
to store any additional information you need about the memory. Metadata can be
|
44
|
-
filtered through. Keys must be strings and are case sensitive. Values can be
|
45
|
-
strings, numbers, or booleans. You cannot nest objects.
|
46
|
-
"""
|
47
|
-
|
48
|
-
og_image: Optional[str] = FieldInfo(alias="ogImage", default=None)
|
49
|
-
|
50
|
-
source: Optional[str] = None
|
51
|
-
|
52
|
-
status: Literal["unknown", "queued", "extracting", "chunking", "embedding", "indexing", "done", "failed"]
|
53
|
-
"""Status of the memory"""
|
54
|
-
|
55
|
-
summary: Optional[str] = None
|
56
|
-
"""Summary of the memory content"""
|
57
|
-
|
58
|
-
title: Optional[str] = None
|
59
|
-
"""Title of the memory"""
|
60
|
-
|
61
|
-
type: Literal["text", "pdf", "tweet", "google_doc", "image", "video", "notion_doc", "webpage"]
|
62
|
-
"""Type of the memory"""
|
63
|
-
|
64
|
-
updated_at: datetime = FieldInfo(alias="updatedAt")
|
65
|
-
"""Last update timestamp"""
|
66
|
-
|
67
|
-
url: Optional[str] = None
|
68
|
-
"""URL of the memory"""
|
69
|
-
|
70
|
-
container_tags: Optional[List[str]] = FieldInfo(alias="containerTags", default=None)
|
71
|
-
"""Optional tags this memory should be containerized by.
|
72
|
-
|
73
|
-
This can be an ID for your user, a project ID, or any other identifier you wish
|
74
|
-
to use to group memories.
|
75
|
-
"""
|
76
|
-
|
77
|
-
raw: None = None
|
78
|
-
"""Raw content of the memory"""
|
79
|
-
|
80
|
-
|
81
|
-
class Pagination(BaseModel):
|
82
|
-
current_page: float = FieldInfo(alias="currentPage")
|
83
|
-
|
84
|
-
limit: float
|
85
|
-
|
86
|
-
total_items: float = FieldInfo(alias="totalItems")
|
87
|
-
|
88
|
-
total_pages: float = FieldInfo(alias="totalPages")
|
89
|
-
|
90
|
-
|
91
|
-
class MemoryListResponse(BaseModel):
|
92
|
-
memories: List[Memory]
|
93
|
-
|
94
|
-
pagination: Pagination
|
95
|
-
"""Pagination metadata"""
|
@@ -1,13 +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 Required, TypedDict
|
6
|
-
|
7
|
-
from .._types import FileTypes
|
8
|
-
|
9
|
-
__all__ = ["MemoryUploadFileParams"]
|
10
|
-
|
11
|
-
|
12
|
-
class MemoryUploadFileParams(TypedDict, total=False):
|
13
|
-
file: Required[FileTypes]
|
@@ -1,86 +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, List, Union, Iterable
|
6
|
-
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
|
7
|
-
|
8
|
-
from .._utils import PropertyInfo
|
9
|
-
|
10
|
-
__all__ = ["SearchExecuteParams", "Filters", "FiltersUnionMember0"]
|
11
|
-
|
12
|
-
|
13
|
-
class SearchExecuteParams(TypedDict, total=False):
|
14
|
-
q: Required[str]
|
15
|
-
"""Search query string"""
|
16
|
-
|
17
|
-
categories_filter: Annotated[
|
18
|
-
List[Literal["technology", "science", "business", "health"]], PropertyInfo(alias="categoriesFilter")
|
19
|
-
]
|
20
|
-
"""Optional category filters"""
|
21
|
-
|
22
|
-
chunk_threshold: Annotated[float, PropertyInfo(alias="chunkThreshold")]
|
23
|
-
"""Threshold / sensitivity for chunk selection.
|
24
|
-
|
25
|
-
0 is least sensitive (returns most chunks, more results), 1 is most sensitive
|
26
|
-
(returns lesser chunks, accurate results)
|
27
|
-
"""
|
28
|
-
|
29
|
-
doc_id: Annotated[str, PropertyInfo(alias="docId")]
|
30
|
-
"""Optional document ID to search within.
|
31
|
-
|
32
|
-
You can use this to find chunks in a very large document.
|
33
|
-
"""
|
34
|
-
|
35
|
-
document_threshold: Annotated[float, PropertyInfo(alias="documentThreshold")]
|
36
|
-
"""Threshold / sensitivity for document selection.
|
37
|
-
|
38
|
-
0 is least sensitive (returns most documents, more results), 1 is most sensitive
|
39
|
-
(returns lesser documents, accurate results)
|
40
|
-
"""
|
41
|
-
|
42
|
-
filters: Filters
|
43
|
-
"""Optional filters to apply to the search"""
|
44
|
-
|
45
|
-
include_summary: Annotated[bool, PropertyInfo(alias="includeSummary")]
|
46
|
-
"""If true, include document summary in the response.
|
47
|
-
|
48
|
-
This is helpful if you want a chatbot to know the full context of the document.
|
49
|
-
"""
|
50
|
-
|
51
|
-
limit: int
|
52
|
-
"""Maximum number of results to return"""
|
53
|
-
|
54
|
-
only_matching_chunks: Annotated[bool, PropertyInfo(alias="onlyMatchingChunks")]
|
55
|
-
"""If true, only return matching chunks without context.
|
56
|
-
|
57
|
-
Normally, we send the previous and next chunk to provide more context for LLMs.
|
58
|
-
If you only want the matching chunk, set this to true.
|
59
|
-
"""
|
60
|
-
|
61
|
-
rerank: bool
|
62
|
-
"""If true, rerank the results based on the query.
|
63
|
-
|
64
|
-
This is helpful if you want to ensure the most relevant results are returned.
|
65
|
-
"""
|
66
|
-
|
67
|
-
rewrite_query: Annotated[bool, PropertyInfo(alias="rewriteQuery")]
|
68
|
-
"""If true, rewrites the query to make it easier to find documents.
|
69
|
-
|
70
|
-
This increases the latency by about 400ms
|
71
|
-
"""
|
72
|
-
|
73
|
-
user_id: Annotated[str, PropertyInfo(alias="userId")]
|
74
|
-
"""End user ID this search is associated with.
|
75
|
-
|
76
|
-
NOTE: This also acts as a filter for the search.
|
77
|
-
"""
|
78
|
-
|
79
|
-
|
80
|
-
class FiltersUnionMember0(TypedDict, total=False):
|
81
|
-
and_: Annotated[Iterable[object], PropertyInfo(alias="AND")]
|
82
|
-
|
83
|
-
or_: Annotated[Iterable[object], PropertyInfo(alias="OR")]
|
84
|
-
|
85
|
-
|
86
|
-
Filters: TypeAlias = Union[FiltersUnionMember0, Dict[str, object]]
|
@@ -1,52 +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
|
-
|
6
|
-
from pydantic import Field as FieldInfo
|
7
|
-
|
8
|
-
from .._models import BaseModel
|
9
|
-
|
10
|
-
__all__ = ["SearchExecuteResponse", "Result", "ResultChunk"]
|
11
|
-
|
12
|
-
|
13
|
-
class ResultChunk(BaseModel):
|
14
|
-
content: str
|
15
|
-
"""Content of the matching chunk"""
|
16
|
-
|
17
|
-
is_relevant: bool = FieldInfo(alias="isRelevant")
|
18
|
-
"""Whether this chunk is relevant to the query"""
|
19
|
-
|
20
|
-
score: float
|
21
|
-
"""Similarity score for this chunk"""
|
22
|
-
|
23
|
-
|
24
|
-
class Result(BaseModel):
|
25
|
-
chunks: List[ResultChunk]
|
26
|
-
"""Matching content chunks from the document"""
|
27
|
-
|
28
|
-
created_at: datetime = FieldInfo(alias="createdAt")
|
29
|
-
"""Document creation date"""
|
30
|
-
|
31
|
-
document_id: str = FieldInfo(alias="documentId")
|
32
|
-
"""ID of the matching document"""
|
33
|
-
|
34
|
-
metadata: Optional[Dict[str, object]] = None
|
35
|
-
"""Document metadata"""
|
36
|
-
|
37
|
-
score: float
|
38
|
-
"""Relevance score of the match"""
|
39
|
-
|
40
|
-
title: str
|
41
|
-
"""Document title"""
|
42
|
-
|
43
|
-
updated_at: datetime = FieldInfo(alias="updatedAt")
|
44
|
-
"""Document last update date"""
|
45
|
-
|
46
|
-
|
47
|
-
class SearchExecuteResponse(BaseModel):
|
48
|
-
results: List[Result]
|
49
|
-
|
50
|
-
timing: float
|
51
|
-
|
52
|
-
total: float
|