Skip to content

Commit cc4b7a1

Browse files
feat(api): api update
1 parent 16f09b6 commit cc4b7a1

6 files changed

Lines changed: 123 additions & 5 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-689fa821bc106e236bde463b0a1898788ce8913e70215a7ba49aa8f487115c5c.yml
3-
openapi_spec_hash: 1f5a6e36a198acd72308a315a042daa7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-622b43986c45c1efbeb06dd933786980257f300b7a0edbb2d2a4f708afacce36.yml
3+
openapi_spec_hash: ade837ffc4873d3b50a0fab3f061b397
44
config_hash: ca45358b5407440488ec988e3ee21412

src/hyperspell/resources/memories.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Union, Mapping, Optional, cast
5+
from typing import Dict, List, Union, Mapping, Optional, cast
66
from datetime import datetime
77
from typing_extensions import Literal
88

@@ -257,6 +257,7 @@ def add(
257257
text: str,
258258
collection: Optional[str] | Omit = omit,
259259
date: Union[str, datetime] | Omit = omit,
260+
metadata: Optional[Dict[str, Union[str, float, bool]]] | Omit = omit,
260261
resource_id: str | Omit = omit,
261262
title: Optional[str] | Omit = omit,
262263
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -282,6 +283,9 @@ def add(
282283
the date of the last message). This helps the ranking algorithm and allows you
283284
to filter by date range.
284285
286+
metadata: Custom metadata for filtering. Keys must be alphanumeric with underscores, max
287+
64 chars. Values must be string, number, or boolean.
288+
285289
resource_id: The resource ID to add the document to. If not provided, a new resource ID will
286290
be generated. If provided, the document will be updated if it already exists.
287291
@@ -302,6 +306,7 @@ def add(
302306
"text": text,
303307
"collection": collection,
304308
"date": date,
309+
"metadata": metadata,
305310
"resource_id": resource_id,
306311
"title": title,
307312
},
@@ -528,6 +533,7 @@ def upload(
528533
*,
529534
file: FileTypes,
530535
collection: Optional[str] | Omit = omit,
536+
metadata: Optional[str] | Omit = omit,
531537
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
532538
# The extra values given here take precedence over values defined on the client or passed to this method.
533539
extra_headers: Headers | None = None,
@@ -547,6 +553,9 @@ def upload(
547553
548554
collection: The collection to add the document to.
549555
556+
metadata: Custom metadata as JSON string for filtering. Keys must be alphanumeric with
557+
underscores, max 64 chars. Values must be string, number, or boolean.
558+
550559
extra_headers: Send extra headers
551560
552561
extra_query: Add additional query parameters to the request
@@ -559,6 +568,7 @@ def upload(
559568
{
560569
"file": file,
561570
"collection": collection,
571+
"metadata": metadata,
562572
}
563573
)
564574
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
@@ -803,6 +813,7 @@ async def add(
803813
text: str,
804814
collection: Optional[str] | Omit = omit,
805815
date: Union[str, datetime] | Omit = omit,
816+
metadata: Optional[Dict[str, Union[str, float, bool]]] | Omit = omit,
806817
resource_id: str | Omit = omit,
807818
title: Optional[str] | Omit = omit,
808819
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -828,6 +839,9 @@ async def add(
828839
the date of the last message). This helps the ranking algorithm and allows you
829840
to filter by date range.
830841
842+
metadata: Custom metadata for filtering. Keys must be alphanumeric with underscores, max
843+
64 chars. Values must be string, number, or boolean.
844+
831845
resource_id: The resource ID to add the document to. If not provided, a new resource ID will
832846
be generated. If provided, the document will be updated if it already exists.
833847
@@ -848,6 +862,7 @@ async def add(
848862
"text": text,
849863
"collection": collection,
850864
"date": date,
865+
"metadata": metadata,
851866
"resource_id": resource_id,
852867
"title": title,
853868
},
@@ -1074,6 +1089,7 @@ async def upload(
10741089
*,
10751090
file: FileTypes,
10761091
collection: Optional[str] | Omit = omit,
1092+
metadata: Optional[str] | Omit = omit,
10771093
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
10781094
# The extra values given here take precedence over values defined on the client or passed to this method.
10791095
extra_headers: Headers | None = None,
@@ -1093,6 +1109,9 @@ async def upload(
10931109
10941110
collection: The collection to add the document to.
10951111
1112+
metadata: Custom metadata as JSON string for filtering. Keys must be alphanumeric with
1113+
underscores, max 64 chars. Values must be string, number, or boolean.
1114+
10961115
extra_headers: Send extra headers
10971116
10981117
extra_query: Add additional query parameters to the request
@@ -1105,6 +1124,7 @@ async def upload(
11051124
{
11061125
"file": file,
11071126
"collection": collection,
1127+
"metadata": metadata,
11081128
}
11091129
)
11101130
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])

src/hyperspell/types/memory_add_params.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Union, Optional
5+
from typing import Dict, Union, Optional
66
from datetime import datetime
77
from typing_extensions import Required, Annotated, TypedDict
88

@@ -27,6 +27,13 @@ class MemoryAddParams(TypedDict, total=False):
2727
range.
2828
"""
2929

30+
metadata: Optional[Dict[str, Union[str, float, bool]]]
31+
"""Custom metadata for filtering.
32+
33+
Keys must be alphanumeric with underscores, max 64 chars. Values must be string,
34+
number, or boolean.
35+
"""
36+
3037
resource_id: str
3138
"""The resource ID to add the document to.
3239

src/hyperspell/types/memory_search_params.py

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Union, Optional
5+
from typing import Dict, List, Union, Optional
66
from datetime import datetime
77
from typing_extensions import Literal, Required, Annotated, TypedDict
88

@@ -99,6 +99,12 @@ class OptionsBox(TypedDict, total=False):
9999
before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
100100
"""Only query documents created before this date."""
101101

102+
filter: Optional[Dict[str, object]]
103+
"""Metadata filters using MongoDB-style operators.
104+
105+
Example: {'status': 'published', 'priority': {'$gt': 3}}
106+
"""
107+
102108
weight: float
103109
"""Weight of results from this source.
104110
@@ -117,6 +123,12 @@ class OptionsCollections(TypedDict, total=False):
117123
before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
118124
"""Only query documents created before this date."""
119125

126+
filter: Optional[Dict[str, object]]
127+
"""Metadata filters using MongoDB-style operators.
128+
129+
Example: {'status': 'published', 'priority': {'$gt': 3}}
130+
"""
131+
120132
weight: float
121133
"""Weight of results from this source.
122134
@@ -142,6 +154,12 @@ class OptionsGoogleCalendar(TypedDict, total=False):
142154
list of calendars with the `/integrations/google_calendar/list` endpoint.
143155
"""
144156

157+
filter: Optional[Dict[str, object]]
158+
"""Metadata filters using MongoDB-style operators.
159+
160+
Example: {'status': 'published', 'priority': {'$gt': 3}}
161+
"""
162+
145163
weight: float
146164
"""Weight of results from this source.
147165
@@ -160,6 +178,12 @@ class OptionsGoogleDrive(TypedDict, total=False):
160178
before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
161179
"""Only query documents created before this date."""
162180

181+
filter: Optional[Dict[str, object]]
182+
"""Metadata filters using MongoDB-style operators.
183+
184+
Example: {'status': 'published', 'priority': {'$gt': 3}}
185+
"""
186+
163187
weight: float
164188
"""Weight of results from this source.
165189
@@ -178,6 +202,12 @@ class OptionsGoogleMail(TypedDict, total=False):
178202
before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
179203
"""Only query documents created before this date."""
180204

205+
filter: Optional[Dict[str, object]]
206+
"""Metadata filters using MongoDB-style operators.
207+
208+
Example: {'status': 'published', 'priority': {'$gt': 3}}
209+
"""
210+
181211
label_ids: SequenceNotStr[str]
182212
"""List of label IDs to filter messages (e.g., ['INBOX', 'SENT', 'DRAFT']).
183213
@@ -204,6 +234,12 @@ class OptionsNotion(TypedDict, total=False):
204234
before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
205235
"""Only query documents created before this date."""
206236

237+
filter: Optional[Dict[str, object]]
238+
"""Metadata filters using MongoDB-style operators.
239+
240+
Example: {'status': 'published', 'priority': {'$gt': 3}}
241+
"""
242+
207243
notion_page_ids: SequenceNotStr[str]
208244
"""List of Notion page IDs to search.
209245
@@ -228,6 +264,12 @@ class OptionsReddit(TypedDict, total=False):
228264
before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
229265
"""Only query documents created before this date."""
230266

267+
filter: Optional[Dict[str, object]]
268+
"""Metadata filters using MongoDB-style operators.
269+
270+
Example: {'status': 'published', 'priority': {'$gt': 3}}
271+
"""
272+
231273
period: Literal["hour", "day", "week", "month", "year", "all"]
232274
"""The time period to search. Defaults to 'month'."""
233275

@@ -264,6 +306,12 @@ class OptionsSlack(TypedDict, total=False):
264306
exclude_archived: Optional[bool]
265307
"""If set, pass 'exclude_archived' to Slack. If None, omit the param."""
266308

309+
filter: Optional[Dict[str, object]]
310+
"""Metadata filters using MongoDB-style operators.
311+
312+
Example: {'status': 'published', 'priority': {'$gt': 3}}
313+
"""
314+
267315
include_dms: bool
268316
"""Include direct messages (im) when listing conversations."""
269317

@@ -294,6 +342,12 @@ class OptionsWebCrawler(TypedDict, total=False):
294342
before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
295343
"""Only query documents created before this date."""
296344

345+
filter: Optional[Dict[str, object]]
346+
"""Metadata filters using MongoDB-style operators.
347+
348+
Example: {'status': 'published', 'priority': {'$gt': 3}}
349+
"""
350+
297351
max_depth: int
298352
"""Maximum depth to crawl from the starting URL"""
299353

@@ -327,6 +381,12 @@ class Options(TypedDict, total=False):
327381
collections: OptionsCollections
328382
"""Search options for vault"""
329383

384+
filter: Optional[Dict[str, object]]
385+
"""Metadata filters using MongoDB-style operators.
386+
387+
Example: {'status': 'published', 'priority': {'$gt': 3}}
388+
"""
389+
330390
google_calendar: OptionsGoogleCalendar
331391
"""Search options for Google Calendar"""
332392

src/hyperspell/types/memory_upload_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,10 @@ class MemoryUploadParams(TypedDict, total=False):
1616

1717
collection: Optional[str]
1818
"""The collection to add the document to."""
19+
20+
metadata: Optional[str]
21+
"""Custom metadata as JSON string for filtering.
22+
23+
Keys must be alphanumeric with underscores, max 64 chars. Values must be string,
24+
number, or boolean.
25+
"""

0 commit comments

Comments
 (0)