Skip to content

Commit bd93afe

Browse files
authored
Merge pull request #103 from hyperspell/release-please--branches--main--changes--next
release: 0.29.0
2 parents 447a8be + cbaa508 commit bd93afe

11 files changed

Lines changed: 678 additions & 8 deletions

File tree

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.27.0"
2+
".": "0.28.0"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-622b43986c45c1efbeb06dd933786980257f300b7a0edbb2d2a4f708afacce36.yml
3-
openapi_spec_hash: ade837ffc4873d3b50a0fab3f061b397
4-
config_hash: a3a8e3c71c17eabb21ab8173521181a4
1+
configured_endpoints: 22
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-fc4ab722e6762cc69d533f57bea0d70b00e44a30c4ad8144e14ff70a1170ec7c.yml
3+
openapi_spec_hash: 2533ea676c195d5f7d30a67c201fd32d
4+
config_hash: 5cb785fcdf07e4053f36b434e1db2d8a

CHANGELOG.md

Lines changed: 223 additions & 0 deletions
Large diffs are not rendered by default.

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ from hyperspell.types import Memory, MemoryStatus, MemoryDeleteResponse, MemoryS
7070

7171
Methods:
7272

73+
- <code title="post /memories/update/{source}/{resource_id}">client.memories.<a href="./src/hyperspell/resources/memories.py">update</a>(resource_id, \*, source, \*\*<a href="src/hyperspell/types/memory_update_params.py">params</a>) -> <a href="./src/hyperspell/types/memory_status.py">MemoryStatus</a></code>
7374
- <code title="get /memories/list">client.memories.<a href="./src/hyperspell/resources/memories.py">list</a>(\*\*<a href="src/hyperspell/types/memory_list_params.py">params</a>) -> <a href="./src/hyperspell/types/memory.py">SyncCursorPage[Memory]</a></code>
7475
- <code title="delete /memories/delete/{source}/{resource_id}">client.memories.<a href="./src/hyperspell/resources/memories.py">delete</a>(resource_id, \*, source) -> <a href="./src/hyperspell/types/memory_delete_response.py">MemoryDeleteResponse</a></code>
7576
- <code title="post /memories/add">client.memories.<a href="./src/hyperspell/resources/memories.py">add</a>(\*\*<a href="src/hyperspell/types/memory_add_params.py">params</a>) -> <a href="./src/hyperspell/types/memory_status.py">MemoryStatus</a></code>

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "hyperspell"
3-
version = "0.27.0"
3+
version = "0.28.0"
44
description = "The official Python library for the hyperspell API"
55
dynamic = ["readme"]
66
license = "MIT"

src/hyperspell/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "hyperspell"
4-
__version__ = "0.27.0" # x-release-please-version
4+
__version__ = "0.28.0" # x-release-please-version

src/hyperspell/resources/memories.py

Lines changed: 253 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88

99
import httpx
1010

