Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.27.0"
".": "0.28.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 21
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-622b43986c45c1efbeb06dd933786980257f300b7a0edbb2d2a4f708afacce36.yml
openapi_spec_hash: ade837ffc4873d3b50a0fab3f061b397
config_hash: a3a8e3c71c17eabb21ab8173521181a4
configured_endpoints: 22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-fc4ab722e6762cc69d533f57bea0d70b00e44a30c4ad8144e14ff70a1170ec7c.yml
openapi_spec_hash: 2533ea676c195d5f7d30a67c201fd32d
config_hash: 5cb785fcdf07e4053f36b434e1db2d8a
223 changes: 223 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ from hyperspell.types import Memory, MemoryStatus, MemoryDeleteResponse, MemoryS

Methods:

- <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>
- <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>
- <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>
- <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>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "hyperspell"
version = "0.27.0"
version = "0.28.0"
description = "The official Python library for the hyperspell API"
dynamic = ["readme"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/hyperspell/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "hyperspell"
__version__ = "0.27.0" # x-release-please-version
__version__ = "0.28.0" # x-release-please-version
254 changes: 253 additions & 1 deletion src/hyperspell/resources/memories.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@

import httpx

from ..types import memory_add_params, memory_list_params, memory_search_params, memory_upload_params
from ..types import (
memory_add_params,
memory_list_params,
memory_search_params,
memory_update_params,
memory_upload_params,
)
from .._types import Body, Omit, Query, Headers, NotGiven, FileTypes, omit, not_given
from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
from .._compat import cached_property
Expand Down Expand Up @@ -50,11 +56,123 @@ def with_streaming_response(self) -> MemoriesResourceWithStreamingResponse:
"""
return MemoriesResourceWithStreamingResponse(self)

def update(
self,
resource_id: str,
*,
source: Literal[
"collections",
"vault",
"web_crawler",
"notion",
"slack",
"google_calendar",
"reddit",
"box",
"google_drive",
"airtable",
"algolia",
"amplitude",
"asana",
"ashby",
"bamboohr",
"basecamp",
"bubbles",
"calendly",
"confluence",
"clickup",
"datadog",
"deel",
"discord",
"dropbox",
"exa",
"facebook",
"front",
"github",
"gitlab",
"google_docs",
"google_mail",
"google_sheet",
"hubspot",
"jira",
"linear",
"microsoft_teams",
"mixpanel",
"monday",
"outlook",
"perplexity",
"rippling",
"salesforce",
"segment",
"todoist",
"twitter",
"zoom",
],
collection: Union[str, object, None] | Omit = omit,
metadata: Union[Dict[str, Union[str, float, bool]], object, None] | Omit = omit,
text: Union[str, object, None] | Omit = omit,
title: Union[str, object, None] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> MemoryStatus:
"""Updates an existing document in the index.

You can update the text, collection,
title, and metadata. The document must already exist or a 404 will be returned.
This works for documents from any source (vault, slack, gmail, etc.).

To remove a collection, set it to null explicitly.

Args:
collection: The collection to move the document to. Set to null to remove the collection.

metadata: Custom metadata for filtering. Keys must be alphanumeric with underscores, max
64 chars. Values must be string, number, or boolean. Will be merged with
existing metadata.

text: Full text of the document. If provided, the document will be re-indexed.

title: Title of the document.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not source:
raise ValueError(f"Expected a non-empty value for `source` but received {source!r}")
if not resource_id:
raise ValueError(f"Expected a non-empty value for `resource_id` but received {resource_id!r}")
return self._post(
f"/memories/update/{source}/{resource_id}",
body=maybe_transform(
{
"collection": collection,
"metadata": metadata,
"text": text,
"title": title,
},
memory_update_params.MemoryUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=MemoryStatus,
)

def list(
self,
*,
collection: Optional[str] | Omit = omit,
cursor: Optional[str] | Omit = omit,
filter: Optional[str] | Omit = omit,
size: int | Omit = omit,
source: Optional[
Literal[
Expand Down Expand Up @@ -122,6 +240,10 @@ def list(
Args:
collection: Filter documents by collection.

filter:
Filter documents by metadata using MongoDB-style operators. Example:
{"department": "engineering", "priority": {"$gt": 3}}

source: Filter documents by source.

extra_headers: Send extra headers
Expand All @@ -144,6 +266,7 @@ def list(
{
"collection": collection,
"cursor": cursor,
"filter": filter,
"size": size,
"source": source,
},
Expand Down Expand Up @@ -606,11 +729,123 @@ def with_streaming_response(self) -> AsyncMemoriesResourceWithStreamingResponse:
"""
return AsyncMemoriesResourceWithStreamingResponse(self)

async def update(
self,
resource_id: str,
*,
source: Literal[
"collections",
"vault",
"web_crawler",
"notion",
"slack",
"google_calendar",
"reddit",
"box",
"google_drive",
"airtable",
"algolia",
"amplitude",
"asana",
"ashby",
"bamboohr",
"basecamp",
"bubbles",
"calendly",
"confluence",
"clickup",
"datadog",
"deel",
"discord",
"dropbox",
"exa",
"facebook",
"front",
"github",
"gitlab",
"google_docs",
"google_mail",
"google_sheet",
"hubspot",
"jira",
"linear",
"microsoft_teams",
"mixpanel",
"monday",
"outlook",
"perplexity",
"rippling",
"salesforce",
"segment",
"todoist",
"twitter",
"zoom",
],
collection: Union[str, object, None] | Omit = omit,
metadata: Union[Dict[str, Union[str, float, bool]], object, None] | Omit = omit,
text: Union[str, object, None] | Omit = omit,
title: Union[str, object, None] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> MemoryStatus:
"""Updates an existing document in the index.

You can update the text, collection,
title, and metadata. The document must already exist or a 404 will be returned.
This works for documents from any source (vault, slack, gmail, etc.).

To remove a collection, set it to null explicitly.

Args:
collection: The collection to move the document to. Set to null to remove the collection.

metadata: Custom metadata for filtering. Keys must be alphanumeric with underscores, max
64 chars. Values must be string, number, or boolean. Will be merged with
existing metadata.

text: Full text of the document. If provided, the document will be re-indexed.

title: Title of the document.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not source:
raise ValueError(f"Expected a non-empty value for `source` but received {source!r}")
if not resource_id:
raise ValueError(f"Expected a non-empty value for `resource_id` but received {resource_id!r}")
return await self._post(
f"/memories/update/{source}/{resource_id}",
body=await async_maybe_transform(
{
"collection": collection,
"metadata": metadata,
"text": text,
"title": title,
},
memory_update_params.MemoryUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=MemoryStatus,
)

def list(
self,
*,
collection: Optional[str] | Omit = omit,
cursor: Optional[str] | Omit = omit,
filter: Optional[str] | Omit = omit,
size: int | Omit = omit,
source: Optional[
Literal[
Expand Down Expand Up @@ -678,6 +913,10 @@ def list(
Args:
collection: Filter documents by collection.

filter:
Filter documents by metadata using MongoDB-style operators. Example:
{"department": "engineering", "priority": {"$gt": 3}}

source: Filter documents by source.

extra_headers: Send extra headers
Expand All @@ -700,6 +939,7 @@ def list(
{
"collection": collection,
"cursor": cursor,
"filter": filter,
"size": size,
"source": source,
},
Expand Down Expand Up @@ -1146,6 +1386,9 @@ class MemoriesResourceWithRawResponse:
def __init__(self, memories: MemoriesResource) -> None:
self._memories = memories

self.update = to_raw_response_wrapper(
memories.update,
)
self.list = to_raw_response_wrapper(
memories.list,
)
Expand Down Expand Up @@ -1173,6 +1416,9 @@ class AsyncMemoriesResourceWithRawResponse:
def __init__(self, memories: AsyncMemoriesResource) -> None:
self._memories = memories

self.update = async_to_raw_response_wrapper(
memories.update,
)
self.list = async_to_raw_response_wrapper(
memories.list,
)
Expand Down Expand Up @@ -1200,6 +1446,9 @@ class MemoriesResourceWithStreamingResponse:
def __init__(self, memories: MemoriesResource) -> None:
self._memories = memories

self.update = to_streamed_response_wrapper(
memories.update,
)
self.list = to_streamed_response_wrapper(
memories.list,
)
Expand Down Expand Up @@ -1227,6 +1476,9 @@ class AsyncMemoriesResourceWithStreamingResponse:
def __init__(self, memories: AsyncMemoriesResource) -> None:
self._memories = memories

self.update = async_to_streamed_response_wrapper(
memories.update,
)
self.list = async_to_streamed_response_wrapper(
memories.list,
)
Expand Down
1 change: 1 addition & 0 deletions src/hyperspell/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .memory_list_params import MemoryListParams as MemoryListParams
from .vault_list_response import VaultListResponse as VaultListResponse
from .memory_search_params import MemorySearchParams as MemorySearchParams
from .memory_update_params import MemoryUpdateParams as MemoryUpdateParams
from .memory_upload_params import MemoryUploadParams as MemoryUploadParams
from .auth_user_token_params import AuthUserTokenParams as AuthUserTokenParams
from .memory_delete_response import MemoryDeleteResponse as MemoryDeleteResponse
Expand Down
6 changes: 6 additions & 0 deletions src/hyperspell/types/memory_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ class MemoryListParams(TypedDict, total=False):

cursor: Optional[str]

filter: Optional[str]
"""Filter documents by metadata using MongoDB-style operators.

Example: {"department": "engineering", "priority": {"$gt": 3}}
"""

size: int

source: Optional[
Expand Down
Loading