11-
from ..types import memory_add_params, memory_list_params, memory_search_params, memory_upload_params
11+
from ..types import (
12+
memory_add_params,
13+
memory_list_params,
14+
memory_search_params,
15+
memory_update_params,
16+
memory_upload_params,
17+
)
1218
from .._types import Body, Omit, Query, Headers, NotGiven, FileTypes, omit, not_given
1319
from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
1420
from .._compat import cached_property
@@ -50,11 +56,123 @@ def with_streaming_response(self) -> MemoriesResourceWithStreamingResponse:
5056
"""
5157
return MemoriesResourceWithStreamingResponse(self)
5258

59+
def update(
60+
self,
61+
resource_id: str,
62+
*,
63+
source: Literal[
64+
"collections",
65+
"vault",
66+
"web_crawler",
67+
"notion",
68+
"slack",
69+
"google_calendar",
70+
"reddit",
71+
"box",
72+
"google_drive",
73+
"airtable",
74+
"algolia",
75+
"amplitude",
76+
"asana",
77+
"ashby",
78+
"bamboohr",
79+
"basecamp",
80+
"bubbles",
81+
"calendly",
82+
"confluence",
83+
"clickup",
84+
"datadog",
85+
"deel",
86+
"discord",
87+
"dropbox",
88+
"exa",
89+
"facebook",
90+
"front",
91+
"github",
92+
"gitlab",
93+
"google_docs",
94+
"google_mail",
95+
"google_sheet",
96+
"hubspot",
97+
"jira",
98+
"linear",
99+
"microsoft_teams",
100+
"mixpanel",
101+
"monday",
102+
"outlook",
103+
"perplexity",
104+
"rippling",
105+
"salesforce",
106+
"segment",
107+
"todoist",
108+
"twitter",
109+
"zoom",
110+
],
111+
collection: Union[str, object, None] | Omit = omit,
112+
metadata: Union[Dict[str, Union[str, float, bool]], object, None] | Omit = omit,
113+
text: Union[str, object, None] | Omit = omit,
114+
title: Union[str, object, None] | Omit = omit,
115+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
116+
# The extra values given here take precedence over values defined on the client or passed to this method.
117+
extra_headers: Headers | None = None,
118+
extra_query: Query | None = None,
119+
extra_body: Body | None = None,
120+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
121+
) -> MemoryStatus:
122+
"""Updates an existing document in the index.
123+
124+
You can update the text, collection,
125+
title, and metadata. The document must already exist or a 404 will be returned.
126+
This works for documents from any source (vault, slack, gmail, etc.).
127+
128+
To remove a collection, set it to null explicitly.
129+
130+
Args:
131+
collection: The collection to move the document to. Set to null to remove the collection.
132+
133+
metadata: Custom metadata for filtering. Keys must be alphanumeric with underscores, max
134+
64 chars. Values must be string, number, or boolean. Will be merged with
135+
existing metadata.
136+
137+
text: Full text of the document. If provided, the document will be re-indexed.
138+
139+
title: Title of the document.
140+
141+
extra_headers: Send extra headers
142+
143+
extra_query: Add additional query parameters to the request
144+
145+
extra_body: Add additional JSON properties to the request
146+
147+
timeout: Override the client-level default timeout for this request, in seconds
148+
"""
149+
if not source:
150+
raise ValueError(f"Expected a non-empty value for `source` but received {source!r}")
151+
if not resource_id:
152+
raise ValueError(f"Expected a non-empty value for `resource_id` but received {resource_id!r}")
153+
return self._post(
154+
f"/memories/update/{source}/{resource_id}",
155+
body=maybe_transform(
156+
{
157+
"collection": collection,
158+
"metadata": metadata,
159+
"text": text,
160+
"title": title,
161+
},
162+
memory_update_params.MemoryUpdateParams,
163+
),
164+
options=make_request_options(
165+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
166+
),
167+
cast_to=MemoryStatus,
168+
)
169+
53170
def list(
54171
self,
55172
*,
56173
collection: Optional[str] | Omit = omit,
57174
cursor: Optional[str] | Omit = omit,
175+
filter: Optional[str] | Omit = omit,
58176
size: int | Omit = omit,
59177
source: Optional[
60178
Literal[
@@ -122,6 +240,10 @@ def list(
122240
Args:
123241
collection: Filter documents by collection.
124242
243+
filter:
244+
Filter documents by metadata using MongoDB-style operators. Example:
245+
{"department": "engineering", "priority": {"$gt": 3}}
246+
125247
source: Filter documents by source.
126248
127249
extra_headers: Send extra headers
@@ -144,6 +266,7 @@ def list(
144266
{
145267
"collection": collection,
146268
"cursor": cursor,
269+
"filter": filter,
147270
"size": size,
148271
"source": source,
149272
},
@@ -606,11 +729,123 @@ def with_streaming_response(self) -> AsyncMemoriesResourceWithStreamingResponse:
606729
"""
607730
return AsyncMemoriesResourceWithStreamingResponse(self)
608731

732+
async def update(
733+
self,
734+
resource_id: str,
735+
*,
736+
source: Literal[
737+
"collections",
738+
"vault",
739+
"web_crawler",
740+
"notion",
741+
"slack",
742+
"google_calendar",
743+
"reddit",
744+
"box",
745+
"google_drive",
746+
"airtable",
747+
"algolia",
748+
"amplitude",
749+
"asana",
750+
"ashby",
751+
"bamboohr",
752+
"basecamp",
753+
"bubbles",
754+
"calendly",
755+
"confluence",
756+
"clickup",
757+
"datadog",
758+
"deel",
759+
"discord",
760+
"dropbox",
761+
"exa",
762+
"facebook",
763+
"front",
764+
"github",
765+
"gitlab",
766+
"google_docs",
767+
"google_mail",
768+
"google_sheet",
769+
"hubspot",
770+
"jira",
771+
"linear",
772+
"microsoft_teams",
773+
"mixpanel",
774+
"monday",
775+
"outlook",
776+
"perplexity",
777+
"rippling",
778+
"salesforce",
779+
"segment",
780+
"todoist",
781+
"twitter",
782+
"zoom",
783+
],
784+
collection: Union[str, object, None] | Omit = omit,
785+
metadata: Union[Dict[str, Union[str, float, bool]], object, None] | Omit = omit,
786+
text: Union[str, object, None] | Omit = omit,
787+
title: Union[str, object, None] | Omit = omit,
788+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
789+
# The extra values given here take precedence over values defined on the client or passed to this method.
790+
extra_headers: Headers | None = None,
791+
extra_query: Query | None = None,
792+
extra_body: Body | None = None,
793+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
794+
) -> MemoryStatus:
795+
"""Updates an existing document in the index.
796+
797+
You can update the text, collection,
798+
title, and metadata. The document must already exist or a 404 will be returned.
799+
This works for documents from any source (vault, slack, gmail, etc.).
800+
801+
To remove a collection, set it to null explicitly.
802+
803+
Args:
804+
collection: The collection to move the document to. Set to null to remove the collection.
805+
806+
metadata: Custom metadata for filtering. Keys must be alphanumeric with underscores, max
807+
64 chars. Values must be string, number, or boolean. Will be merged with
808+
existing metadata.
809+
810+
text: Full text of the document. If provided, the document will be re-indexed.
811+
812+
title: Title of the document.
813+
814+
extra_headers: Send extra headers
815+
816+
extra_query: Add additional query parameters to the request
817+
818+
extra_body: Add additional JSON properties to the request
819+
820+
timeout: Override the client-level default timeout for this request, in seconds
821+
"""
822+
if not source:
823+
raise ValueError(f"Expected a non-empty value for `source` but received {source!r}")
824+
if not resource_id:
825+
raise ValueError(f"Expected a non-empty value for `resource_id` but received {resource_id!r}")
826+
return await self._post(
827+
f"/memories/update/{source}/{resource_id}",
828+
body=await async_maybe_transform(
829+
{
830+
"collection": collection,
831+
"metadata": metadata,
832+
"text": text,
833+
"title": title,
834+
},
835+
memory_update_params.MemoryUpdateParams,
836+
),
837+
options=make_request_options(
838+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
839+
),
840+
cast_to=MemoryStatus,
841+
)
842+
609843
def list(
610844
self,
611845
*,
612846
collection: Optional[str] | Omit = omit,
613847
cursor: Optional[str] | Omit = omit,
848+
filter: Optional[str] | Omit = omit,
614849
size: int | Omit = omit,
615850
source: Optional[
616851
Literal[
@@ -678,6 +913,10 @@ def list(
678913
Args:
679914
collection: Filter documents by collection.
680915
916+
filter:
917+
Filter documents by metadata using MongoDB-style operators. Example:
918+
{"department": "engineering", "priority": {"$gt": 3}}
919+
681920
source: Filter documents by source.
682921
683922
extra_headers: Send extra headers
@@ -700,6 +939,7 @@ def list(
700939
{
701940
"collection": collection,
702941
"cursor": cursor,
942+
"filter": filter,
703943
"size": size,
704944
"source": source,
705945
},
@@ -1146,6 +1386,9 @@ class MemoriesResourceWithRawResponse:
11461386
def __init__(self, memories: MemoriesResource) -> None:
11471387
self._memories = memories
11481388

1389+
self.update = to_raw_response_wrapper(
1390+
memories.update,
1391+
)
11491392
self.list = to_raw_response_wrapper(
11501393
memories.list,
11511394
)
@@ -1173,6 +1416,9 @@ class AsyncMemoriesResourceWithRawResponse:
11731416
def __init__(self, memories: AsyncMemoriesResource) -> None:
11741417
self._memories = memories
11751418

1419+
self.update = async_to_raw_response_wrapper(
1420+
memories.update,
1421+
)
11761422
self.list = async_to_raw_response_wrapper(
11771423
memories.list,
11781424
)
@@ -1200,6 +1446,9 @@ class MemoriesResourceWithStreamingResponse:
12001446
def __init__(self, memories: MemoriesResource) -> None:
12011447
self._memories = memories
12021448

1449+
self.update = to_streamed_response_wrapper(
1450+
memories.update,
1451+
)
12031452
self.list = to_streamed_response_wrapper(
12041453
memories.list,
12051454
)
@@ -1227,6 +1476,9 @@ class AsyncMemoriesResourceWithStreamingResponse:
12271476
def __init__(self, memories: AsyncMemoriesResource) -> None:
12281477
self._memories = memories
12291478

1479+
self.update = async_to_streamed_response_wrapper(
1480+
memories.update,
1481+
)
12301482
self.list = async_to_streamed_response_wrapper(
12311483
memories.list,
12321484
)

src/hyperspell/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from .memory_list_params import MemoryListParams as MemoryListParams
1313
from .vault_list_response import VaultListResponse as VaultListResponse
1414
from .memory_search_params import MemorySearchParams as MemorySearchParams
15+
from .memory_update_params import MemoryUpdateParams as MemoryUpdateParams
1516
from .memory_upload_params import MemoryUploadParams as MemoryUploadParams
1617
from .auth_user_token_params import AuthUserTokenParams as AuthUserTokenParams
1718
from .memory_delete_response import MemoryDeleteResponse as MemoryDeleteResponse

src/hyperspell/types/memory_list_params.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ class MemoryListParams(TypedDict, total=False):
1414

1515
cursor: Optional[str]
1616

17+
filter: Optional[str]
18+
"""Filter documents by metadata using MongoDB-style operators.
19+
20+
Example: {"department": "engineering", "priority": {"$gt": 3}}
21+
"""
22+
1723
size: int
1824

1925
source: Optional[

0 commit comments

Comments
 (0)